From 0b8e7b5940e0f1ed21fec09ea1bea918b0ac5935 Mon Sep 17 00:00:00 2001 From: hlopko Date: Thu, 7 Mar 2019 00:01:43 -0800 Subject: [PATCH] Use is_using_fission in legacy_fields_migrator Since unknown commit is submitted, the principled variable to use in per_object_debug_info is is_using_fission, not per_object_debug_info_file (in case of thinlto build, the former is present also for thinlto bitcode compile, the latter only for backend compile). RELNOTES: None. PiperOrigin-RevId: 237192121 --- tools/migration/legacy_fields_migration_lib.py | 5 +++-- tools/migration/legacy_fields_migration_lib_test.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/migration/legacy_fields_migration_lib.py b/tools/migration/legacy_fields_migration_lib.py index d97a070..46d5869 100644 --- a/tools/migration/legacy_fields_migration_lib.py +++ b/tools/migration/legacy_fields_migration_lib.py @@ -126,6 +126,7 @@ def migrate_legacy_fields(crosstool): toolchain, "per_object_debug_info"): # feature { # name: "per_object_debug_info" + # enabled: true # flag_set { # action: "assemble" # action: "preprocess-assemble" @@ -134,7 +135,7 @@ def migrate_legacy_fields(crosstool): # action: "c++-module-codegen" # action: "lto-backend" # flag_group { - # expand_if_all_available: 'per_object_debug_info_file'", + # expand_if_all_available: 'is_using_fission'", # flag: "-gsplit-dwarf" # } # } @@ -148,7 +149,7 @@ def migrate_legacy_fields(crosstool): "preprocess-assemble", "lto-backend" ] flag_group = flag_set.flag_group.add() - flag_group.expand_if_all_available[:] = ["per_object_debug_info_file"] + flag_group.expand_if_all_available[:] = ["is_using_fission"] flag_group.flag[:] = ["-gsplit-dwarf"] if toolchain.objcopy_embed_flag and not _get_feature( diff --git a/tools/migration/legacy_fields_migration_lib_test.py b/tools/migration/legacy_fields_migration_lib_test.py index 45d2017..3049502 100644 --- a/tools/migration/legacy_fields_migration_lib_test.py +++ b/tools/migration/legacy_fields_migration_lib_test.py @@ -941,6 +941,9 @@ class LegacyFieldsMigrationLibTest(unittest.TestCase): output = crosstool.toolchain[0] self.assertEqual(output.feature[0].name, "per_object_debug_info") self.assertEqual(output.feature[0].enabled, True) + self.assertEqual( + output.feature[0].flag_set[0].flag_group[0].expand_if_all_available, + ["is_using_fission"]) def test_supports_fission_not_migrated_on_false(self): crosstool = make_crosstool("supports_fission: false") @@ -1025,7 +1028,7 @@ class LegacyFieldsMigrationLibTest(unittest.TestCase): flag_group { flag: '%{foo}' } - flag_group { + flag_group { flag: 'bar' } }