r184594 - PR16214: Debug info for types first used via pointers or qualified types & later require definitions
David Blaikie
dblaikie at gmail.com
Fri Jun 21 14:03:12 PDT 2013
Author: dblaikie
Date: Fri Jun 21 16:03:11 2013
New Revision: 184594
URL: http://llvm.org/viewvc/llvm-project?rev=184594&view=rev
Log:
PR16214: Debug info for types first used via pointers or qualified types & later require definitions
Added:
cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=184594&r1=184593&r2=184594&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jun 21 16:03:11 2013
@@ -1951,8 +1951,15 @@ llvm::DIType CGDebugInfo::getOrCreateTyp
llvm::DIType T = getCompletedTypeOrNull(Ty);
- if (T.Verify())
+ if (T.Verify()) {
+ // If we're looking for a definition, make sure we have definitions of any
+ // underlying types.
+ if (const TypedefType* TTy = dyn_cast<TypedefType>(Ty))
+ getOrCreateType(TTy->getDecl()->getUnderlyingType(), Unit, Declaration);
+ if (Ty.hasLocalQualifiers())
+ getOrCreateType(QualType(Ty.getTypePtr(), 0), Unit, Declaration);
return T;
+ }
// Otherwise create the type.
llvm::DIType Res = CreateTypeNode(Ty, Unit, Declaration);
Added: cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp?rev=184594&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp Fri Jun 21 16:03:11 2013
@@ -0,0 +1,14 @@
+// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
+
+namespace PR16214_1 {
+// CHECK: [[PR16214_1:![0-9]*]] = {{.*}} [ DW_TAG_namespace ] [PR16214_1]
+// CHECK: = metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR16214_1]], {{.*}} ; [ DW_TAG_structure_type ] [foo] {{.*}} [def]
+struct foo {
+ int i;
+};
+
+typedef foo bar;
+
+bar *f;
+bar g;
+}
More information about the cfe-commits
mailing list