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

Anders Carlsson andersca at mac.com
Thu Dec 3 18:43:50 PST 2009


Author: andersca
Date: Thu Dec  3 20:43:50 2009
New Revision: 90527

URL: http://llvm.org/viewvc/llvm-project?rev=90527&view=rev
Log:
Move 'this' pointer adjustment thunks to AppendMethods.

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=90527&r1=90526&r2=90527&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Dec  3 20:43:50 2009
@@ -331,21 +331,6 @@
     }
     BaseReturnTypes.clear();
     
-    for (ThisAdjustmentsMapTy::const_iterator i = ThisAdjustments.begin(), 
-         e = ThisAdjustments.end(); i != e; ++i) {
-      uint64_t Index = i->first;
-      GlobalDecl GD = Methods[Index];
-      const ThunkAdjustment &ThisAdjustment = i->second;
-
-      const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
-      assert(!MD->isPure() && "Can't thunk pure virtual methods!");
-
-      assert(Index == VtableBuilder::Index[GD] && "Thunk index mismatch!");
-             
-      submethods[Index] = CGM.BuildThunk(GD, Extern, ThisAdjustment);
-    }
-    ThisAdjustments.clear();
-
     for (PureVirtualMethodsSetTy::iterator i = PureVirtualMethods.begin(),
          e = PureVirtualMethods.end(); i != e; ++i) {
       GlobalDecl GD = *i;
@@ -907,6 +892,19 @@
 
 void VtableBuilder::AppendMethods() {
   InstallThunks();
+
+  for (unsigned i = 0, e = Methods.size(); i != e; ++i) {
+    GlobalDecl GD = Methods[i];
+    
+    ThunkAdjustment ThisAdjustment = ThisAdjustments.lookup(i);
+    
+    if (!ThisAdjustment.isEmpty())
+      submethods[i] = CGM.BuildThunk(GD, Extern, ThisAdjustment);
+  }
+  
+  ThisAdjustments.clear();
+  
+  
   D1(printf("============= combining methods\n"));
   methods.insert(methods.end(), submethods.begin(), submethods.end());
   





More information about the cfe-commits mailing list