From 09a5604a1078d29123b76702256c7cb38151466b Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 21 Jun 2013 03:41:46 +0000 Subject: [PATCH] DebugInfo: handle the DI asm printing change to reword '[fwd]' as '[decl]' and add '[def]' for non-decl tag types 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 | 20 ------------- test/CodeGen/debug-info-record2.c | 21 ------------- test/CodeGenCXX/debug-info-class-nolimit.cpp | 30 +++++++++++++++++++ test/CodeGenCXX/debug-info-enum-class.cpp | 8 ++--- test/CodeGenCXX/debug-info-namespace.cpp | 6 ++-- test/CodeGenCXX/debug-info-template-quals.cpp | 2 +- test/CodeGenCXX/debug-info.cpp | 4 +-- test/CodeGenObjC/debug-info-fwddecl.m | 2 +- 8 files changed, 41 insertions(+), 52 deletions(-) delete mode 100644 test/CodeGen/debug-info-record.c delete mode 100644 test/CodeGen/debug-info-record2.c create mode 100644 test/CodeGenCXX/debug-info-class-nolimit.cpp diff --git a/test/CodeGen/debug-info-record.c b/test/CodeGen/debug-info-record.c deleted file mode 100644 index 546a8b9806..0000000000 --- a/test/CodeGen/debug-info-record.c +++ /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 index 3f28296318..0000000000 --- a/test/CodeGen/debug-info-record2.c +++ /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 index 0000000000..ce72bd347c --- /dev/null +++ b/test/CodeGenCXX/debug-info-class-nolimit.cpp @@ -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 { +}; +} + diff --git a/test/CodeGenCXX/debug-info-enum-class.cpp b/test/CodeGenCXX/debug-info-enum-class.cpp index 929327b798..0f4b09afb5 100644 --- a/test/CodeGenCXX/debug-info-enum-class.cpp +++ b/test/CodeGenCXX/debug-info-enum-class.cpp @@ -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. diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp index 623005b068..c920568a2e 100644 --- a/test/CodeGenCXX/debug-info-namespace.cpp +++ b/test/CodeGenCXX/debug-info-namespace.cpp @@ -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 diff --git a/test/CodeGenCXX/debug-info-template-quals.cpp b/test/CodeGenCXX/debug-info-template-quals.cpp index 335c8abb11..42024a16e9 100644 --- a/test/CodeGenCXX/debug-info-template-quals.cpp +++ b/test/CodeGenCXX/debug-info-template-quals.cpp @@ -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] [line 4, size 8, align 8, offset 0] [from ] +// CHECK: [[BS:.*]] = {{.*}} ; [ DW_TAG_structure_type ] [basic_string] [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] diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp index 88d64d9f20..dbdabaaa1e 100644 --- a/test/CodeGenCXX/debug-info.cpp +++ b/test/CodeGenCXX/debug-info.cpp @@ -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] } diff --git a/test/CodeGenObjC/debug-info-fwddecl.m b/test/CodeGenObjC/debug-info-fwddecl.m index b41c485e19..b43d7c0eb8 100644 --- a/test/CodeGenObjC/debug-info-fwddecl.m +++ b/test/CodeGenObjC/debug-info-fwddecl.m @@ -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] -- 2.40.0