diff options
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 22 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 23 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/dbxout.c | 20 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 20 | ||||
-rw-r--r-- | gcc/godump.c | 12 | ||||
-rw-r--r-- | gcc/objcp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/objcp/objcp-decl.h | 11 | ||||
-rw-r--r-- | gcc/tree.c | 17 | ||||
-rw-r--r-- | gcc/tree.h | 5 |
13 files changed, 62 insertions, 94 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 98e37104f62..f2c127c97bb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-04-14 Paolo Carlini <paolo.carlini@oracle.com> + + * tree.h (TYPE_IDENTIFIER): Declare. + * tree.c (subrange_type_for_debug_p): Use it. + * godump.c (go_format_type): Likewise. + * dwarf2out.c (is_cxx_auto, modified_type_die, + gen_type_die_with_usage, gen_type_die_with_usage): Likewise. + * dbxout.c (dbxout_type, dbxout_symbol): Likewise. + 2014-04-14 Jan Hubicka <hubicka@ucw.cz> PR lto/60820 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index acf1987cebe..76ff91a9d6c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2014-04-14 Paolo Carlini <paolo.carlini@oracle.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity, components_to_record): + Use TYPE_IDENTIFIER. + * gcc-interface/utils.c (make_aligning_type, maybe_pad_type, + finish_record_type, rest_of_record_type_compilation): Likewise. + 2014-04-14 Eric Botcazou <ebotcazou@adacore.com> * snames.ads-tmpl (Name_Ivdep): New pragma-related name. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index ae512b0b22c..f3f3d6d44eb 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -2671,10 +2671,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) for (index = ndim - 1; index >= 0; index--) { tree gnu_index = TYPE_INDEX_TYPE (gnu_index_types[index]); - tree gnu_index_name = TYPE_NAME (gnu_index); - - if (TREE_CODE (gnu_index_name) == TYPE_DECL) - gnu_index_name = DECL_NAME (gnu_index_name); + tree gnu_index_name = TYPE_IDENTIFIER (gnu_index); /* Make sure to reference the types themselves, and not just their names, as the debugger may fall back on them. */ @@ -3652,12 +3649,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) if (debug_info_p) { tree gnu_subtype_marker = make_node (RECORD_TYPE); - tree gnu_unpad_base_name = TYPE_NAME (gnu_unpad_base_type); + tree gnu_unpad_base_name + = TYPE_IDENTIFIER (gnu_unpad_base_type); tree gnu_size_unit = TYPE_SIZE_UNIT (gnu_type); - if (TREE_CODE (gnu_unpad_base_name) == TYPE_DECL) - gnu_unpad_base_name = DECL_NAME (gnu_unpad_base_name); - TYPE_NAME (gnu_subtype_marker) = create_concat_name (gnat_entity, "XVS"); finish_record_type (gnu_subtype_marker, @@ -4976,11 +4971,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) false, !gnu_decl, definition, false); if (TYPE_IS_PADDING_P (gnu_type)) - { - gnu_entity_name = TYPE_NAME (gnu_type); - if (TREE_CODE (gnu_entity_name) == TYPE_DECL) - gnu_entity_name = DECL_NAME (gnu_entity_name); - } + gnu_entity_name = TYPE_IDENTIFIER (gnu_type); /* Now set the RM size of the type. We cannot do it before padding because we need to accept arbitrary RM sizes on integral types. */ @@ -7035,7 +7026,7 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list, { Node_Id gnat_discr = Name (variant_part), variant; tree gnu_discr = gnat_to_gnu (gnat_discr); - tree gnu_name = TYPE_NAME (gnu_record_type); + tree gnu_name = TYPE_IDENTIFIER (gnu_record_type); tree gnu_var_name = concat_name (get_identifier (Get_Name_String (Chars (gnat_discr))), "XVN"); @@ -7047,9 +7038,6 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list, unsigned int variants_align = 0; unsigned int i; - if (TREE_CODE (gnu_name) == TYPE_DECL) - gnu_name = DECL_NAME (gnu_name); - gnu_union_name = concat_name (gnu_name, IDENTIFIER_POINTER (gnu_var_name)); diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index cfa07919180..44877b6d767 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -706,10 +706,8 @@ make_aligning_type (tree type, unsigned int align, tree size, tree vblock_addr_st = size_binop (PLUS_EXPR, record_addr_st, room_st); tree voffset_st, pos, field; - tree name = TYPE_NAME (type); + tree name = TYPE_IDENTIFIER (type); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); name = concat_name (name, "ALIGN"); TYPE_NAME (record_type) = name; @@ -1203,14 +1201,8 @@ maybe_pad_type (tree type, tree size, unsigned int align, && DECL_IGNORED_P (TYPE_NAME (type)))) { tree marker = make_node (RECORD_TYPE); - tree name = TYPE_NAME (record); - tree orig_name = TYPE_NAME (type); - - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - - if (TREE_CODE (orig_name) == TYPE_DECL) - orig_name = DECL_NAME (orig_name); + tree name = TYPE_IDENTIFIER (record); + tree orig_name = TYPE_IDENTIFIER (type); TYPE_NAME (marker) = concat_name (name, "XVS"); finish_record_type (marker, @@ -1419,7 +1411,7 @@ finish_record_type (tree record_type, tree field_list, int rep_level, bool debug_info_p) { enum tree_code code = TREE_CODE (record_type); - tree name = TYPE_NAME (record_type); + tree name = TYPE_IDENTIFIER (record_type); tree ada_size = bitsize_zero_node; tree size = bitsize_zero_node; bool had_size = TYPE_SIZE (record_type) != 0; @@ -1431,8 +1423,6 @@ finish_record_type (tree record_type, tree field_list, int rep_level, /* Always attach the TYPE_STUB_DECL for a record type. It is required to generate debug info and have a parallel type. */ - if (name && TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); TYPE_STUB_DECL (record_type) = create_type_stub_decl (name, record_type); /* Globally initialize the record first. If this is a rep'ed record, @@ -1692,13 +1682,10 @@ rest_of_record_type_compilation (tree record_type) tree new_record_type = make_node (TREE_CODE (record_type) == QUAL_UNION_TYPE ? UNION_TYPE : TREE_CODE (record_type)); - tree orig_name = TYPE_NAME (record_type), new_name; + tree orig_name = TYPE_IDENTIFIER (record_type), new_name; tree last_pos = bitsize_zero_node; tree old_field, prev_old_field = NULL_TREE; - if (TREE_CODE (orig_name) == TYPE_DECL) - orig_name = DECL_NAME (orig_name); - new_name = concat_name (orig_name, TREE_CODE (record_type) == QUAL_UNION_TYPE ? "XVU" : "XVE"); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5e1043bd165..9510587f77c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-04-14 Paolo Carlini <paolo.carlini@oracle.com> + * cp-tree.h (TYPE_IDENTIFIER): Remove declaration. + +2014-04-14 Paolo Carlini <paolo.carlini@oracle.com> + * pt.c (mark_template_parm): Use template_parm_level_and_index. 2014-04-11 Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index bafc32d57cd..f459e55bc84 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1252,7 +1252,6 @@ extern bool statement_code_p[MAX_TREE_CODES]; enum languages { lang_c, lang_cplusplus, lang_java }; /* Macros to make error reporting functions' lives easier. */ -#define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE))) #define TYPE_LINKAGE_IDENTIFIER(NODE) \ (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE))) #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE))) diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 7a13289ef66..5fbbdf6853b 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -2159,12 +2159,12 @@ dbxout_type (tree type, int full) another type's definition; instead, output an xref and let the definition come when the name is defined. */ stabstr_S ((TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu"); - if (TYPE_NAME (type) != 0 - /* The C frontend creates for anonymous variable length - records/unions TYPE_NAME with DECL_NAME NULL. */ - && (TREE_CODE (TYPE_NAME (type)) != TYPE_DECL - || DECL_NAME (TYPE_NAME (type)))) - dbxout_type_name (type); + if (TYPE_IDENTIFIER (type)) + { + /* Note that the C frontend creates for anonymous variable + length records/unions TYPE_NAME with DECL_NAME NULL. */ + dbxout_type_name (type); + } else { stabstr_S ("$$"); @@ -2800,9 +2800,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED) DBX format, and it confuses some tools such as objdump. */ && tree_fits_uhwi_p (TYPE_SIZE (type))) { - tree name = TYPE_NAME (type); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); + tree name = TYPE_IDENTIFIER (type); dbxout_begin_complex_stabs (); stabstr_I (name); @@ -2859,9 +2857,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED) This is what represents `struct foo' with no typedef. */ /* In C++, the name of a type is the corresponding typedef. In C, it is an IDENTIFIER_NODE. */ - tree name = TYPE_NAME (type); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); + tree name = TYPE_IDENTIFIER (type); dbxout_begin_complex_stabs (); stabstr_I (name); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 67b37eba506..721f7618034 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10230,9 +10230,7 @@ is_cxx_auto (tree type) { if (is_cxx ()) { - tree name = TYPE_NAME (type); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); + tree name = TYPE_IDENTIFIER (type); if (name == get_identifier ("auto") || name == get_identifier ("decltype(auto)")) return true; @@ -10509,10 +10507,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, /* This probably indicates a bug. */ else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type) { - name = TYPE_NAME (type); - if (name - && TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); + name = TYPE_IDENTIFIER (type); add_name_attribute (mod_type_die, name ? IDENTIFIER_POINTER (name) : "__unknown__"); } @@ -19856,10 +19851,9 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die, dw_die_ref type_die = lookup_type_die (type); if (type_die == NULL) { - tree name = TYPE_NAME (type); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); - type_die = new_die (DW_TAG_unspecified_type, comp_unit_die (), type); + tree name = TYPE_IDENTIFIER (type); + type_die = new_die (DW_TAG_unspecified_type, comp_unit_die (), + type); add_name_attribute (type_die, IDENTIFIER_POINTER (name)); equate_type_number_to_die (type, type_die); } @@ -19869,9 +19863,7 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die, default: if (is_cxx_auto (type)) { - tree name = TYPE_NAME (type); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); + tree name = TYPE_IDENTIFIER (type); dw_die_ref *die = (name == get_identifier ("auto") ? &auto_die : &decltype_auto_die); if (!*die) diff --git a/gcc/godump.c b/gcc/godump.c index 04aaff00ffa..6d6b819bea3 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -577,9 +577,7 @@ go_format_type (struct godump_container *container, tree type, tree name; void **slot; - name = TYPE_NAME (type); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); + name = TYPE_IDENTIFIER (type); slot = htab_find_slot (container->invalid_hash, IDENTIFIER_POINTER (name), NO_INSERT); @@ -684,9 +682,7 @@ go_format_type (struct godump_container *container, tree type, tree name; void **slot; - name = TYPE_NAME (TREE_TYPE (type)); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); + name = TYPE_IDENTIFIER (TREE_TYPE (type)); slot = htab_find_slot (container->invalid_hash, IDENTIFIER_POINTER (name), NO_INSERT); @@ -805,9 +801,7 @@ go_format_type (struct godump_container *container, tree type, tree name; void **slot; - name = TYPE_NAME (TREE_TYPE (field)); - if (TREE_CODE (name) == TYPE_DECL) - name = DECL_NAME (name); + name = TYPE_IDENTIFIER (TREE_TYPE (field)); slot = htab_find_slot (container->invalid_hash, IDENTIFIER_POINTER (name), diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog index c4183ea31d2..63b37304887 100644 --- a/gcc/objcp/ChangeLog +++ b/gcc/objcp/ChangeLog @@ -1,3 +1,8 @@ +2014-04-14 Paolo Carlini <paolo.carlini@oracle.com> + + * objcp-decl.h (OBJC_TYPE_NAME, OBJC_SET_TYPE_NAME): Use + TYPE_IDENTIFIER. + 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> Update copyright years diff --git a/gcc/objcp/objcp-decl.h b/gcc/objcp/objcp-decl.h index bcfcbdecd24..652f9933895 100644 --- a/gcc/objcp/objcp-decl.h +++ b/gcc/objcp/objcp-decl.h @@ -55,16 +55,9 @@ extern tree objcp_end_compound_stmt (tree, int); objcp_end_compound_stmt (stmt, flags) #undef OBJC_TYPE_NAME -#define OBJC_TYPE_NAME(type) \ - (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL \ - ? DECL_NAME (TYPE_NAME (type)) \ - : TYPE_NAME (type)) +#define OBJC_TYPE_NAME(type) (TYPE_IDENTIFIER (type)) #undef OBJC_SET_TYPE_NAME -#define OBJC_SET_TYPE_NAME(type, name) \ - if(TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) \ - DECL_NAME (TYPE_NAME (type)) = name; \ - else \ - TYPE_NAME (type) = name; +#define OBJC_SET_TYPE_NAME(type, name) (TYPE_IDENTIFIER (type) = (name)) #undef TYPE_OBJC_INFO #define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info diff --git a/gcc/tree.c b/gcc/tree.c index efee5e69cf2..f42a0b7d889 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7796,20 +7796,9 @@ subrange_type_for_debug_p (const_tree type, tree *lowval, tree *highval) || TREE_CODE (base_type) == BOOLEAN_TYPE) && int_size_in_bytes (type) == int_size_in_bytes (base_type) && tree_int_cst_equal (low, TYPE_MIN_VALUE (base_type)) - && tree_int_cst_equal (high, TYPE_MAX_VALUE (base_type))) - { - tree type_name = TYPE_NAME (type); - tree base_type_name = TYPE_NAME (base_type); - - if (type_name && TREE_CODE (type_name) == TYPE_DECL) - type_name = DECL_NAME (type_name); - - if (base_type_name && TREE_CODE (base_type_name) == TYPE_DECL) - base_type_name = DECL_NAME (base_type_name); - - if (type_name == base_type_name) - return false; - } + && tree_int_cst_equal (high, TYPE_MAX_VALUE (base_type)) + && TYPE_IDENTIFIER (type) == TYPE_IDENTIFIER (base_type)) + return false; if (lowval) *lowval = low; diff --git a/gcc/tree.h b/gcc/tree.h index 9fbc5c4ec2c..2f8f85ff93c 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1906,6 +1906,11 @@ extern void protected_set_expr_location (tree, location_t); It is an IDENTIFIER_NODE. */ #define DECL_NAME(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.name) +/* The IDENTIFIER_NODE associated with the TYPE_NAME field. */ +#define TYPE_IDENTIFIER(NODE) \ + (TYPE_NAME (NODE) && DECL_P (TYPE_NAME (NODE)) \ + ? DECL_NAME (TYPE_NAME (NODE)) : TYPE_NAME (NODE)) + /* Every ..._DECL node gets a unique number. */ #define DECL_UID(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.uid) |