in tools/migration/legacy_fields_migration_lib.py [0:0]
def _extract_legacy_compile_flag_sets_for(toolchain):
"""Get flag sets for default_compile_flags feature."""
result = []
if toolchain.compiler_flag:
result.append(
[None, compile_actions(toolchain), toolchain.compiler_flag, []])
# Migrate compiler_flag from compilation_mode_flags
for cmf in toolchain.compilation_mode_flags:
mode = crosstool_config_pb2.CompilationMode.Name(cmf.mode).lower()
# coverage mode has been a noop since a while
if mode == "coverage":
continue
if (cmf.compiler_flag or
cmf.cxx_flag) and not _get_feature(toolchain, mode):
feature = toolchain.feature.add()
feature.name = mode
if cmf.compiler_flag:
result.append([mode, compile_actions(toolchain), cmf.compiler_flag, []])
if toolchain.cxx_flag:
result.append([None, ALL_CXX_COMPILE_ACTIONS, toolchain.cxx_flag, []])
# Migrate compiler_flag/cxx_flag from compilation_mode_flags
for cmf in toolchain.compilation_mode_flags:
mode = crosstool_config_pb2.CompilationMode.Name(cmf.mode).lower()
# coverage mode has been a noop since a while
if mode == "coverage":
continue
if cmf.cxx_flag:
result.append([mode, ALL_CXX_COMPILE_ACTIONS, cmf.cxx_flag, []])
return result