From: Anders Carlsson Date: Mon, 29 Mar 2010 02:08:26 +0000 (+0000) Subject: Cleanup, no functionality change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=64c9eca97e06d80960d8782769661904e261ac29;p=clang Cleanup, no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99798 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index f6d19b4979..dfad33cc09 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -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); } diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 592f782edc..3322510815 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -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]) { diff --git a/lib/CodeGen/CGVtable.h b/lib/CodeGen/CGVtable.h index e07017bef6..6dd37a4902 100644 --- a/lib/CodeGen/CGVtable.h +++ b/lib/CodeGen/CGVtable.h @@ -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);