[cfe-commits] r90533 - /cfe/trunk/lib/CodeGen/CGVtable.cpp
Anders Carlsson
andersca at mac.com
Thu Dec 3 19:41:38 PST 2009
Author: andersca
Date: Thu Dec 3 21:41:37 2009
New Revision: 90533
URL: http://llvm.org/viewvc/llvm-project?rev=90533&view=rev
Log:
Add a way to get the index of a method. Assert that we have the same index for now.
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=90533&r1=90532&r2=90533&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Dec 3 21:41:37 2009
@@ -90,13 +90,17 @@
// 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 @@
Methods.clear();
}
- GlobalDecl operator[](unsigned Index) const {
+ GlobalDecl operator[](uint64_t Index) const {
return Methods[Index];
}
};
@@ -751,9 +755,10 @@
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();
More information about the cfe-commits
mailing list