r181644 - Debug Info: Silently accept template argument packs

David Blaikie dblaikie at gmail.com
Fri May 10 15:53:25 PDT 2013


Author: dblaikie
Date: Fri May 10 17:53:25 2013
New Revision: 181644

URL: http://llvm.org/viewvc/llvm-project?rev=181644&view=rev
Log:
Debug Info: Silently accept template argument packs

We could support the GCC extension DW_TAG_GNU_template_parameter_pack if
we're feeling adventurous, at some point - but I don't think GDB's doing
anything useful with it yet anyway.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-template.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=181644&r1=181643&r2=181644&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri May 10 17:53:25 2013
@@ -1264,10 +1264,12 @@ CollectTemplateParams(const TemplatePara
       // We could support this with the GCC extension
       // DW_TAG_GNU_template_template_param
       break;
+    case TemplateArgument::Pack:
+      // And this with DW_TAG_GNU_template_parameter_pack
+      break;
     // these next 4 should never occur
     case TemplateArgument::Expression:
     case TemplateArgument::TemplateExpansion:
-    case TemplateArgument::Pack:
     case TemplateArgument::Null:
       llvm_unreachable(
           "These argument types shouldn't exist in concrete types");

Modified: cfe/trunk/test/CodeGenCXX/debug-info-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template.cpp?rev=181644&r1=181643&r2=181644&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-template.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-template.cpp Fri May 10 17:53:25 2013
@@ -1,5 +1,12 @@
 // RUN: %clang -S -emit-llvm -target x86_64-unknown_unknown -g %s -o - -std=c++11 | FileCheck %s
 
+// CHECK: [[EMPTY:![0-9]*]] = metadata !{i32 0}
+
+// func<...> doesn't have any template arguments listed since we don't support
+// packs yet. This could be encoded with GNU's
+// DW_TAG_GNU_template_parameter_pack extension.
+// CHECK: {{.*}}, metadata [[EMPTY]], i32 {{[0-9]*}}} ; [ DW_TAG_subprogram ] {{.*}} [func<int>]
+
 // CHECK: [[INT:![0-9]*]] = {{.*}} ; [ DW_TAG_base_type ] [int]
 // CHECK: metadata [[TCI:![0-9]*]], i32 0, i32 1, %class.TC* @tci, null} ; [ DW_TAG_variable ] [tci]
 // CHECK: [[TC:![0-9]*]] = {{.*}}, metadata [[TCARGS:![0-9]*]]} ; [ DW_TAG_class_type ] [TC<unsigned int, 2, &glb, &foo::e, &foo::f>]
@@ -67,3 +74,6 @@ int glb;
 
 TC<unsigned, 2, &glb, &foo::e, &foo::f> tci;
 TC<int, -3, nullptr, nullptr, nullptr> tcn;
+
+template<typename ...Ts> int func() { return 0; }
+int anchor = func<int>();





More information about the cfe-commits mailing list