diff options
author | Jan Hubicka <jh@suse.cz> | 2018-11-06 16:41:32 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2018-11-06 15:41:32 +0000 |
commit | 1b62186ca2f6dfffe5b563bdef8d8fc2aff952cc (patch) | |
tree | 2c580fa31c9b234a042b2b4a199929d0ceb366b3 | |
parent | cdb3f2f4314f5cd72927eb7f620e1df14e1da574 (diff) | |
download | gcc-1b62186ca2f6dfffe5b563bdef8d8fc2aff952cc.zip gcc-1b62186ca2f6dfffe5b563bdef8d8fc2aff952cc.tar.gz gcc-1b62186ca2f6dfffe5b563bdef8d8fc2aff952cc.tar.bz2 |
tree.c (fld_simplified_type_name): Break out form ...
* tree.c (fld_simplified_type_name): Break out form ...
(free_lang_data_in_type): ... here.
(fld_type_variant_equal_p): Use it.
From-SVN: r265847
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree.c | 26 |
2 files changed, 26 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77fcf1e..56809ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-06 Jan Hubicka <jh@suse.cz> + + * tree.c (fld_simplified_type_name): Break out form ... + (free_lang_data_in_type): ... here. + (fld_type_variant_equal_p): Use it. + 2018-11-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * config/default-d.c: Include memmodel.h. @@ -5083,6 +5083,21 @@ fld_worklist_push (tree t, struct free_lang_data_d *fld) +/* Return simplified TYPE_NAME of TYPE. */ + +static tree +fld_simplified_type_name (tree type) +{ + if (!TYPE_NAME (type) || TREE_CODE (TYPE_NAME (type)) != TYPE_DECL) + return TYPE_NAME (type); + /* Drop TYPE_DECLs in TYPE_NAME in favor of the identifier in the + TYPE_DECL if the type doesn't have linkage. + this must match fld_ */ + if (type != TYPE_MAIN_VARIANT (type) || ! type_with_linkage_p (type)) + return DECL_NAME (TYPE_NAME (type)); + return TYPE_NAME (type); +} + /* Do same comparsion as check_qualified_type skipping lang part of type and be more permissive about type names: we only care that names are same (for diagnostics) and that ODR names are the same. */ @@ -5091,8 +5106,8 @@ static bool fld_type_variant_equal_p (tree t, tree v) { if (TYPE_QUALS (t) != TYPE_QUALS (v) - || TYPE_NAME (t) != TYPE_NAME (v) || TYPE_ALIGN (t) != TYPE_ALIGN (v) + || fld_simplified_type_name (t) != fld_simplified_type_name (v) || !attribute_list_equal (TYPE_ATTRIBUTES (t), TYPE_ATTRIBUTES (v))) return false; @@ -5338,12 +5353,11 @@ free_lang_data_in_type (tree type) } /* Drop TYPE_DECLs in TYPE_NAME in favor of the identifier in the - TYPE_DECL if the type doesn't have linkage. */ + TYPE_DECL if the type doesn't have linkage. + this must match fld_ */ if (type != TYPE_MAIN_VARIANT (type) || ! type_with_linkage_p (type)) - { - TYPE_NAME (type) = TYPE_IDENTIFIER (type); - TYPE_STUB_DECL (type) = NULL; - } + TYPE_STUB_DECL (type) = NULL; + TYPE_NAME (type) = fld_simplified_type_name (type); } |