diff options
author | Jan Hubicka <jh@suse.cz> | 2018-08-30 17:05:38 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2018-08-30 15:05:38 +0000 |
commit | 2ebbdb6ca3f69cdac97aeba48a7f00ea40337cd5 (patch) | |
tree | 1e40ab202c9f3cae5ffbc665346f1312fa99cb81 /gcc/ipa-utils.h | |
parent | 21592ebe9d8d1d3486be575d6a64dfa10eba17b1 (diff) | |
download | gcc-2ebbdb6ca3f69cdac97aeba48a7f00ea40337cd5.zip gcc-2ebbdb6ca3f69cdac97aeba48a7f00ea40337cd5.tar.gz gcc-2ebbdb6ca3f69cdac97aeba48a7f00ea40337cd5.tar.bz2 |
lto-streamer-out.c (DFS::DFS_write_tree_body): Do not follow TYPE_STUB_DECL.
* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not follow
TYPE_STUB_DECL.
(hash_tree): Do not visit TYPE_STUB_DECL.
* tree-streamer-out.c (write_ts_type_common_tree_pointers): Do not
stream TYPE_STUB_DECL.
* tree-streamer-in.c (lto_input_ts_type_common_tree_pointers): Likewise.
* ipa-utils.h (type_with_linkage_p): Do not rely on TYPE_STUB_DECL
after free_lang_data.
(type_in_anonymous_namespace_p): Likewise.
From-SVN: r263985
Diffstat (limited to 'gcc/ipa-utils.h')
-rw-r--r-- | gcc/ipa-utils.h | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h index 1609ac1..98f2a75 100644 --- a/gcc/ipa-utils.h +++ b/gcc/ipa-utils.h @@ -179,22 +179,24 @@ polymorphic_type_binfo_p (const_tree binfo) inline bool type_with_linkage_p (const_tree t) { - if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL - || !TYPE_STUB_DECL (t)) + if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL) + return false; + + /* To support -fno-lto-odr-type-merigng recognize types with vtables + to have linkage. */ + if (RECORD_OR_UNION_TYPE_P (t) + && TYPE_BINFO (t) && BINFO_VTABLE (TYPE_BINFO (t))) + return true; + + /* After free_lang_data was run and -flto-odr-type-merging we can recongize + types with linkage by presence of mangled name. */ + if (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t))) + return true; + + /* If free lang data was not run check if indeed the type looks like C++ + type with linkage. */ + if (in_lto_p || !TYPE_STUB_DECL (t)) return false; - /* In LTO do not get confused by non-C++ produced types or types built - with -fno-lto-odr-type-merigng. */ - if (in_lto_p) - { - /* To support -fno-lto-odr-type-merigng recognize types with vtables - to have linkage. */ - if (RECORD_OR_UNION_TYPE_P (t) - && TYPE_BINFO (t) && BINFO_VTABLE (TYPE_BINFO (t))) - return true; - /* With -flto-odr-type-merging C++ FE specify mangled names - for all types with the linkage. */ - return DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)); - } if (!RECORD_OR_UNION_TYPE_P (t) && TREE_CODE (t) != ENUMERAL_TYPE) return false; @@ -214,18 +216,16 @@ type_in_anonymous_namespace_p (const_tree t) { gcc_checking_assert (type_with_linkage_p (t)); - if (!TREE_PUBLIC (TYPE_STUB_DECL (t))) - { - /* C++ FE uses magic <anon> as assembler names of anonymous types. - verify that this match with type_in_anonymous_namespace_p. */ - gcc_checking_assert (!in_lto_p - || !DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)) - || !strcmp ("<anon>", - IDENTIFIER_POINTER - (DECL_ASSEMBLER_NAME (TYPE_NAME (t))))); - return true; - } - return false; + /* free_lang_data clears TYPE_STUB_DECL but sets assembler name to + "<anon>" */ + if (DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t))) + return !strcmp ("<anon>", + IDENTIFIER_POINTER + (DECL_ASSEMBLER_NAME (TYPE_NAME (t)))); + else if (!TYPE_STUB_DECL (t)) + return false; + else + return !TREE_PUBLIC (TYPE_STUB_DECL (t)); } /* Return true of T is type with One Definition Rule info attached. |