]> granicus.if.org Git - clang/commitdiff
Fix virtual bases' debug info.
authorDevang Patel <dpatel@apple.com>
Tue, 9 Feb 2010 19:09:28 +0000 (19:09 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 9 Feb 2010 19:09:28 +0000 (19:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95678 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index 8b3e195fa523a036e0d7906176ae3c0bc3d2253b..6f84add037285db72be3f2a2a999ce9f3c3a5ee6 100644 (file)
@@ -641,7 +641,7 @@ CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DICompileUnit Unit,
         E = RD->method_end(); I != E; ++I) {
     const CXXMethodDecl *Method = *I;
     
-    if (Method->isImplicit())
+    if (Method->isImplicit() && !Method->isUsed())
       continue;
 
     EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy));
@@ -666,7 +666,9 @@ CollectCXXBases(const CXXRecordDecl *RD, llvm::DICompileUnit Unit,
       cast<CXXRecordDecl>(BI->getType()->getAs<RecordType>()->getDecl());
     
     if (BI->isVirtual()) {
-      BaseOffset = RL.getVBaseClassOffset(Base);
+      // virtual base offset index is -ve. The code generator emits dwarf
+      // expression where it expects +ve number.
+      BaseOffset = 0 - CGM.getVtableInfo().getVirtualBaseOffsetIndex(RD, Base);
       BFlags = llvm::DIType::FlagVirtual;
     } else
       BaseOffset = RL.getBaseClassOffset(Base);