[cfe-commits] r96354 - /cfe/trunk/lib/CodeGen/CGVtable.cpp
Anders Carlsson
andersca at mac.com
Tue Feb 16 08:26:28 PST 2010
Author: andersca
Date: Tue Feb 16 10:26:28 2010
New Revision: 96354
URL: http://llvm.org/viewvc/llvm-project?rev=96354&view=rev
Log:
Move some code around in preparation for virtual base vtables.
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=96354&r1=96353&r2=96354&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Tue Feb 16 10:26:28 2010
@@ -818,9 +818,14 @@
/// 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.
@@ -831,7 +836,7 @@
: VtableInfo(VtableInfo), MostDerivedClass(MostDerivedClass),
Context(MostDerivedClass->getASTContext()), Overriders(MostDerivedClass) {
- LayoutVtable(BaseSubobject(MostDerivedClass, 0));
+ LayoutVtable();
}
/// dumpLayout - Dump the vtable layout.
@@ -1031,7 +1036,13 @@
}
}
-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!");
@@ -1076,8 +1087,6 @@
// Layout secondary vtables.
LayoutSecondaryVtables(Base);
-
- // FIXME: Emit vtables for virtual bases here.
}
void VtableBuilder::LayoutSecondaryVtables(BaseSubobject Base) {
@@ -1114,8 +1123,8 @@
continue;
}
- // Layout this secondary vtable.
- LayoutVtable(BaseSubobject(BaseDecl, BaseOffset));
+ // Layout the primary vtable (and any secondary vtables) for this base.
+ LayoutPrimaryAndAndSecondaryVtables(BaseSubobject(BaseDecl, BaseOffset));
}
}
More information about the cfe-commits
mailing list