/// AddMethods - Add the methods of this base subobject and all its
/// primary bases to the vtable components vector.
void AddMethods(BaseSubobject Base, PrimaryBasesSetTy &PrimaryBases);
-
- /// LayoutVtable - Layout a vtable and all its secondary vtables.
- void LayoutVtable(BaseSubobject Base);
+
+ // LayoutVtable - Layout the vtable for the most derived class, including its
+ // secondary vtables and any vtables for virtual bases.
+ void LayoutVtable();
+
+ /// LayoutPrimaryAndAndSecondaryVtables - Layout the primary vtable for the
+ /// given base subobject, as well as all its secondary vtables.
+ void LayoutPrimaryAndAndSecondaryVtables(BaseSubobject Base);
/// LayoutSecondaryVtables - Layout the secondary vtables for the given base
/// subobject.
: VtableInfo(VtableInfo), MostDerivedClass(MostDerivedClass),
Context(MostDerivedClass->getASTContext()), Overriders(MostDerivedClass) {
- LayoutVtable(BaseSubobject(MostDerivedClass, 0));
+ LayoutVtable();
}
/// dumpLayout - Dump the vtable layout.
}
}
-void VtableBuilder::LayoutVtable(BaseSubobject Base) {
+void VtableBuilder::LayoutVtable() {
+ LayoutPrimaryAndAndSecondaryVtables(BaseSubobject(MostDerivedClass, 0));
+
+ // FIXME: Emit vtables for virtual bases here.
+}
+
+void VtableBuilder::LayoutPrimaryAndAndSecondaryVtables(BaseSubobject Base) {
const CXXRecordDecl *RD = Base.getBase();
assert(RD->isDynamicClass() && "class does not have a vtable!");
// Layout secondary vtables.
LayoutSecondaryVtables(Base);
-
- // FIXME: Emit vtables for virtual bases here.
}
void VtableBuilder::LayoutSecondaryVtables(BaseSubobject Base) {
continue;
}
- // Layout this secondary vtable.
- LayoutVtable(BaseSubobject(BaseDecl, BaseOffset));
+ // Layout the primary vtable (and any secondary vtables) for this base.
+ LayoutPrimaryAndAndSecondaryVtables(BaseSubobject(BaseDecl, BaseOffset));
}
}