]> granicus.if.org Git - clang/commitdiff
Emit debug info for an aggregate while processing MemberExpr if the aggregate's debug...
authorDevang Patel <dpatel@apple.com>
Mon, 4 Oct 2010 21:46:04 +0000 (21:46 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 4 Oct 2010 21:46:04 +0000 (21:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115564 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprScalar.cpp

index 73e94d1ece11ddcc723a86774631b01b284acc12..ed9692a0843ceb1f105e88ac1f5afbd4543cfb86 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
+#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<PointerType>(PQTy))
+      if (FieldDecl *M = cast<FieldDecl>(E->getMemberDecl()))
+        DI->getOrCreateRecordType(PTy->getPointeeType(), 
+                                  M->getParent()->getLocation());
   return EmitLoadOfLValue(E);
 }