]> granicus.if.org Git - clang/commitdiff
DebugInfo: handle the DI asm printing change to reword '[fwd]' as '[decl]' and add...
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 21 Jun 2013 03:41:46 +0000 (03:41 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 21 Jun 2013 03:41:46 +0000 (03:41 +0000)
This is to make test cases looking for definitions more legible by
making the definition explicit rather than just the absence of '[fwd]'.
This allowed the debug-info-record tests to be rephrased - and in the
interests of reducing the number of individual test cases/invocations we
have, I merged them into one file, separated them with namespaces (&
then moved them to C++ because namespaces are great). If they need to
remain 'C' only tests, they can be moved back. (I didn't group them with
'debug-info-class.cpp' because these tests only apply to
-fno-limit-debug-info)

I removed the pieces of code that would cause these tests to pass under
-flimit-debug-info to ensure the tests remain relevant to their fixes
should we ever improve -flimit-debug-info to catch that kind of code.

This commit is version locked with the corresponding change to
DebugInfo.h in LLVM. Except some transient buildbot fallout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184524 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/debug-info-record.c [deleted file]
test/CodeGen/debug-info-record2.c [deleted file]
test/CodeGenCXX/debug-info-class-nolimit.cpp [new file with mode: 0644]
test/CodeGenCXX/debug-info-enum-class.cpp
test/CodeGenCXX/debug-info-namespace.cpp
test/CodeGenCXX/debug-info-template-quals.cpp
test/CodeGenCXX/debug-info.cpp
test/CodeGenObjC/debug-info-fwddecl.m

diff --git a/test/CodeGen/debug-info-record.c b/test/CodeGen/debug-info-record.c
deleted file mode 100644 (file)
index 546a8b9..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-unk-unk -fno-limit-debug-info -o - -emit-llvm -g %s | FileCheck %s
-// Check that we emit debug info for a struct even if it is typedef'd.
-// rdar://problem/14101097
-//
-// FIXME: This should work with -flimit-debug-info, too.
-
-// Make sure this is not a forward declaration.
-// CHECK-NOT: [ DW_TAG_structure_type ] [elusive_s] {{.*}} [fwd]
-// CHECK: [ DW_TAG_member ] [foo]
-// CHECK: [ DW_TAG_member ] [bar]
-struct elusive_s {
-  int foo;
-  float bar;
-};
-typedef struct elusive_s* elusive_t;
-
-int baz(void* x) {
-  elusive_t s = x;
-  return s->foo;
-}
diff --git a/test/CodeGen/debug-info-record2.c b/test/CodeGen/debug-info-record2.c
deleted file mode 100644 (file)
index 3f28296..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-unk-unk -fno-limit-debug-info -o - -emit-llvm -g %s | FileCheck %s
-// Check that we emit debug info for a struct even if it is typedef'd before using.
-// rdar://problem/14101097
-//
-// FIXME: This should work with -flimit-debug-info, too.
-
-// Make sure this is not a forward declaration.
-// CHECK-NOT: [ DW_TAG_structure_type ] [elusive_s] {{.*}} [fwd]
-// CHECK: [ DW_TAG_member ] [foo]
-// CHECK: [ DW_TAG_member ] [bar]
-typedef struct elusive_s* elusive_t;
-elusive_t first_use = (void*)0;
-struct elusive_s {
-  int foo;
-  float bar;
-};
-
-int baz(void* x) {
-  elusive_t s = x;
-  return s->foo;
-}
diff --git a/test/CodeGenCXX/debug-info-class-nolimit.cpp b/test/CodeGenCXX/debug-info-class-nolimit.cpp
new file mode 100644 (file)
index 0000000..ce72bd3
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -triple x86_64-unk-unk -fno-limit-debug-info -o - -emit-llvm -g %s | FileCheck %s
+
+namespace rdar14101097_1 { // see also PR16214
+// Check that we emit debug info for the definition of a struct if the
+// definition is available, even if it's used via a pointer wrapped in a
+// typedef.
+// CHECK: [ DW_TAG_structure_type ] [foo] {{.*}}[def]
+struct foo {
+};
+
+typedef foo *foop;
+
+void bar() {
+  foop f;
+}
+}
+
+namespace rdar14101097_2 {
+// As above, except trickier because we first encounter only a declaration of
+// the type and no debug-info related use after we see the definition of the
+// type.
+// CHECK: [ DW_TAG_structure_type ] [foo] {{.*}}[def]
+struct foo;
+void bar() {
+  foo *f;
+}
+struct foo {
+};
+}
+
index 929327b798296417f71c2bd772c565fb95370134..0f4b09afb5ddfa62aeb7338d1e2f4e6f088907c4 100644 (file)
@@ -9,10 +9,10 @@ B b;
 C c;
 D d;
 
-// CHECK: ; [ DW_TAG_enumeration_type ] [A] [line 3, size 32, align 32, offset 0] [from int]
-// CHECK: ; [ DW_TAG_enumeration_type ] [B] [line 4, size 64, align 64, offset 0] [from long unsigned int]
-// CHECK: ; [ DW_TAG_enumeration_type ] [C] [line 5, size 32, align 32, offset 0] [from ]
-// CHECK: ; [ DW_TAG_enumeration_type ] [D] [line 6, size 16, align 16, offset 0] [fwd] [from ]
+// CHECK: ; [ DW_TAG_enumeration_type ] [A] [line 3, size 32, align 32, offset 0] [def] [from int]
+// CHECK: ; [ DW_TAG_enumeration_type ] [B] [line 4, size 64, align 64, offset 0] [def] [from long unsigned int]
+// CHECK: ; [ DW_TAG_enumeration_type ] [C] [line 5, size 32, align 32, offset 0] [def] [from ]
+// CHECK: ; [ DW_TAG_enumeration_type ] [D] [line 6, size 16, align 16, offset 0] [decl] [from ]
 
 namespace PR14029 {
   // Make sure this doesn't crash/assert.
index 623005b06867a884382b6516323b2fc056fe8d3f..c920568a2e5b6a248b08ac1e39437d53b4ef34b9 100644 (file)
@@ -55,9 +55,9 @@ int func(bool b) {
 // CHECK: [[LEX1]] = metadata !{i32 {{[0-9]*}}, metadata [[FILE2]], metadata [[FUNC]], i32 16, i32 0, i32 {{.*}}} ; [ DW_TAG_lexical_block ]
 // CHECK: [[M5]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[CTXT]], i32 20} ; [ DW_TAG_imported_module ]
 // CHECK: [[M6]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[FOO:![0-9]*]], i32 21} ; [ DW_TAG_imported_declaration ]
-// CHECK: [[FOO]] {{.*}} ; [ DW_TAG_structure_type ] [foo] [line 5, size 0, align 0, offset 0] [fwd] [from ]
+// CHECK: [[FOO]] {{.*}} ; [ DW_TAG_structure_type ] [foo] [line 5, size 0, align 0, offset 0] [decl] [from ]
 // CHECK: [[M7]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[BAR:![0-9]*]], i32 22} ; [ DW_TAG_imported_declaration ]
-// CHECK: [[BAR]] {{.*}} ; [ DW_TAG_structure_type ] [bar] [line 6, {{.*}}] [fwd] [from ]
+// CHECK: [[BAR]] {{.*}} ; [ DW_TAG_structure_type ] [bar] [line 6, {{.*}}] [decl] [from ]
 // CHECK: [[M8]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[F1]], i32 23} ; [ DW_TAG_imported_declaration ]
 // CHECK: [[M9]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[I]], i32 24} ; [ DW_TAG_imported_declaration ]
 // CHECK: [[M10]] = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], metadata [[BAZ:![0-9]*]], i32 25} ; [ DW_TAG_imported_declaration ]
@@ -68,7 +68,7 @@ int func(bool b) {
 // CHECK-GMLT: [[CU:![0-9]*]] = {{.*}}[[MODULES:![0-9]*]], metadata !""} ; [ DW_TAG_compile_unit ]
 // CHECK-GMLT: [[MODULES]] = metadata !{i32 0}
 
-// CHECK-NOLIMIT: ; [ DW_TAG_structure_type ] [bar] [line 6, {{.*}}] [from ]
+// CHECK-NOLIMIT: ; [ DW_TAG_structure_type ] [bar] [line 6, {{.*}}] [def] [from ]
 
 // FIXME: It is confused on win32 to generate file entry when dosish filename is given.
 // REQUIRES: shell
index 335c8abb11e4338e53588cc09bff569550066337..42024a16e9f660c0bbdd0c63ee2f56230d8df3f4 100644 (file)
@@ -22,6 +22,6 @@ void foo (const char *c) {
 // CHECK: {{.*}} metadata [[TYPE:![0-9]*]], {{.*}}, metadata !{{[0-9]*}}, metadata !{{[0-9]*}}, i32 8} ; [ DW_TAG_subprogram ] [line 7] [def] [scope 8] [assign]
 // CHECK: [[TYPE]] = metadata !{i32 {{.*}}, metadata [[ARGS:.*]], i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
 // CHECK: [[ARGS]] = metadata !{metadata !{{.*}}, metadata !{{.*}}, metadata [[P]], metadata [[R:.*]]}
-// CHECK: [[BS:.*]] = {{.*}} ; [ DW_TAG_structure_type ] [basic_string<char>] [line 4, size 8, align 8, offset 0] [from ]
+// CHECK: [[BS:.*]] = {{.*}} ; [ DW_TAG_structure_type ] [basic_string<char>] [line 4, size 8, align 8, offset 0] [def] [from ]
 // CHECK: [[R]] = {{.*}}, metadata [[CON2:![0-9]*]]} ; [ DW_TAG_reference_type ] [line 0, size 0, align 0, offset 0] [from ]
 // CHECK: [[CON2]] = {{.*}}, metadata [[BS]]} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from basic_string<char>]
index 88d64d9f204a2fa53a8225daf8dec9d2d0f5decd..dbdabaaa1eafd23087aa7d5efa858ad387abc2fc 100644 (file)
@@ -88,7 +88,7 @@ incomplete (*x)[3];
 // CHECK: metadata [[INCARRAYPTR:![0-9]*]], i32 0, i32 1, [3 x i8]** @_ZN6pr96081xE, null} ; [ DW_TAG_variable ] [x]
 // CHECK: [[INCARRAYPTR]] = {{.*}}metadata [[INCARRAY:![0-9]*]]} ; [ DW_TAG_pointer_type ]
 // CHECK: [[INCARRAY]] = {{.*}}metadata [[INCTYPE:![0-9]*]], metadata {{![0-9]*}}, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 0, align 0, offset 0] [from incomplete]
-// CHECK: [[INCTYPE]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [fwd]
+// CHECK: [[INCTYPE]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [decl]
 }
 
 // For some reason the argument for PR14763 ended up all the way down here
@@ -115,5 +115,5 @@ void func() {
 // CHECK: metadata [[A_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_structure_type ] [a]
 // CHECK: [[A_MEM]] = metadata !{metadata [[A_I:![0-9]*]], metadata !{{[0-9]*}}}
 // CHECK: [[A_I]] = {{.*}} ; [ DW_TAG_member ] [i] {{.*}} [from int]
-// CHECK: ; [ DW_TAG_structure_type ] [b] {{.*}}[fwd]
+// CHECK: ; [ DW_TAG_structure_type ] [b] {{.*}}[decl]
 }
index b41c485e192231d07ab9c70abce01dbd094c91ff..b43d7c0eb87c0aa221c820b88e5f7f58a3727ca1 100644 (file)
@@ -2,4 +2,4 @@
 @class ForwardObjcClass;
 ForwardObjcClass *ptr = 0;
 
-// CHECK: {{.*}} [ DW_TAG_structure_type ] [ForwardObjcClass] [line 2, size 0, align 0, offset 0] [fwd]
+// CHECK: {{.*}} [ DW_TAG_structure_type ] [ForwardObjcClass] [line 2, size 0, align 0, offset 0] [decl]