public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Emit DW_AT_{MIPS_,}linkage_name in DW_TAG_variable instead of DW_TAG_member for C++ static data members
@ 2010-06-17  8:43 Jakub Jelinek
  2010-06-21 16:31 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2010-06-17  8:43 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

My request to allow DW_AT_linkage_name on DW_TAG_member has been denied,
with explanation that it should go into the corresponding DW_TAG_variable.
This patch implements that.

Ok for trunk?

2010-06-17  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (add_linkage_name): New function.  Don't add
	anything to DW_TAG_member DIEs.
	(add_name_and_src_coords_attributes): Use it.
	(gen_variable_die): Call it for C++ static data members if
	specification is DW_TAG_member.

--- gcc/dwarf2out.c.jj	2010-06-17 09:17:12.000000000 +0200
+++ gcc/dwarf2out.c	2010-06-17 09:48:51.000000000 +0200
@@ -17331,6 +17331,34 @@ add_src_coords_attributes (dw_die_ref di
   add_AT_unsigned (die, DW_AT_decl_line, s.line);
 }
 
+/* Add DW_AT_{,MIPS_}linkage_name attribute for the given decl.  */
+
+static void
+add_linkage_name (dw_die_ref die, tree decl)
+{
+  if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
+       && TREE_PUBLIC (decl)
+       && !DECL_ABSTRACT (decl)
+       && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
+       && die->die_tag != DW_TAG_member)
+    {
+      /* Defer until we have an assembler name set.  */
+      if (!DECL_ASSEMBLER_NAME_SET_P (decl))
+	{
+	  limbo_die_node *asm_name;
+
+	  asm_name = ggc_alloc_cleared_limbo_die_node ();
+	  asm_name->die = die;
+	  asm_name->created_for = decl;
+	  asm_name->next = deferred_asm_name;
+	  deferred_asm_name = asm_name;
+	}
+      else if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
+	add_AT_string (die, AT_linkage_name,
+		       IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+    }
+}
+
 /* Add a DW_AT_name attribute and source coordinate attribute for the
    given decl, but only if it actually has a name.  */
 
@@ -17348,26 +17376,7 @@ add_name_and_src_coords_attributes (dw_d
       if (! DECL_ARTIFICIAL (decl))
 	add_src_coords_attributes (die, decl);
 
-      if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
-	  && TREE_PUBLIC (decl)
-	  && !DECL_ABSTRACT (decl)
-	  && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl)))
-	{
-	  /* Defer until we have an assembler name set.  */
-	  if (!DECL_ASSEMBLER_NAME_SET_P (decl))
-	    {
-	      limbo_die_node *asm_name;
-
-	      asm_name = ggc_alloc_cleared_limbo_die_node ();
-	      asm_name->die = die;
-	      asm_name->created_for = decl;
-	      asm_name->next = deferred_asm_name;
-	      deferred_asm_name = asm_name;
-	    }
-	  else if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
-	    add_AT_string (die, AT_linkage_name,
-			   IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
-	}
+      add_linkage_name (die, decl);
     }
 
 #ifdef VMS_DEBUGGING_INFO
@@ -18985,6 +18994,9 @@ gen_variable_die (tree decl, tree origin
 
 	  if (get_AT_unsigned (old_die, DW_AT_decl_line) != (unsigned) s.line)
 	    add_AT_unsigned (var_die, DW_AT_decl_line, s.line);
+
+	  if (old_die->die_tag == DW_TAG_member)
+	    add_linkage_name (var_die, decl);
 	}
     }
   else

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Emit DW_AT_{MIPS_,}linkage_name in DW_TAG_variable instead of DW_TAG_member for C++ static data members
  2010-06-17  8:43 [PATCH] Emit DW_AT_{MIPS_,}linkage_name in DW_TAG_variable instead of DW_TAG_member for C++ static data members Jakub Jelinek
@ 2010-06-21 16:31 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2010-06-21 16:31 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-21 16:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-17  8:43 [PATCH] Emit DW_AT_{MIPS_,}linkage_name in DW_TAG_variable instead of DW_TAG_member for C++ static data members Jakub Jelinek
2010-06-21 16:31 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).