]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree.h (TYPE_IDENTIFIER): Declare.
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 14 Apr 2014 18:10:27 +0000 (18:10 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 14 Apr 2014 18:10:27 +0000 (18:10 +0000)
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.

/cp
2014-04-14  Paolo Carlini  <paolo.carlini@oracle.com>

* cp-tree.h (TYPE_IDENTIFIER): Remove declaration.

/objcp
2014-04-14  Paolo Carlini  <paolo.carlini@oracle.com>

* objcp-decl.h (OBJC_TYPE_NAME, OBJC_SET_TYPE_NAME): Use
TYPE_IDENTIFIER.

/ada
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.

From-SVN: r209390

13 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/utils.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/dbxout.c
gcc/dwarf2out.c
gcc/godump.c
gcc/objcp/ChangeLog
gcc/objcp/objcp-decl.h
gcc/tree.c
gcc/tree.h

index 98e37104f62287e8361857369e2bc59eb615acae..f2c127c97bb4ac9b45c05071957812fd37f7695b 100644 (file)
@@ -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
index acf1987cebe3b4464abe45fc97806a249c3c0d91..76ff91a9d6ceec67d2cc4d2209a2acb9bd8f076d 100644 (file)
@@ -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.
index ae512b0b22c8e072d9a46dc9ca91122dfa07b305..f3f3d6d44ebd5fc4d88676d95df2677b8b901068 100644 (file)
@@ -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));
 
index cfa079191809a48b7b8a272209d3fbaa5d0099b4..44877b6d7670c3e807521c53fb23739bb0894037 100644 (file)
@@ -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");
index 5e1043bd1653263bb1e7c4ad894664221f986371..9510587f77c6a814a76ed2cf6f3a3c4f149cf616 100644 (file)
@@ -1,3 +1,7 @@
+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.
index bafc32d57cd9e81aa2f706ed597dddf5f05fe12f..f459e55bc84f991c0af45655be47063f353a93fb 100644 (file)
@@ -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)))
index 7a13289ef6618649f9f37cf001594568e344b457..5fbbdf6853b1f97643600ced17b4746c3b5e5f61 100644 (file)
@@ -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);
index 67b37eba506644d214e57a1c99d28a88468734d4..721f761803424e123091e0a63c85a552863b8d21 100644 (file)
@@ -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)
index 04aaff00ffa91cc3ca9484741a2154a40387d68c..6d6b819bea3140a9773a399263aaa51086d12a04 100644 (file)
@@ -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),
index c4183ea31d29ed7c277bfd7342617ba38bf4a533..63b37304887adac95d8a40a681cd8b1bc55554bc 100644 (file)
@@ -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
index bcfcbdecd24a15b5d759c3674c4c55ff06a03936..652f9933895d5d15393c4c15fed287b549a68851 100644 (file)
@@ -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
index efee5e69cf2b5ed25c9fbbda01d94e83b7a8498a..f42a0b7d889caef8af450d3f29719daff9f775b7 100644 (file)
@@ -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;
index 9fbc5c4ec2c3bf8adcfbc04a45ae4310af916293..2f8f85ff93cc0ca0f2d6467ee5e255277e1ab4c3 100644 (file)
@@ -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)