Use root non-virtual primary base class, not just immediate primary base class, for AT_containing_type.

This is tested by virtfunc.exp in gdb testsuite.

llvm-svn: 116535
This commit is contained in:
Devang Patel 2010-10-14 22:59:23 +00:00
parent 8b6a9c1574
commit 0f58561907
1 changed files with 11 additions and 1 deletions

View File

@ -1018,9 +1018,19 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
// A class's primary base or the class itself contains the vtable.
const ASTRecordLayout &RL = CGM.getContext().getASTRecordLayout(RD);
if (const CXXRecordDecl *PBase = RL.getPrimaryBase())
if (const CXXRecordDecl *PBase = RL.getPrimaryBase()) {
// Seek non virtual primary base root.
while (1) {
const ASTRecordLayout &BRL = CGM.getContext().getASTRecordLayout(PBase);
const CXXRecordDecl *PBT = BRL.getPrimaryBase();
if (PBT && !BRL.getPrimaryBaseWasVirtual())
PBase = PBT;
else
break;
}
ContainingType =
getOrCreateType(QualType(PBase->getTypeForDecl(), 0), Unit);
}
else if (CXXDecl->isDynamicClass())
ContainingType = FwdDecl;
}