diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-03-07 23:09:03 +1100 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-03-08 09:01:27 +1100 |
commit | 9ccd03dee4c35a24c6699a58a7251a5277a91cf5 (patch) | |
tree | 7e9f9fd9c0b640518c96059ad1aafc5161632443 /gcc/cp/module.cc | |
parent | f5c1224708a0cf9cc2770c44bbbe7d0c883942be (diff) | |
download | gcc-9ccd03dee4c35a24c6699a58a7251a5277a91cf5.zip gcc-9ccd03dee4c35a24c6699a58a7251a5277a91cf5.tar.gz gcc-9ccd03dee4c35a24c6699a58a7251a5277a91cf5.tar.bz2 |
c++: Redetermine whether to write vtables on stream-in [PR114229]
We currently always stream DECL_INTERFACE_KNOWN, which is needed since
many kinds of declarations already have their interface determined at
parse time. But for vtables and type-info declarations we need to
re-evaluate on stream-in as whether they need to be emitted or not
changes in each TU, so this patch clears DECL_INTERFACE_KNOWN on these
kinds of declarations so that they can go through 'import_export_decl'
again.
Note that the precise details of the virt-2 tests will need to change
when we implement the resolution of [1], for now I just updated the test
to not fail with the new (current) semantics.
[1]: https://github.com/itanium-cxx-abi/cxx-abi/pull/171
PR c++/114229
gcc/cp/ChangeLog:
* module.cc (trees_out::core_bools): Redetermine
DECL_INTERFACE_KNOWN on stream-in for vtables and tinfo.
* decl2.cc (import_export_decl): Add fixme for ABI changes with
module vtables and tinfo.
gcc/testsuite/ChangeLog:
* g++.dg/modules/virt-2_b.C: Update test to acknowledge that we
now emit vtables here too.
* g++.dg/modules/virt-3_a.C: New test.
* g++.dg/modules/virt-3_b.C: New test.
* g++.dg/modules/virt-3_c.C: New test.
* g++.dg/modules/virt-3_d.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc/cp/module.cc')
-rw-r--r-- | gcc/cp/module.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 5310475..9905552 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -5376,7 +5376,17 @@ trees_out::core_bools (tree t) WB (t->decl_common.lang_flag_2); WB (t->decl_common.lang_flag_3); WB (t->decl_common.lang_flag_4); - WB (t->decl_common.lang_flag_5); + + { + /* This is DECL_INTERFACE_KNOWN: We should redetermine whether + we need to import or export any vtables or typeinfo objects + on stream-in. */ + bool interface_known = t->decl_common.lang_flag_5; + if (VAR_P (t) && (DECL_VTABLE_OR_VTT_P (t) || DECL_TINFO_P (t))) + interface_known = false; + WB (interface_known); + } + WB (t->decl_common.lang_flag_6); WB (t->decl_common.lang_flag_7); WB (t->decl_common.lang_flag_8); |