]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarf2out.c (modified_type_die): Don't add DW_AT_name to DW_TAG_{const,volatile}_type...
authorJakub Jelinek <jakub@redhat.com>
Mon, 5 Oct 2009 19:52:20 +0000 (21:52 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 5 Oct 2009 19:52:20 +0000 (21:52 +0200)
* dwarf2out.c (modified_type_die): Don't add DW_AT_name to
DW_TAG_{const,volatile}_type if its DW_AT_type already has the
same name and isn't the main variant.

From-SVN: r152468

gcc/ChangeLog
gcc/dwarf2out.c

index d4b7a7fcf91447372ed738ba4bbfbd026d94938f..4c6dbef0069c56091cc8ed7b4c75d6b31e7faf57 100644 (file)
@@ -1,5 +1,9 @@
 2009-10-05  Jakub Jelinek  <jakub@redhat.com>
 
+       * dwarf2out.c (modified_type_die): Don't add DW_AT_name to
+       DW_TAG_{const,volatile}_type if its DW_AT_type already has the
+       same name and isn't the main variant.
+
        PR debug/41558
        * dwarf2out.c (loc_by_reference): Removed.
        (dw_loc_list_1): New function.
index b92f69ce87209537622e32c67f368880f5d7fc56..f9304e54327870ce0edb7f0b2381d36d1e485013 100644 (file)
@@ -11971,10 +11971,16 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
 
   /* Builtin types don't have a DECL_ORIGINAL_TYPE.  For those,
      don't output a DW_TAG_typedef, since there isn't one in the
-     user's program; just attach a DW_AT_name to the type.  */
+     user's program; just attach a DW_AT_name to the type.
+     Don't attach a DW_AT_name to DW_TAG_const_type or DW_TAG_volatile_type
+     if the base type already has the same name.  */
   if (name
-      && (TREE_CODE (name) != TYPE_DECL
-         || (TREE_TYPE (name) == qualified_type && DECL_NAME (name))))
+      && ((TREE_CODE (name) != TYPE_DECL
+          && (qualified_type == TYPE_MAIN_VARIANT (type)
+              || (!is_const_type && !is_volatile_type)))
+         || (TREE_CODE (name) == TYPE_DECL
+             && TREE_TYPE (name) == qualified_type
+             && DECL_NAME (name))))
     {
       if (TREE_CODE (name) == TYPE_DECL)
        /* Could just call add_name_and_src_coords_attributes here,