[llvm] r227723 - [PM] Switch to a ranged based for loop. NFC

Chandler Carruth chandlerc at gmail.com
Sun Feb 1 02:40:21 PST 2015


Author: chandlerc
Date: Sun Feb  1 04:40:21 2015
New Revision: 227723

URL: http://llvm.org/viewvc/llvm-project?rev=227723&view=rev
Log:
[PM] Switch to a ranged based for loop. NFC

Modified:
    llvm/trunk/include/llvm/IR/PassManager.h

Modified: llvm/trunk/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=227723&r1=227722&r2=227723&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h (original)
+++ llvm/trunk/include/llvm/IR/PassManager.h Sun Feb  1 04:40:21 2015
@@ -782,8 +782,8 @@ public:
       FAM = &AM->getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
 
     PreservedAnalyses PA = PreservedAnalyses::all();
-    for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
-      PreservedAnalyses PassPA = Pass.run(*I, FAM);
+    for (Function &F : M) {
+      PreservedAnalyses PassPA = Pass.run(F, FAM);
 
       // We know that the function pass couldn't have invalidated any other
       // function's analyses (that's the contract of a function pass), so
@@ -791,7 +791,7 @@ public:
       // update our preserved set to reflect that these have already been
       // handled.
       if (FAM)
-        PassPA = FAM->invalidate(*I, std::move(PassPA));
+        PassPA = FAM->invalidate(F, std::move(PassPA));
 
       // Then intersect the preserved set so that invalidation of module
       // analyses will eventually occur when the module pass completes.





More information about the llvm-commits mailing list