r184524 - DebugInfo: handle the DI asm printing change to reword '[fwd]' as '[decl]' and add '[def]' for non-decl tag types

David Blaikie dblaikie at gmail.com
Thu Jun 20 20:41:46 PDT 2013


Author: dblaikie
Date: Thu Jun 20 22:41:46 2013
New Revision: 184524

URL: http://llvm.org/viewvc/llvm-project?rev=184524&view=rev
Log:
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.

Added:
    cfe/trunk/test/CodeGenCXX/debug-info-class-nolimit.cpp
Removed:
    cfe/trunk/test/CodeGen/debug-info-record.c
    cfe/trunk/test/CodeGen/debug-info-record2.c
Modified:
    cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-template-quals.cpp
    cfe/trunk/test/CodeGenCXX/debug-info.cpp
    cfe/trunk/test/CodeGenObjC/debug-info-fwddecl.m

Removed: cfe/trunk/test/CodeGen/debug-info-record.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-record.c?rev=184523&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-record.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-record.c (removed)
@@ -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;
-}

Removed: cfe/trunk/test/CodeGen/debug-info-record2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-record2.c?rev=184523&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-record2.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-record2.c (removed)
@@ -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;
-}

Added: cfe/trunk/test/CodeGenCXX/debug-info-class-nolimit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-nolimit.cpp?rev=184524&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-class-nolimit.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-class-nolimit.cpp Thu Jun 20 22:41:46 2013
@@ -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 {
+};
+}
+

Modified: cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp?rev=184524&r1=184523&r2=184524&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-enum-class.cpp Thu Jun 20 22:41:46 2013
@@ -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.

Modified: cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp?rev=184524&r1=184523&r2=184524&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-namespace.cpp Thu Jun 20 22:41:46 2013
@@ -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

Modified: cfe/trunk/test/CodeGenCXX/debug-info-template-quals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template-quals.cpp?rev=184524&r1=184523&r2=184524&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-template-quals.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-template-quals.cpp Thu Jun 20 22:41:46 2013
@@ -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>]

Modified: cfe/trunk/test/CodeGenCXX/debug-info.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info.cpp?rev=184524&r1=184523&r2=184524&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info.cpp Thu Jun 20 22:41:46 2013
@@ -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]
 }

Modified: cfe/trunk/test/CodeGenObjC/debug-info-fwddecl.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-fwddecl.m?rev=184524&r1=184523&r2=184524&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-fwddecl.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-fwddecl.m Thu Jun 20 22:41:46 2013
@@ -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]





More information about the cfe-commits mailing list