]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Handle RAW_DATA_CST in modules.cc [PR119076]
authorJakub Jelinek <jakub@redhat.com>
Wed, 12 Mar 2025 07:01:09 +0000 (08:01 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 12 Mar 2025 07:01:09 +0000 (08:01 +0100)
commit28b05e4317a6eade2ba46076ef17f9e138c57a34
tree5ad5e895745152e6f11aecd224172def28768abc
parent2fa031afe4ea78f490f06e487c48089d7376827c
c++: Handle RAW_DATA_CST in modules.cc [PR119076]

The following testcases (one with #embed, one with large initializer
turned into RAW_DATA_CST) show that I forgot to handle RAW_DATA_CST in
module streaming.

Similar to the PCH case we need to stream out RAW_DATA_CST with NULL
RAW_DATA_OWNER (i.e. a tree which has data owned by libcpp buffer) so
that it will be streamed back in as STRING_CST which owns the data,
but because the data can be really large (hopefully not so much for
header modules though), without actually trying to build a STRING_CST
on the module writing side because that would mean another large
allocation and copying of the large data.
RAW_DATA_CST with RAW_DATA_OWNER then needs to be streamed out and in
by streaming the owner and offset from owner's data and length.

2025-03-12  Jakub Jelinek  <jakub@redhat.com>

PR c++/119076
* module.cc (trees_out::start): Handle RAW_DATA_CST.
(trees_in::start): Likewise.
(trees_out::core_vals): Likewise.
(trees_in::core_vals): Likewise.

* g++.dg/modules/pr119076-1_a.H: New test.
* g++.dg/modules/pr119076-1_b.C: New test.
* g++.dg/modules/pr119076-2_a.H: New test.
* g++.dg/modules/pr119076-2_b.C: New test.
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/pr119076-1_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr119076-1_b.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr119076-2_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr119076-2_b.C [new file with mode: 0644]