summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/debug-info-template-member.cpp
diff options
context:
space:
mode:
authorMatthew Voss <matthew.voss@sony.com>2018-10-03 18:45:04 +0000
committerMatthew Voss <matthew.voss@sony.com>2018-10-03 18:45:04 +0000
commit2016536304c66618a8321bedeb9bcc8c7b3eee1e (patch)
tree2690db311b76ef0309ffa6a72395b98a2789a629 /clang/test/CodeGenCXX/debug-info-template-member.cpp
parentf8ab35a4f464753751c1df2b56b6c2f9c75d56a7 (diff)
downloadbcm5719-llvm-2016536304c66618a8321bedeb9bcc8c7b3eee1e.tar.gz
bcm5719-llvm-2016536304c66618a8321bedeb9bcc8c7b3eee1e.zip
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
Diffstat (limited to 'clang/test/CodeGenCXX/debug-info-template-member.cpp')
-rw-r--r--clang/test/CodeGenCXX/debug-info-template-member.cpp25
1 files changed, 25 insertions, 0 deletions
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 <typename T>
+T var = T();
+template <typename P>
+P var<P *> = P();
+template <typename T, int N>
+T varray[N];
+void f3() {
+ var<int> = 1;
+ var<int *> = 1;
+ varray<int, 1>[0] = 1;
+}
OpenPOWER on IntegriCloud