[cfe-commits] r99177 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Anders Carlsson andersca at mac.com
Mon Mar 22 08:47:01 PDT 2010


Author: andersca
Date: Mon Mar 22 10:47:01 2010
New Revision: 99177

URL: http://llvm.org/viewvc/llvm-project?rev=99177&view=rev
Log:
We want to add all thunks, not just 'this' adjustment thunks.

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

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=99177&r1=99176&r2=99177&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Mon Mar 22 10:47:01 2010
@@ -1423,12 +1423,35 @@
       // Add an adjustment for the deleting destructor as well.
       Thunks[VtableIndex + 1].This = ThisAdjustment;
     }
-    
-    AddThunk(Overrider.Method, Thunks[VtableIndex]);
   }
 
   /// Clear the method info map.
   MethodInfoMap.clear();
+  
+  if (isBuildingConstructorVtable()) {
+    // We don't need to store thunk information for construction vtables.
+    return;
+  }
+
+  for (ThunksInfoMapTy::const_iterator I = Thunks.begin(), E = Thunks.end();
+       I != E; ++I) {
+    const VtableComponent &Component = Components[I->first];
+    const ThunkInfo &Thunk = I->second;
+    
+    switch (Component.getKind()) {
+    default:
+      llvm_unreachable("Unexpected vtable component kind!");
+    case VtableComponent::CK_FunctionPointer:
+      AddThunk(Component.getFunctionDecl(), Thunk);
+      break;
+    case VtableComponent::CK_CompleteDtorPointer:
+      AddThunk(Component.getDestructorDecl(), Thunk);
+      break;
+    case VtableComponent::CK_DeletingDtorPointer:
+      // We've already added the thunk when we saw the complete dtor pointer.
+      break;
+    }
+  }
 }
 
 VtableBuilder::ReturnAdjustment 





More information about the cfe-commits mailing list