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

Anders Carlsson andersca at mac.com
Thu Dec 3 18:56:03 PST 2009


Author: andersca
Date: Thu Dec  3 20:56:03 2009
New Revision: 90529

URL: http://llvm.org/viewvc/llvm-project?rev=90529&view=rev
Log:
Move handling of pure virtual methods to AppendMethods (and rename it to AppendMethodsToVtable).

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=90529&r1=90528&r2=90529&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Dec  3 20:56:03 2009
@@ -289,17 +289,8 @@
                       Index_t Offset, int64_t CurrentVBaseOffset);
 
   /// AppendMethods - Append the current methods to the vtable.
-  void AppendMethods();
+  void AppendMethodsToVtable();
   
-  void InstallThunks() {
-    for (PureVirtualMethodsSetTy::iterator i = PureVirtualMethods.begin(),
-         e = PureVirtualMethods.end(); i != e; ++i) {
-      GlobalDecl GD = *i;
-      submethods[Index[GD]] = getPureVirtualFn();
-    }
-    PureVirtualMethods.clear();
-  }
-
   llvm::Constant *WrapAddrOf(GlobalDecl GD) {
     const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
 
@@ -486,7 +477,7 @@
 
     assert(submethods.size() == Methods.size() && "Method size mismatch!");
 
-    AppendMethods();
+    AppendMethodsToVtable();
 
     // and then the non-virtual bases.
     NonVirtualBases(RD, Layout, PrimaryBase, PrimaryBaseWasVirtual,
@@ -851,9 +842,7 @@
   return false;
 }
 
-void VtableBuilder::AppendMethods() {
-  InstallThunks();
-
+void VtableBuilder::AppendMethodsToVtable() {
   for (unsigned i = 0, e = Methods.size(); i != e; ++i) {
     GlobalDecl GD = Methods[i];
     const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
@@ -886,6 +875,9 @@
     } else if (!ThisAdjustment.isEmpty()) {
       // Build a "regular" thunk.
       submethods[i] = CGM.BuildThunk(GD, Extern, ThisAdjustment);
+    } else if (MD->isPure()) {
+      // We have a pure virtual method.
+      submethods[i] = getPureVirtualFn();
     }
   }
   





More information about the cfe-commits mailing list