]> granicus.if.org Git - clang/commitdiff
Cleanup, no functionality change.
authorAnders Carlsson <andersca@mac.com>
Mon, 29 Mar 2010 02:08:26 +0000 (02:08 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 29 Mar 2010 02:08:26 +0000 (02:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99798 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGClass.cpp
lib/CodeGen/CGVtable.cpp
lib/CodeGen/CGVtable.h

index f6d19b4979d19afd65cce4f95dbd138035e322af..dfad33cc09f119fa31bc4b355bce751d97124cc4 100644 (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);
   }
index 592f782edc9266c86287686793546bda6511a51b..33225108152049ad6b9fe528b92a8f045c006872 100644 (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]) {
index e07017bef6b02ddf112b5d74ae9cf6d971d75643..6dd37a49025d39ee759b4a77fad4ce2b05b194d2 100644 (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);