[cfe-commits] r99798 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CGVtable.cpp CGVtable.h
Anders Carlsson
andersca at mac.com
Sun Mar 28 19:08:26 PDT 2010
Author: andersca
Date: Sun Mar 28 21:08:26 2010
New Revision: 99798
URL: http://llvm.org/viewvc/llvm-project?rev=99798&view=rev
Log:
Cleanup, no functionality change.
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGVtable.cpp
cfe/trunk/lib/CodeGen/CGVtable.h
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=99798&r1=99797&r2=99798&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sun Mar 28 21:08:26 2010
@@ -1584,12 +1584,7 @@
// 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);
}
Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=99798&r1=99797&r2=99798&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Sun Mar 28 21:08:26 2010
@@ -3609,6 +3609,19 @@
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]) {
Modified: cfe/trunk/lib/CodeGen/CGVtable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.h?rev=99798&r1=99797&r2=99798&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.h (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.h Sun Mar 28 21:08:26 2010
@@ -373,6 +373,10 @@
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);
More information about the cfe-commits
mailing list