summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/debug-info-static-member.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-11-21 00:20:58 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-11-21 00:20:58 +0000
commitaf08085c8632504106b8a9604fee12702399b549 (patch)
treed8569c34be0a745b24a9a58ec2d50c5260f0a846 /clang/test/CodeGenCXX/debug-info-static-member.cpp
parentc57059059d7f0047024b971e4f75418cdee9b761 (diff)
downloadbcm5719-llvm-af08085c8632504106b8a9604fee12702399b549.tar.gz
bcm5719-llvm-af08085c8632504106b8a9604fee12702399b549.zip
DebugInfo: Fix another case of r222377 when we do have a definition of the variable, but we might not be emitting it (such as templates)
llvm-svn: 222485
Diffstat (limited to 'clang/test/CodeGenCXX/debug-info-static-member.cpp')
-rw-r--r--clang/test/CodeGenCXX/debug-info-static-member.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/debug-info-static-member.cpp b/clang/test/CodeGenCXX/debug-info-static-member.cpp
index 803d0dc1c7f..d80f978b77b 100644
--- a/clang/test/CodeGenCXX/debug-info-static-member.cpp
+++ b/clang/test/CodeGenCXX/debug-info-static-member.cpp
@@ -42,6 +42,10 @@ int main()
// CHECK: ![[DECL_C:[0-9]+]] = metadata !{metadata !"0xd\00c\00{{.*}}", {{.*}} [ DW_TAG_member ] [c] [line {{.*}}, size 0, align 0, offset 0] [public] [static]
// CHECK: metadata !"0xd\00const_c\00{{.*}}", {{.*}} [ DW_TAG_member ] [const_c] [line {{.*}}, size 0, align 0, offset 0] [public] [static]
// CHECK: metadata !"0xd\00x_a\00{{.*}}", {{.*}} [ DW_TAG_member ] [x_a] {{.*}} [public] [static]
+
+// CHECK: ; [ DW_TAG_structure_type ] [static_decl_templ<int>] {{.*}} [def]
+// CHECK: ; [ DW_TAG_member ] [static_decl_templ_var]
+
// CHECK: [[NS_X:![0-9]+]] = {{.*}} ; [ DW_TAG_namespace ] [x]
// Test this in an anonymous namespace to ensure the type is retained even when
@@ -52,6 +56,7 @@ struct anon_static_decl_struct {
};
}
+
// CHECK: ; [ DW_TAG_structure_type ] [anon_static_decl_struct] {{.*}} [def]
// CHECK: ; [ DW_TAG_member ] [anon_static_decl_var]
@@ -59,6 +64,18 @@ int ref() {
return anon_static_decl_struct::anon_static_decl_var;
}
+template<typename T>
+struct static_decl_templ {
+ static const int static_decl_templ_var = 7;
+};
+
+template<typename T>
+const int static_decl_templ<T>::static_decl_templ_var;
+
+int static_decl_templ_ref() {
+ return static_decl_templ<int>::static_decl_templ_var;
+}
+
// CHECK: metadata !{metadata !"0x34\00a\00{{.*}}", null, {{.*}} @_ZN1C1aE, metadata ![[DECL_A]]} ; [ DW_TAG_variable ] [a] {{.*}} [def]
// CHECK: metadata !{metadata !"0x34\00b\00{{.*}}", null, {{.*}} @_ZN1C1bE, metadata ![[DECL_B]]} ; [ DW_TAG_variable ] [b] {{.*}} [def]
// CHECK: metadata !{metadata !"0x34\00c\00{{.*}}", null, {{.*}} @_ZN1C1cE, metadata ![[DECL_C]]} ; [ DW_TAG_variable ] [c] {{.*}} [def]
OpenPOWER on IntegriCloud