diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-05-24 21:38:14 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-05-24 19:38:14 +0000 |
commit | 233ce289250944dde071638799f9ba1a51a0a9bf (patch) | |
tree | fcafa16d16e0f29657b3cc4999c520546d0e89f1 /gcc/cp | |
parent | bc0c7f396b0c9648365aee462e25107db00227e8 (diff) | |
download | gcc-233ce289250944dde071638799f9ba1a51a0a9bf.zip gcc-233ce289250944dde071638799f9ba1a51a0a9bf.tar.gz gcc-233ce289250944dde071638799f9ba1a51a0a9bf.tar.bz2 |
re PR lto/66180 (many -Wodr false positives when building LLVM with -flto)
PR lto/66180
* ipa-devirt.c (type_with_linkage): Check that TYPE_STUB_DECL
is set; check for assembler name at LTO time.
(type_in_anonymous_namespace): Remove hacks, check that all
anonymous types are called "<anon>"
(odr_type_p): Simplify; add check for "<anon>"
(odr_subtypes_equivalent): Add odr_type_p check.
* tree.c (need_assembler_name_p): Even anonymous namespace needs
assembler name.
* mangle.c (mangle_decl): Mangle anonymous namespace types as
"<anon>".
* g++.dg/lto/pr66180_0.C: New testcase.
* g++.dg/lto/pr66180_1.C: New testcase.
From-SVN: r223633
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 15 |
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 35d5f34..b5168c2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-05-22 Jan Hubicka <hubicka@ucw.cz> + + PR lto/66180 + * mangle.c (mangle_decl): Mangle anonymous namespace types as + "<anon>". + 2015-05-23 Nathan Sidwell <nathan@acm.org> PR c++/65936 diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 647ec70..aa466cd 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3511,7 +3511,20 @@ mangle_decl (const tree decl) if (dep) return; - id = get_mangled_id (decl); + /* During LTO we keep mangled names of TYPE_DECLs for ODR type merging. + It is not needed to assign names to anonymous namespace, but we use the + "<anon>" marker to be able to tell if type is C++ ODR type or type + produced by other language. */ + if (TREE_CODE (decl) == TYPE_DECL + && TYPE_STUB_DECL (TREE_TYPE (decl)) + && !TREE_PUBLIC (TYPE_STUB_DECL (TREE_TYPE (decl)))) + id = get_identifier ("<anon>"); + else + { + gcc_assert (TREE_CODE (decl) != TYPE_DECL + || !no_linkage_check (TREE_TYPE (decl), true)); + id = get_mangled_id (decl); + } SET_DECL_ASSEMBLER_NAME (decl, id); if (G.need_abi_warning |