[cfe-commits] r80732 - /cfe/trunk/lib/CodeGen/CGCXX.cpp

Mike Stump mrs at apple.com
Tue Sep 1 15:20:29 PDT 2009


Author: mrs
Date: Tue Sep  1 17:20:28 2009
New Revision: 80732

URL: http://llvm.org/viewvc/llvm-project?rev=80732&view=rev
Log:
Split out overriding.  WIP.

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

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=80732&r1=80731&r2=80732&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Tue Sep  1 17:20:28 2009
@@ -892,13 +892,10 @@
     SeenVBase.clear();
   }
 
-  void AddMethod(const CXXMethodDecl *MD, Index_t AddressPoint,
-                 bool MorallyVirtual, Index_t Offset) {
+  bool OverrideMethod(const CXXMethodDecl *MD, llvm::Constant *m,
+                      bool MorallyVirtual, Index_t Offset) {
     typedef CXXMethodDecl::method_iterator meth_iter;
 
-    llvm::Constant *m;
-    m = wrap(CGM.GetAddrOfFunction(GlobalDecl(MD), Ptr8Ty));
-
     // FIXME: Don't like the nested loops.  For very large inheritance
     // heirarchies we could have a table on the side with the final overridder
     // and just replace each instance of an overridden method once.  Would be
@@ -925,11 +922,21 @@
             VCalls[VCall[OMD]] = Offset/8 - VCallOffset[OMD];
           }
           // submethods[VCall[OMD]] = wrap(Offset/8 - VCallOffset[OMD]);
-          return;
+          return true;
         }
       }
     }
 
+    return false;
+  }
+
+  void AddMethod(const CXXMethodDecl *MD, Index_t AddressPoint,
+                 bool MorallyVirtual, Index_t Offset) {
+    llvm::Constant *m;
+    m = wrap(CGM.GetAddrOfFunction(GlobalDecl(MD), Ptr8Ty));
+    if (OverrideMethod(MD, m, MorallyVirtual, Offset))
+      return;
+    
     // else allocate a new slot.
     Index[MD] = submethods.size();
     // VCall[MD] = Offset;





More information about the cfe-commits mailing list