diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-04 03:41:37 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-04 03:41:37 +0000 |
commit | c0c4993d1c0ba633520abe0fb51bcb6c16d8a649 (patch) | |
tree | 6d6b5501922ee20039eb633eb084decbfb64edc5 /lib/CodeGen/CGVtable.cpp | |
parent | 29202d506509cf470a1698d205c38f880b4130d5 (diff) |
Add a way to get the index of a method. Assert that we have the same index for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90533 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r-- | lib/CodeGen/CGVtable.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 23de0a7948..736af406fc 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -90,13 +90,17 @@ private: // Replace the old decl with the new decl. Methods[Index] = GD; - // Now remove the old decl from the method to index map. - MethodToIndexMap.erase(i); - // And add the new. MethodToIndexMap[GD] = Index; } + /// getIndex - Returns the index of the given method. + uint64_t getIndex(GlobalDecl GD) const { + assert(MethodToIndexMap.count(GD) && "Did not find method!"); + + return MethodToIndexMap.lookup(GD); + } + MethodsVectorTy::size_type size() const { return Methods.size(); } @@ -106,7 +110,7 @@ private: Methods.clear(); } - GlobalDecl operator[](unsigned Index) const { + GlobalDecl operator[](uint64_t Index) const { return Methods[Index]; } }; @@ -751,9 +755,10 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, llvm::Constant *m, for (Index_t i = 0, e = submethods.size(); i != e; ++i) { - // FIXME: begin_overridden_methods might be too lax, covariance */ if (submethods[i] != om) continue; + + assert(i == Methods.getIndex(OGD)); QualType ReturnType = MD->getType()->getAs<FunctionType>()->getResultType(); |