summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/debug-info-static-member.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-01-16 19:54:35 +0000
committerEric Christopher <echristo@gmail.com>2013-01-16 19:54:35 +0000
commitc3ad1003fda622abc091827a4dca8e5f81cc26d5 (patch)
treef7da90d9747609e5d6883d87c7df9dca10d1416c /test/CodeGenCXX/debug-info-static-member.cpp
parentf5a45ea642b826a2312aa604a2e3fbf5269fc077 (diff)
Add testcase missed yesterday. Patch from Paul Robinson.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172648 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/debug-info-static-member.cpp')
-rw-r--r--test/CodeGenCXX/debug-info-static-member.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/CodeGenCXX/debug-info-static-member.cpp b/test/CodeGenCXX/debug-info-static-member.cpp
new file mode 100644
index 0000000000..42b3f63307
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-static-member.cpp
@@ -0,0 +1,41 @@
+// RUN: %clangxx -g -O0 %s -emit-llvm -S -o - | FileCheck %s
+// PR14471
+
+
+class C
+{
+ static int a;
+ const static int const_a = 16;
+protected:
+ static int b;
+ const static int const_b = 17;
+public:
+ static int c;
+ const static int const_c = 18;
+ int d;
+};
+
+int C::a = 4;
+int C::b = 2;
+int C::c = 1;
+
+int main()
+{
+ C instance_C;
+ instance_C.d = 8;
+ return C::c;
+}
+
+// The definition of C::a drives the emission of class C, which is
+// why the definition of "a" comes before the declarations while
+// "b" and "c" come after.
+
+// CHECK: metadata !"a", {{.*}} @_ZN1C1aE, metadata ![[DECL_A:[0-9]+]]} ; [ DW_TAG_variable ] [a] {{.*}} [def]
+// CHECK: ![[DECL_A]] = metadata {{.*}} [ DW_TAG_member ] [a] [line {{.*}}, size 0, align 0, offset 0] [private] [static]
+// CHECK: metadata !"const_a", {{.*}} [ DW_TAG_member ] [const_a] [line {{.*}}, size 0, align 0, offset 0] [private] [static]
+// CHECK: ![[DECL_B:[0-9]+]] {{.*}} metadata !"b", {{.*}} [ DW_TAG_member ] [b] [line {{.*}}, size 0, align 0, offset 0] [protected] [static]
+// CHECK: metadata !"const_b", {{.*}} [ DW_TAG_member ] [const_b] [line {{.*}}, size 0, align 0, offset 0] [protected] [static]
+// CHECK: ![[DECL_C:[0-9]+]] {{.*}} metadata !"c", {{.*}} [ DW_TAG_member ] [c] [line {{.*}}, size 0, align 0, offset 0] [static]
+// CHECK: metadata !"const_c", {{.*}} [ DW_TAG_member ] [const_c] [line {{.*}}, size 0, align 0, offset 0] [static]
+// CHECK: metadata !"b", {{.*}} @_ZN1C1bE, metadata ![[DECL_B]]} ; [ DW_TAG_variable ] [b] {{.*}} [def]
+// CHECK: metadata !"c", {{.*}} @_ZN1C1cE, metadata ![[DECL_C]]} ; [ DW_TAG_variable ] [c] {{.*}} [def]