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

Anders Carlsson andersca at mac.com
Thu Dec 3 19:06:03 PST 2009


Author: andersca
Date: Thu Dec  3 21:06:03 2009
New Revision: 90531

URL: http://llvm.org/viewvc/llvm-project?rev=90531&view=rev
Log:
Add the method directly to the vtable.

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=90531&r1=90530&r2=90531&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Dec  3 21:06:03 2009
@@ -857,25 +857,30 @@
                                          VirtualAdjustment);
     }
 
+    llvm::Constant *Method = 0;
     if (!ReturnAdjustment.isEmpty()) {
       // Build a covariant thunk.
       CovariantThunkAdjustment Adjustment(ThisAdjustment, ReturnAdjustment);
-      submethods[i] = CGM.BuildCovariantThunk(MD, Extern, Adjustment);
+      Method = CGM.BuildCovariantThunk(MD, Extern, Adjustment);
     } else if (!ThisAdjustment.isEmpty()) {
       // Build a "regular" thunk.
-      submethods[i] = CGM.BuildThunk(GD, Extern, ThisAdjustment);
+      Method = CGM.BuildThunk(GD, Extern, ThisAdjustment);
     } else if (MD->isPure()) {
       // We have a pure virtual method.
-      submethods[i] = getPureVirtualFn();
+      Method = getPureVirtualFn();
+    } else {
+      // We have a good old regular method.
+      Method = WrapAddrOf(GD);
     }
+
+    // Add the method to the vtable.
+    methods.push_back(Method);
   }
   
+  
   ThisAdjustments.clear();
   BaseReturnTypes.clear();
   
-  D1(printf("============= combining methods\n"));
-  methods.insert(methods.end(), submethods.begin(), submethods.end());
-  
   Methods.clear();
   submethods.clear();
 }





More information about the cfe-commits mailing list