diff options
author | Mike Stump <mrs@apple.com> | 2009-09-01 22:20:28 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-09-01 22:20:28 +0000 |
commit | 35191b61db617aefba43b8add88a2ec88af67592 (patch) | |
tree | 93e652da66c7051003e04a6d8539376bb5da9bfe /lib/CodeGen/CGCXX.cpp | |
parent | 74be00b83130859e589a72b8ab370317f4a9f095 (diff) |
Split out overriding. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 8f9147306c..97837b364a 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -892,13 +892,10 @@ public: 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 @@ public: 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; |