diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-16 16:26:28 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-16 16:26:28 +0000 |
commit | 89ad4219e4ed8f025ef2049e7b1ca6af4624d989 (patch) | |
tree | 7871e5c106901a23fe37bae7f9fd6f30136fc5f2 /lib/CodeGen/CGVtable.cpp | |
parent | e8c28dffce846b1783fd11cc130b4be4f9894301 (diff) |
Move some code around in preparation for virtual base vtables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 6199c055b7..b9d6332b68 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -818,9 +818,14 @@ private: /// 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 @@ public: : VtableInfo(VtableInfo), MostDerivedClass(MostDerivedClass), Context(MostDerivedClass->getASTContext()), Overriders(MostDerivedClass) { - LayoutVtable(BaseSubobject(MostDerivedClass, 0)); + LayoutVtable(); } /// dumpLayout - Dump the vtable layout. @@ -1031,7 +1036,13 @@ VtableBuilder::AddMethods(BaseSubobject Base, PrimaryBasesSetTy &PrimaryBases) { } } -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 @@ void VtableBuilder::LayoutVtable(BaseSubobject Base) { // Layout secondary vtables. LayoutSecondaryVtables(Base); - - // FIXME: Emit vtables for virtual bases here. } void VtableBuilder::LayoutSecondaryVtables(BaseSubobject Base) { @@ -1114,8 +1123,8 @@ 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)); } } |