summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp12
-rw-r--r--clang/test/CodeGenCXX/debug-info-lb.cpp27
2 files changed, 33 insertions, 6 deletions
diff --git a/clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp b/clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp
index 5b0370eb749..8e047f84a49 100644
--- a/clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp
+++ b/clang/test/CodeGenCXX/debug-info-anon-union-vars.cpp
@@ -44,7 +44,12 @@ void instantiate(int x) {
buildBytes(x);
}
+// CHECK: ![[UNION:[0-9]+]] = !DICompositeType(tag: DW_TAG_union_type,
+// CHECK-NOT: name:
+// CHECK: elements
// CHECK: [[FILE:.*]] = !DIFile(filename: "{{.*}}debug-info-anon-union-vars.cpp",
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i", scope: ![[UNION]],
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "c", scope: ![[UNION]],
// CHECK: !DIGlobalVariable(name: "c",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true
// CHECK: !DIGlobalVariable(name: "d",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true
// CHECK: !DIGlobalVariable(name: "a",{{.*}} file: [[FILE]], line: 6,{{.*}} isLocal: true, isDefinition: true
@@ -55,9 +60,4 @@ void instantiate(int x) {
// CHECK: !DILocalVariable(name: "c", {{.*}}, flags: DIFlagArtificial
// CHECK: !DILocalVariable(
// CHECK-NOT: name:
-// CHECK: type: ![[UNION:[0-9]+]]
-// CHECK: ![[UNION]] = !DICompositeType(tag: DW_TAG_union_type,
-// CHECK-NOT: name:
-// CHECK: elements
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i", scope: ![[UNION]],
-// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "c", scope: ![[UNION]],
+// CHECK: type: ![[UNION]]
diff --git a/clang/test/CodeGenCXX/debug-info-lb.cpp b/clang/test/CodeGenCXX/debug-info-lb.cpp
new file mode 100644
index 00000000000..beb160c8c76
--- /dev/null
+++ b/clang/test/CodeGenCXX/debug-info-lb.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
+
+void foo() {
+ static int bar = 1;
+ {
+ struct X {};
+ typedef char Y;
+ static int bar = 0;
+ // The following basic block is intended, in order to check the case where
+ // types "X", "Y" are defined in a different scope than where they are used.
+ // They should have the scope they are defined at as their parent scope.
+ {
+ X a;
+ Y b;
+ }
+ }
+}
+
+// CHECK: !{{[0-9]+}} = !DICompositeType(tag: DW_TAG_structure_type, name: "X", scope: [[LBScope:![0-9]+]],
+// CHECK: [[LBScope]] = distinct !DILexicalBlock(scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: 5)
+
+// CHECK: [[FuncScope:![0-9]+]] = distinct !DISubprogram(name: "foo",
+
+// CHECK: !{{[0-9]+}} = !DIDerivedType(tag: DW_TAG_typedef, name: "Y", scope: [[LBScope]],
+// CHECK: !{{[0-9]+}} = !DIGlobalVariable(name: "bar", scope: [[FuncScope]], file: !{{[0-9]+}}, line: 4
+// CHECK: !{{[0-9]+}} = !DIGlobalVariable(name: "bar", scope: [[LBScope]], file: !{{[0-9]+}}, line: 8
+
OpenPOWER on IntegriCloud