From: Yaron Keren Date: Fri, 12 Jun 2015 05:15:27 +0000 (+0000) Subject: Rangify for loops, NFC. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3b50e969941556504036a65415d95d1b0ad45ee3;p=oota-llvm.git Rangify for loops, NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239596 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index 67cf7f86e07..ee276393964 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -24,8 +24,8 @@ CallGraph::CallGraph(Module &M) : M(M), Root(nullptr), ExternalCallingNode(getOrInsertFunction(nullptr)), CallsExternalNode(new CallGraphNode(nullptr)) { // Add every function to the call graph. - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - addToCallGraph(I); + for (Function &F : M) + addToCallGraph(&F); // If we didn't find a main function, use the external call graph node if (!Root) @@ -40,13 +40,11 @@ CallGraph::~CallGraph() { // Reset all node's use counts to zero before deleting them to prevent an // assertion from firing. #ifndef NDEBUG - for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end(); - I != E; ++I) - I->second->allReferencesDropped(); + for (auto &I : FunctionMap) + I.second->allReferencesDropped(); #endif - for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end(); - I != E; ++I) - delete I->second; + for (auto &I : FunctionMap) + delete I.second; } void CallGraph::addToCallGraph(Function *F) {