From 2016536304c66618a8321bedeb9bcc8c7b3eee1e Mon Sep 17 00:00:00 2001 From: Matthew Voss Date: Wed, 3 Oct 2018 18:45:04 +0000 Subject: Add template type and value parameter metadata nodes to template variable specializations Summary: Add an optional attribute referring to a tuple of type and value template parameter nodes to the DIGlobalVariable node. This allows us to record the parameters of template variable specializations. Reviewers: dblaikie, aprantl, probinson, JDevlieghere, clayborg, jingham Reviewed By: JDevlieghere Subscribers: cfe-commits Tags: #debug-info Differential Revision: https://reviews.llvm.org/D52058 llvm-svn: 343707 --- .../test/CodeGenCXX/debug-info-template-member.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'clang/test/CodeGenCXX/debug-info-template-member.cpp') diff --git a/clang/test/CodeGenCXX/debug-info-template-member.cpp b/clang/test/CodeGenCXX/debug-info-template-member.cpp index a6aa1a05a25..db6006cab82 100644 --- a/clang/test/CodeGenCXX/debug-info-template-member.cpp +++ b/clang/test/CodeGenCXX/debug-info-template-member.cpp @@ -22,6 +22,19 @@ inline int add3(int x) { // CHECK: [[X]] = !DIGlobalVariableExpression(var: [[XV:.*]], expr: !DIExpression()) // CHECK: [[XV]] = distinct !DIGlobalVariable(name: "x", // CHECK-SAME: type: ![[OUTER_FOO_INNER_ID:[0-9]+]] +// +// CHECK: {{![0-9]+}} = distinct !DIGlobalVariable( +// CHECK-SAME: name: "var" +// CHECK-SAME: templateParams: {{![0-9]+}} +// CHECK: !DITemplateTypeParameter(name: "T", type: [[TY:![0-9]+]]) +// CHECK: {{![0-9]+}} = distinct !DIGlobalVariable( +// CHECK-SAME: name: "var" +// CHECK-SAME: templateParams: {{![0-9]+}} +// CHECK: !DITemplateTypeParameter(name: "P", type: {{![0-9]+}}) +// CHECK: {{![0-9]+}} = distinct !DIGlobalVariable( +// CHECK-SAME: name: "varray" +// CHECK-SAME: templateParams: {{![0-9]+}} +// CHECK: !DITemplateValueParameter(name: "N", type: [[TY]], value: i32 1) // CHECK: ![[OUTER_FOO_INNER_ID:[0-9]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "inner"{{.*}}, identifier: // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo" @@ -103,3 +116,15 @@ void f2() { // declaration/reference in the compile unit. // CHECK: !DISubprogram(name: "MyClass" // CHECK-SAME: scope: [[C]] + +template +T var = T(); +template +P var

= P(); +template +T varray[N]; +void f3() { + var = 1; + var = 1; + varray[0] = 1; +} -- cgit v1.2.3