From 23d5fe6235e599388a1cb3c52596ff22cd557a9c Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sun, 10 Oct 2021 14:32:51 -0400 Subject: [PATCH] clang: Convert two loops to for-each And rewrap a line at 80 columns while here. No behavior change. --- clang/lib/Analysis/ReachableCode.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/clang/lib/Analysis/ReachableCode.cpp b/clang/lib/Analysis/ReachableCode.cpp index 221d137..9abcf20 100644 --- a/clang/lib/Analysis/ReachableCode.cpp +++ b/clang/lib/Analysis/ReachableCode.cpp @@ -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; -- 2.7.4