OSDN Git Service

Candidate fix for PR c++/41570
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Oct 2009 11:57:30 +0000 (11:57 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Oct 2009 11:57:30 +0000 (11:57 +0000)
gcc/ChangeLog:
PR c++/41570
* gcc/dwarf2out.c (template_parameter_pack_die,
gen_formal_parameter_pack_die): Use add_name_and_src_coords_attributes.

gcc/testsuite/ChangeLog:
PR c++/41570
* gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152663 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C [new file with mode: 0644]

index 81e7fda..73103c0 100644 (file)
@@ -1,3 +1,9 @@
+2009-10-12  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/41570
+       * gcc/dwarf2out.c (template_parameter_pack_die,
+       gen_formal_parameter_pack_die): Use add_name_and_src_coords_attributes.
+
 2009-10-12  Alexandre Oliva  <aoliva@redhat.com>
 
        PR debug/41616
 2009-10-12  Alexandre Oliva  <aoliva@redhat.com>
 
        PR debug/41616
index a3f7ad2..a8d0048 100644 (file)
@@ -12353,13 +12353,10 @@ template_parameter_pack_die (tree parm_pack,
   dw_die_ref die;
   int j;
 
   dw_die_ref die;
   int j;
 
-  gcc_assert (parent_die
-             && parm_pack
-             && DECL_NAME (parm_pack));
+  gcc_assert (parent_die && parm_pack);
 
   die = new_die (DW_TAG_GNU_template_parameter_pack, parent_die, parm_pack);
 
   die = new_die (DW_TAG_GNU_template_parameter_pack, parent_die, parm_pack);
-  add_AT_string (die, DW_AT_name, IDENTIFIER_POINTER (DECL_NAME (parm_pack)));
-
+  add_name_and_src_coords_attributes (die, parm_pack);
   for (j = 0; j < TREE_VEC_LENGTH (parm_pack_args); j++)
     generic_parameter_die (parm_pack,
                           TREE_VEC_ELT (parm_pack_args, j),
   for (j = 0; j < TREE_VEC_LENGTH (parm_pack_args); j++)
     generic_parameter_die (parm_pack,
                           TREE_VEC_ELT (parm_pack_args, j),
@@ -17207,12 +17204,10 @@ gen_formal_parameter_pack_die  (tree parm_pack,
 
   gcc_assert (parm_pack
              && lang_hooks.function_parameter_pack_p (parm_pack)
 
   gcc_assert (parm_pack
              && lang_hooks.function_parameter_pack_p (parm_pack)
-             && DECL_NAME (parm_pack)
              && subr_die);
 
   parm_pack_die = new_die (DW_TAG_GNU_formal_parameter_pack, subr_die, parm_pack);
              && subr_die);
 
   parm_pack_die = new_die (DW_TAG_GNU_formal_parameter_pack, subr_die, parm_pack);
-  add_AT_string (parm_pack_die, DW_AT_name,
-                IDENTIFIER_POINTER (DECL_NAME (parm_pack)));
+  add_src_coords_attributes (parm_pack_die, parm_pack);
 
   for (arg = pack_arg; arg; arg = TREE_CHAIN (arg))
     {
 
   for (arg = pack_arg; arg; arg = TREE_CHAIN (arg))
     {
index 20d915f..36d90f3 100644 (file)
@@ -1,3 +1,8 @@
+2009-10-12  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/41570
+       * gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C: New test.
+
 2009-10-12  Alexandre Oliva  <aoliva@redhat.com>
 
        PR debug/41616
 2009-10-12  Alexandre Oliva  <aoliva@redhat.com>
 
        PR debug/41616
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C b/gcc/testsuite/g++.dg/debug/dwarf2/template-params-7.C
new file mode 100644 (file)
index 0000000..d021d96
--- /dev/null
@@ -0,0 +1,21 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR debug/30161
+// { dg-options "-std=c++0x -g -dA -fno-merge-debug-strings" }
+
+// The type M<> should have one DW_TAG_GNU_template_parameter_pack DIE,
+// with no DW_AT_name attribute. We don't test the fact that it has no
+// DW_AT_name though.
+// { dg-final { scan-assembler-times "DIE \\(0x.*?\\) DW_TAG_GNU_template_parameter_pack" 1 } }
+
+
+template <typename...>
+struct M
+{
+};
+
+struct R :
+    M<>
+{
+};
+
+R r;