Emit forward decls for structs with declarations only when we are
limiting debug info.
FIXME: There is still work left to do here, the testcase should work even with -flimit-debug-info.
rdar://problem/14101097
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184252 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 07cbdee..a5e9e4e 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1379,7 +1379,7 @@
/// CreateType - get structure or union type.
llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty, bool Declaration) {
RecordDecl *RD = Ty->getDecl();
- if (Declaration) {
+ if (DebugKind <= CodeGenOptions::LimitedDebugInfo && Declaration) {
llvm::DIDescriptor FDContext =
getContextDescriptor(cast<Decl>(RD->getDeclContext()));
llvm::DIType RetTy = createRecordFwdDecl(RD, FDContext);