[PATCH] Output debug information for structure members only referenced by a pointer or typedef
Keith Walker
keith.walker at arm.com
Wed Jun 19 05:34:52 PDT 2013
This patch addresses an issue introduced by r183296 that means that the
members of a structure are no longer output in the DWARF debugging
information if the structure is only referenced by a pointer or typedef
(reported in PR16214).
Files:
test/CodeGenCXX/debug-info-namespace.cpp
test/CodeGenCXX/debug-info.cpp
lib/CodeGen/CGDebugInfo.cpp
Index: test/CodeGenCXX/debug-info-namespace.cpp
===================================================================
--- test/CodeGenCXX/debug-info-namespace.cpp (revision 184291)
+++ test/CodeGenCXX/debug-info-namespace.cpp (working copy)
@@ -57,7 +57,7 @@
// 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: [[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, {{.*}}]
[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 ]
Index: test/CodeGenCXX/debug-info.cpp
===================================================================
--- test/CodeGenCXX/debug-info.cpp (revision 184291)
+++ test/CodeGenCXX/debug-info.cpp (working copy)
@@ -102,18 +102,26 @@
typedef a at;
struct b {
+ int j;
};
+struct c;
+
typedef b bt;
+typedef c ct;
void func() {
at a_inst;
bt *b_ptr_inst;
const bt *b_cnst_ptr_inst;
+ ct *c_ptr_inst;
}
// 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: metadata [[B_MEM:![0-9]*]], i32 0, null, null} ; [
DW_TAG_structure_type ] [b]
+// CHECK: [[B_MEM]] = metadata !{metadata [[B_J:![0-9]*]]}
+// CHECK: [[B_J]] = {{.*}} ; [ DW_TAG_member ] [j] {{.*}} [from int]
+// CHECK: ; [ DW_TAG_structure_type ] [c] {{.*}}[fwd]
}
Index: lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- lib/CodeGen/CGDebugInfo.cpp (revision 184291)
+++ lib/CodeGen/CGDebugInfo.cpp (working copy)
@@ -615,7 +615,8 @@
llvm::DIFile Unit) {
if (DebugKind > CodeGenOptions::LimitedDebugInfo)
return getOrCreateType(PointeeTy, Unit);
- return getOrCreateType(PointeeTy, Unit, true);
+ bool Declaration = isa<RecordType>(PointeeTy);
+ return getOrCreateType(PointeeTy, Unit, Declaration);
}
llvm::DIType CGDebugInfo::CreatePointerLikeType(unsigned Tag,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.dbgptr.diff
Type: application/octet-stream
Size: 2812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130619/e1ccec12/attachment.obj>
More information about the cfe-commits
mailing list