Cleanup, no functionality change.

llvm-svn: 99798
This commit is contained in:
Anders Carlsson 2010-03-29 02:08:26 +00:00
parent f91869b619
commit f6f24c609b
3 changed files with 18 additions and 6 deletions

View File

@ -1584,12 +1584,7 @@ CodeGenFunction::InitializeVTablePointer(BaseSubobject Base,
// And load the address point from the VTT.
VTableAddressPoint = Builder.CreateLoad(VTT);
} else {
const CodeGenVTables::AddrSubMap_t& AddressPoints =
CGM.getVTables().getAddressPoints(VTableClass);
uint64_t AddressPoint =
AddressPoints.lookup(std::make_pair(Base.getBase(),
Base.getBaseOffset()));
uint64_t AddressPoint = CGM.getVTables().getAddressPoint(Base, VTableClass);
VTableAddressPoint =
Builder.CreateConstInBoundsGEP2_64(VTable, 0, AddressPoint);
}

View File

@ -3609,6 +3609,19 @@ int64_t CodeGenVTables::getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
return I->second;
}
uint64_t
CodeGenVTables::getAddressPoint(BaseSubobject Base, const CXXRecordDecl *RD) {
const CodeGenVTables::AddrSubMap_t& AddressPoints = getAddressPoints(RD);
uint64_t AddressPoint =
AddressPoints.lookup(std::make_pair(Base.getBase(),
Base.getBaseOffset()));
assert(AddressPoint && "Address point must not be zero!");
return AddressPoint;
}
const CodeGenVTables::AddrSubMap_t &
CodeGenVTables::getAddressPoints(const CXXRecordDecl *RD) {
if (!OldAddressPoints[RD]) {

View File

@ -373,6 +373,10 @@ public:
int64_t getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
const CXXRecordDecl *VBase);
/// getAddressPoint - Get the address point of the given subobject in the
/// class decl.
uint64_t getAddressPoint(BaseSubobject Base, const CXXRecordDecl *RD);
/// GetAddrOfVTable - Get the address of the vtable for the given record decl.
llvm::Constant *GetAddrOfVTable(const CXXRecordDecl *RD);