diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-02-17 23:10:49 +1100 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-04-14 20:55:33 +1000 |
commit | 62a0ef0d02cbb74cd865c1db2ecb7ca1b11f87cd (patch) | |
tree | cb71e03bdad0a8c84402e2c6e20f023aac9d0f2a /gcc/cp/module.cc | |
parent | 3319d1a4aa5ccadc22dcb80252ab884c792b263b (diff) | |
download | gcc-62a0ef0d02cbb74cd865c1db2ecb7ca1b11f87cd.zip gcc-62a0ef0d02cbb74cd865c1db2ecb7ca1b11f87cd.tar.gz gcc-62a0ef0d02cbb74cd865c1db2ecb7ca1b11f87cd.tar.bz2 |
c++: Setup aliases imported from modules [PR106820]
I wonder if more generally we need to be doing more work when importing
definitions from header units especially to handle all the work that
'make_rtl_for_nonlocal_decl' and 'rest_of_decl_compilation' would have
been performing. But this patch fixes at least one missing step.
PR c++/106820
gcc/cp/ChangeLog:
* module.cc (trees_in::decl_value): Assemble alias when needed.
gcc/testsuite/ChangeLog:
* g++.dg/modules/pr106820_a.H: New test.
* g++.dg/modules/pr106820_b.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 | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index c6f71e1..001430a 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -219,6 +219,7 @@ Classes used: #include "dumpfile.h" #include "bitmap.h" #include "cgraph.h" +#include "varasm.h" #include "tree-iterator.h" #include "cpplib.h" #include "mkdeps.h" @@ -8414,6 +8415,14 @@ trees_in::decl_value () if (state->is_header () && decl_tls_wrapper_p (decl)) note_vague_linkage_fn (decl); + + /* Setup aliases for the declaration. */ + if (tree alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl))) + { + alias = TREE_VALUE (TREE_VALUE (alias)); + alias = get_identifier (TREE_STRING_POINTER (alias)); + assemble_alias (decl, alias); + } } else { |