diff options
author | Jan Hubicka <jh@suse.cz> | 2018-11-07 15:12:20 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2018-11-07 14:12:20 +0000 |
commit | 7d3a67d7b0c01c0370226db7840c9ef6e054b56c (patch) | |
tree | 675a9609516280881e63e2682b1801765bd6fe6d /gcc/tree.c | |
parent | 667b3ec15d86a3d9c22a7469c4353cd9432b4c76 (diff) | |
download | gcc-7d3a67d7b0c01c0370226db7840c9ef6e054b56c.zip gcc-7d3a67d7b0c01c0370226db7840c9ef6e054b56c.tar.gz gcc-7d3a67d7b0c01c0370226db7840c9ef6e054b56c.tar.bz2 |
ipa-devirt.c (odr_types_equivalent_p): Expect constants than const decls in TREE_VALUE of enum.
* ipa-devirt.c (odr_types_equivalent_p): Expect constants
than const decls in TREE_VALUE of enum.
(dump_type_inheritance_graph): Improve duplicate dumping.
(free_enum_values): New.
(build_type_inheritance_graph): Use it.
* tree.c (free_lang_data_in_type): Free TYPE_VALUES of enums
which are not main variants or not ODR types.
(verify_type_variant): Expect variants to have no TYPE_VALUES.
From-SVN: r265875
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -5345,6 +5345,20 @@ free_lang_data_in_type (tree type, struct free_lang_data_d *fld) || SCALAR_FLOAT_TYPE_P (type) || FIXED_POINT_TYPE_P (type)) { + if (TREE_CODE (type) == ENUMERAL_TYPE) + { + /* Type values are used only for C++ ODR checking. Drop them + for all type variants and non-ODR types. */ + if (TYPE_MAIN_VARIANT (type) != type + || !type_with_linkage_p (type)) + TYPE_VALUES (type) = NULL; + else + /* Simplify representation by recording only values rather + than const decls. */ + for (tree e = TYPE_VALUES (type); e; e = TREE_CHAIN (e)) + if (TREE_CODE (TREE_VALUE (e)) == CONST_DECL) + TREE_VALUE (e) = DECL_INITIAL (TREE_VALUE (e)); + } free_lang_data_in_one_sizepos (&TYPE_MIN_VALUE (type)); free_lang_data_in_one_sizepos (&TYPE_MAX_VALUE (type)); } @@ -13525,7 +13539,8 @@ verify_type_variant (const_tree t, tree tv) } /* Check various uses of TYPE_VALUES_RAW. */ - if (TREE_CODE (t) == ENUMERAL_TYPE) + if (TREE_CODE (t) == ENUMERAL_TYPE + && TYPE_VALUES (t)) verify_variant_match (TYPE_VALUES); else if (TREE_CODE (t) == ARRAY_TYPE) verify_variant_match (TYPE_DOMAIN); |