[cfe-commits] r99786 - in /cfe/trunk/lib/CodeGen: CGVTT.cpp CGVtable.cpp

Anders Carlsson andersca at mac.com
Sun Mar 28 18:04:16 PDT 2010


Author: andersca
Date: Sun Mar 28 20:04:16 2010
New Revision: 99786

URL: http://llvm.org/viewvc/llvm-project?rev=99786&view=rev
Log:
Two bug fixes, we weren't updating the thunk index when creating the vtable initializer and we weren't storing the secondary virtual pointer indices.

Modified:
    cfe/trunk/lib/CodeGen/CGVTT.cpp
    cfe/trunk/lib/CodeGen/CGVtable.cpp

Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=99786&r1=99785&r2=99786&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Sun Mar 28 20:04:16 2010
@@ -165,6 +165,13 @@
 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;

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=99786&r1=99785&r2=99786&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Sun Mar 28 20:04:16 2010
@@ -4080,6 +4080,8 @@
         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);





More information about the cfe-commits mailing list