diff options
author | Devang Patel <dpatel@apple.com> | 2010-10-14 22:59:23 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-10-14 22:59:23 +0000 |
commit | 5bc794ff3034bad2b231b0841ea6d0a711c4af59 (patch) | |
tree | 96ddfd744b6d1234f33d8ea2b0f84546ce3547da /lib/CodeGen/CGDebugInfo.cpp | |
parent | 4d5625e15bb215c2241c022df8dc7b04438970c6 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 404c010c77..224710af35 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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; } |