[llvm-commits] [llvm] r62430 - /llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
Gabor Greif
ggreif at gmail.com
Sat Jan 17 11:46:01 PST 2009
Author: ggreif
Date: Sat Jan 17 13:46:01 2009
New Revision: 62430
URL: http://llvm.org/viewvc/llvm-project?rev=62430&view=rev
Log:
switch over some other methods from indices to iterators
Modified:
llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=62430&r1=62429&r2=62430&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Sat Jan 17 13:46:01 2009
@@ -285,11 +285,11 @@
/// removeOneAbstractEdgeTo - Remove one edge associated with a null callsite
/// from this node to the specified callee function.
void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee) {
- for (unsigned i = CalledFunctions.size(); ; --i) {
- assert(i && "Cannot find callee to remove!");
- CallRecord &CR = CalledFunctions[i-1];
+ for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
+ assert(I != CalledFunctions.end() && "Cannot find callee to remove!");
+ CallRecord &CR = *I;
if (CR.second == Callee && !CR.first.getInstruction()) {
- CalledFunctions.erase(CalledFunctions.begin()+i-1);
+ CalledFunctions.erase(I);
return;
}
}
@@ -299,10 +299,10 @@
/// New CallSite instead. Note that this method takes linear time, so it
/// should be used sparingly.
void CallGraphNode::replaceCallSite(CallSite Old, CallSite New) {
- for (unsigned i = CalledFunctions.size(); ; --i) {
- assert(i && "Cannot find callsite to replace!");
- if (CalledFunctions[i-1].first == Old) {
- CalledFunctions[i-1].first = New;
+ for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
+ assert(I != CalledFunctions.end() && "Cannot find callsite to replace!");
+ if (I->first == Old) {
+ I->first = New;
return;
}
}
More information about the llvm-commits
mailing list