From 776bfa16c96d501c7fd51beb14f929fa4736caac Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 18 Jun 2013 23:32:21 +0000 Subject: [PATCH] Add some comments to r184252. rdar://problem/14101097 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184259 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 5 +++++ test/CodeGen/debug-info-record.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index a5e9e4e092..563faa4f78 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1379,7 +1379,12 @@ llvm::DIType CGDebugInfo::getOrCreateInterfaceType(QualType D, /// CreateType - get structure or union type. llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, bool Declaration) { RecordDecl *RD = Ty->getDecl(); + // Limited debug info should only remove struct definitions that can + // safely be replaced by a forward declaration in the source code. if (DebugKind <= CodeGenOptions::LimitedDebugInfo && Declaration) { + // FIXME: This implementation is problematic; there are some test + // cases where we violate the above principle, such as + // test/CodeGen/debug-info-records.c . llvm::DIDescriptor FDContext = getContextDescriptor(cast(RD->getDeclContext())); llvm::DIType RetTy = createRecordFwdDecl(RD, FDContext); diff --git a/test/CodeGen/debug-info-record.c b/test/CodeGen/debug-info-record.c index 01e3c10988..55927ca667 100644 --- a/test/CodeGen/debug-info-record.c +++ b/test/CodeGen/debug-info-record.c @@ -3,7 +3,9 @@ // 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 { @@ -16,4 +18,3 @@ int baz(void* x) { elusive_t s = x; return s->foo; } - -- 2.40.0