From: Devang Patel Date: Mon, 4 Oct 2010 21:46:04 +0000 (+0000) Subject: Emit debug info for an aggregate while processing MemberExpr if the aggregate's debug... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78ba3d46388f17b4fc5e63ed23b746dd4dea9547;p=clang Emit debug info for an aggregate while processing MemberExpr if the aggregate's debug info was delayed untill now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115564 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 73e94d1ece..ed9692a084 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -11,10 +11,12 @@ // //===----------------------------------------------------------------------===// +#include "clang/Frontend/CodeGenOptions.h" #include "CodeGenFunction.h" #include "CGCXXABI.h" #include "CGObjCRuntime.h" #include "CodeGenModule.h" +#include "CGDebugInfo.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/RecordLayout.h" @@ -721,6 +723,16 @@ Value *ScalarExprEmitter::VisitMemberExpr(MemberExpr *E) { EmitLValue(E->getBase()); return llvm::ConstantInt::get(VMContext, Result.Val.getInt()); } + + // Emit debug info for aggregate now, if it was delayed to reduce + // debug info size. + CGDebugInfo *DI = CGF.getDebugInfo(); + if (DI && CGF.CGM.getCodeGenOpts().LimitDebugInfo) { + QualType PQTy = E->getBase()->IgnoreParenImpCasts()->getType(); + if (const PointerType * PTy = dyn_cast(PQTy)) + if (FieldDecl *M = cast(E->getMemberDecl())) + DI->getOrCreateRecordType(PTy->getPointeeType(), + M->getParent()->getLocation()); return EmitLoadOfLValue(E); }