[cfe-commits] r140507 - in /cfe/trunk/lib/CodeGen: CGVTables.cpp CGVTables.h
Peter Collingbourne
peter at pcc.me.uk
Sun Sep 25 18:56:55 PDT 2011
Author: pcc
Date: Sun Sep 25 20:56:55 2011
New Revision: 140507
URL: http://llvm.org/viewvc/llvm-project?rev=140507&view=rev
Log:
Implement VTableContext::createConstructionVTableLayout
Modified:
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CGVTables.h
Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=140507&r1=140506&r2=140507&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Sun Sep 25 20:56:55 2011
@@ -2821,6 +2821,18 @@
/*UseAvailableExternallyLinkage=*/false);
}
+static VTableLayout *CreateVTableLayout(const VTableBuilder &Builder) {
+ llvm::SmallVector<VTableLayout::VTableThunkTy, 1>
+ VTableThunks(Builder.vtable_thunks_begin(), Builder.vtable_thunks_end());
+ std::sort(VTableThunks.begin(), VTableThunks.end());
+
+ return new VTableLayout(Builder.getNumVTableComponents(),
+ Builder.vtable_component_begin(),
+ VTableThunks.size(),
+ VTableThunks.data(),
+ Builder.getAddressPoints());
+}
+
void VTableContext::ComputeVTableRelatedInformation(const CXXRecordDecl *RD) {
const VTableLayout *&Entry = VTableLayouts[RD];
@@ -2830,16 +2842,7 @@
VTableBuilder Builder(*this, RD, CharUnits::Zero(),
/*MostDerivedClassIsVirtual=*/0, RD);
-
- llvm::SmallVector<VTableLayout::VTableThunkTy, 1>
- VTableThunks(Builder.vtable_thunks_begin(), Builder.vtable_thunks_end());
- std::sort(VTableThunks.begin(), VTableThunks.end());
-
- Entry = new VTableLayout(Builder.getNumVTableComponents(),
- Builder.vtable_component_begin(),
- VTableThunks.size(),
- VTableThunks.data(),
- Builder.getAddressPoints());
+ Entry = CreateVTableLayout(Builder);
// Add the known thunks.
Thunks.insert(Builder.thunks_begin(), Builder.thunks_end());
@@ -2867,6 +2870,16 @@
}
}
+VTableLayout *VTableContext::createConstructionVTableLayout(
+ const CXXRecordDecl *MostDerivedClass,
+ CharUnits MostDerivedClassOffset,
+ bool MostDerivedClassIsVirtual,
+ const CXXRecordDecl *LayoutClass) {
+ VTableBuilder Builder(*this, MostDerivedClass, MostDerivedClassOffset,
+ MostDerivedClassIsVirtual, LayoutClass);
+ return CreateVTableLayout(Builder);
+}
+
llvm::Constant *
CodeGenVTables::CreateVTableInitializer(const CXXRecordDecl *RD,
const VTableComponent *Components,
Modified: cfe/trunk/lib/CodeGen/CGVTables.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.h?rev=140507&r1=140506&r2=140507&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.h (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.h Sun Sep 25 20:56:55 2011
@@ -314,6 +314,12 @@
return *VTableLayouts[RD];
}
+ VTableLayout *
+ createConstructionVTableLayout(const CXXRecordDecl *MostDerivedClass,
+ CharUnits MostDerivedClassOffset,
+ bool MostDerivedClassIsVirtual,
+ const CXXRecordDecl *LayoutClass);
+
const ThunkInfoVectorTy *getThunkInfo(const CXXMethodDecl *MD) {
ComputeVTableRelatedInformation(MD->getParent());
More information about the cfe-commits
mailing list