]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Redetermine whether to write vtables on stream-in [PR114229]
authorNathaniel Shead <nathanieloshead@gmail.com>
Thu, 7 Mar 2024 12:09:03 +0000 (23:09 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Thu, 7 Mar 2024 22:01:27 +0000 (09:01 +1100)
commit9ccd03dee4c35a24c6699a58a7251a5277a91cf5
tree7e9f9fd9c0b640518c96059ad1aafc5161632443
parentf5c1224708a0cf9cc2770c44bbbe7d0c883942be
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>
gcc/cp/decl2.cc
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/virt-2_b.C
gcc/testsuite/g++.dg/modules/virt-3_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/virt-3_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/virt-3_c.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/virt-3_d.C [new file with mode: 0644]