]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarf: emit DW_AT_name for DW_TAG_GNU_formal_parameter_pack [PR70536]
authorEd Catmur <ed@catmur.uk>
Sat, 4 Feb 2023 16:50:33 +0000 (17:50 +0100)
committerJason Merrill <jason@redhat.com>
Thu, 13 Feb 2025 21:54:01 +0000 (22:54 +0100)
Per https://wiki.dwarfstd.org/C++0x_Variadic_templates.md
DW_TAG_GNU_formal_parameter_pack should have a DW_AT_name:

17$:      DW_TAG_formal_parameter_pack
              DW_AT_name("args")
18$:          DW_TAG_formal_parameter
                  ! no DW_AT_name attribute
                  DW_AT_type(reference to 13$)
(...)

PR c++/70536

gcc/ChangeLog:

* dwarf2out.cc (gen_formal_parameter_pack_die): Add name attr.

gcc/testsuite/ChangeLog:

* g++.dg/debug/dwarf2/template-func-params-7.C: Check for pack names.

Co-authored-by: Jason Merrill <jason@redhat.com>
gcc/dwarf2out.cc
gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C

index 43884f206c07facf980495c3b5e01a37bdbf33bf..ed7d9402200e3e829888d7bb85a3a85e38045f91 100644 (file)
@@ -23195,7 +23195,7 @@ gen_formal_parameter_pack_die  (tree parm_pack,
              && subr_die);
 
   parm_pack_die = new_die (DW_TAG_GNU_formal_parameter_pack, subr_die, parm_pack);
-  add_src_coords_attributes (parm_pack_die, parm_pack);
+  add_name_and_src_coords_attributes (parm_pack_die, parm_pack);
 
   for (arg = pack_arg; arg; arg = DECL_CHAIN (arg))
     {
index 22b0e4f984daed7e88aaa190f391903ee5573e7b..4e95c238bcd38a8d60bc144e18a9b7205ab2cbca 100644 (file)
@@ -23,6 +23,9 @@
 // These 3 function template instantiations has a total of 3 template
 // parameters named T.
 // { dg-final { scan-assembler-times "\.ascii \"T.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } }
+// And the packs also have names.
+// { dg-final { scan-assembler-times "\.ascii \"PTs.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } }
+// { dg-final { scan-assembler-times "\.ascii \"args.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } }
 
 
 void
@@ -35,11 +38,11 @@ printf(const char* s)
   */
 }
 
-template<typename T, typename... PackTypes>
+template<typename T, typename... PTs>
 void
 printf(const char* s,
        T value,
-       PackTypes... args)
+       PTs... args)
 {
   while (*s)
     {