clang: Convert two loops to for-each
authorNico Weber <thakis@chromium.org>
Sun, 10 Oct 2021 18:32:51 +0000 (14:32 -0400)
committerNico Weber <thakis@chromium.org>
Sun, 10 Oct 2021 18:55:46 +0000 (14:55 -0400)
And rewrap a line at 80 columns while here. No behavior change.

clang/lib/Analysis/ReachableCode.cpp

index 221d137..9abcf20 100644 (file)
@@ -227,7 +227,8 @@ static bool isConfigurationValue(const Stmt *S,
       if (IncludeIntegers) {
         if (SilenceableCondVal && !SilenceableCondVal->getBegin().isValid())
           *SilenceableCondVal = E->getSourceRange();
-        return WrappedInParens || isExpandedFromConfigurationMacro(E, PP, IgnoreYES_NO);
+        return WrappedInParens ||
+               isExpandedFromConfigurationMacro(E, PP, IgnoreYES_NO);
       }
       return false;
     }
@@ -530,12 +531,11 @@ unsigned DeadCodeScan::scanBackwards(const clang::CFGBlock *Start,
   // earliest location.
   if (!DeferredLocs.empty()) {
     llvm::array_pod_sort(DeferredLocs.begin(), DeferredLocs.end(), SrcCmp);
-    for (DeferredLocsTy::iterator I = DeferredLocs.begin(),
-         E = DeferredLocs.end(); I != E; ++I) {
-      const CFGBlock *Block = I->first;
+    for (const auto &I : DeferredLocs) {
+      const CFGBlock *Block = I.first;
       if (Reachable[Block->getBlockID()])
         continue;
-      reportDeadCode(Block, I->second, CB);
+      reportDeadCode(Block, I.second, CB);
       count += scanMaybeReachableFromBlock(Block, PP, Reachable);
     }
   }
@@ -704,8 +704,7 @@ void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP,
 
   // There are some unreachable blocks.  We need to find the root blocks that
   // contain code that should be considered unreachable.
-  for (CFG::iterator I = cfg->begin(), E = cfg->end(); I != E; ++I) {
-    const CFGBlock *block = *I;
+  for (const CFGBlock *block : *cfg) {
     // A block may have been marked reachable during this loop.
     if (reachable[block->getBlockID()])
       continue;