]> granicus.if.org Git - clang/commitdiff
Two bug fixes, we weren't updating the thunk index when creating the vtable initializ...
authorAnders Carlsson <andersca@mac.com>
Mon, 29 Mar 2010 01:04:16 +0000 (01:04 +0000)
committerAnders Carlsson <andersca@mac.com>
Mon, 29 Mar 2010 01:04:16 +0000 (01:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99786 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVTT.cpp
lib/CodeGen/CGVtable.cpp

index f2b2945290ad06e06d2dd731467ca24d64cf69cf..6b21046b4c735705c14a706d5456f4cc58f52a9d 100644 (file)
@@ -165,6 +165,13 @@ VTTBuilder::GetAddrOfVTable(BaseSubobject Base, bool BaseIsVirtual,
 void VTTBuilder::AddVTablePointer(BaseSubobject Base, llvm::Constant *VTable,
                                   const CXXRecordDecl *VTableClass,
                                   const AddressPointsMapTy& AddressPoints) {
+  // Store the vtable pointer index if we're generating the primary VTT.
+  if (Base.getBase() == MostDerivedClass) {
+    assert(!SecondaryVirtualPointerIndices.count(Base) &&
+           "A virtual pointer index already exists for this base subobject!");
+    SecondaryVirtualPointerIndices[Base] = VTTComponents.size();
+  }
+
   if (!GenerateDefinition) {
     VTTComponents.push_back(0);
     return;
index 4bdda985aa7423907a778d5c11ec6077c3eebcf9..804c68436186d2f3f4c3641046135794b3c595ca 100644 (file)
@@ -4080,6 +4080,8 @@ CodeGenVTables::CreateVTableInitializer(const CXXRecordDecl *RD,
         const ThunkInfo &Thunk = VTableThunks[NextVTableThunkIndex].second;
         
         Init = CGM.GetAddrOfThunk(GD, Thunk);
+        
+        NextVTableThunkIndex++;
       } else {
         const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
         const llvm::Type *Ty = CGM.getTypes().GetFunctionTypeForVtable(MD);