[cfe-commits] r96461 - /cfe/trunk/lib/CodeGen/CGVtable.cpp
Anders Carlsson
andersca at mac.com
Tue Feb 16 22:30:02 PST 2010
Author: andersca
Date: Wed Feb 17 00:30:02 2010
New Revision: 96461
URL: http://llvm.org/viewvc/llvm-project?rev=96461&view=rev
Log:
Handle primary bases in AddVCallOffsets.
Modified:
cfe/trunk/lib/CodeGen/CGVtable.cpp
Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=96461&r1=96460&r2=96461&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Wed Feb 17 00:30:02 2010
@@ -985,10 +985,17 @@
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(),
More information about the cfe-commits
mailing list