diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-17 06:30:02 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-17 06:30:02 +0000 |
commit | c84a8bf7fec968a2daa2431ccbd55633d6a8b1a9 (patch) | |
tree | 00466232b4693588de7f1bb70df8489a460795e3 /lib/CodeGen/CGVtable.cpp | |
parent | daa401cea267404c66a3123284da79f9026c55f5 (diff) |
Handle primary bases in AddVCallOffsets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 2b8b064f26..58989ede0b 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -985,10 +985,17 @@ VtableBuilder::AddVCallAndVBaseOffsets(BaseSubobject Base, void VtableBuilder::AddVCallOffsets(BaseSubobject Base) { const CXXRecordDecl *RD = Base.getBase(); - const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD); + + // Handle the primary base first. const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase(); - assert(!PrimaryBase && "FIXME: Handle the primary base!"); + if (PrimaryBase && Layout.getPrimaryBaseWasVirtual()) { + // Get the base offset of the primary base. + uint64_t PrimaryBaseOffset = Base.getBaseOffset() + + Layout.getBaseClassOffset(PrimaryBase); + + AddVCallOffsets(BaseSubobject(PrimaryBase, PrimaryBaseOffset)); + } // Add the vcall offsets. for (CXXRecordDecl::method_iterator I = RD->method_begin(), |