[clang] 23d5fe6 - clang: Convert two loops to for-each
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 10 11:56:04 PDT 2021
Author: Nico Weber
Date: 2021-10-10T14:55:46-04:00
New Revision: 23d5fe6235e599388a1cb3c52596ff22cd557a9c
URL: https://github.com/llvm/llvm-project/commit/23d5fe6235e599388a1cb3c52596ff22cd557a9c
DIFF: https://github.com/llvm/llvm-project/commit/23d5fe6235e599388a1cb3c52596ff22cd557a9c.diff
LOG: clang: Convert two loops to for-each
And rewrap a line at 80 columns while here. No behavior change.
Added:
Modified:
clang/lib/Analysis/ReachableCode.cpp
Removed:
################################################################################
diff --git a/clang/lib/Analysis/ReachableCode.cpp b/clang/lib/Analysis/ReachableCode.cpp
index 221d137dadb87..9abcf20eacba8 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;
More information about the cfe-commits
mailing list