forked from OSchip/llvm-project
[clang] Convert a few loops to for-each
This commit is contained in:
parent
144f851f6f
commit
00ca004dda
|
@ -2724,11 +2724,10 @@ CFGBlock *CFGBuilder::VisitCompoundStmt(CompoundStmt *C,
|
|||
|
||||
CFGBlock *LastBlock = Block;
|
||||
|
||||
for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
|
||||
I != E; ++I ) {
|
||||
for (Stmt *S : llvm::reverse(C->body())) {
|
||||
// If we hit a segment of code just containing ';' (NullStmts), we can
|
||||
// get a null block back. In such cases, just use the LastBlock
|
||||
CFGBlock *newBlock = Visit(*I, AddStmtChoice::AlwaysAdd,
|
||||
CFGBlock *newBlock = Visit(S, AddStmtChoice::AlwaysAdd,
|
||||
ExternallyDestructed);
|
||||
|
||||
if (newBlock)
|
||||
|
|
|
@ -1079,11 +1079,9 @@ namespace {
|
|||
while (!BlockQueue.empty()) {
|
||||
const CFGBlock *P = BlockQueue.front();
|
||||
BlockQueue.pop_front();
|
||||
for (CFGBlock::const_succ_iterator I = P->succ_begin(),
|
||||
E = P->succ_end();
|
||||
I != E; ++I) {
|
||||
if (*I && ReachableBlocks.insert(*I).second)
|
||||
BlockQueue.push_back(*I);
|
||||
for (const CFGBlock *B : P->succs()) {
|
||||
if (B && ReachableBlocks.insert(B).second)
|
||||
BlockQueue.push_back(B);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -630,8 +630,7 @@ public:
|
|||
const CompoundStmt *Scope) {
|
||||
LastDeclUSEFinder Visitor;
|
||||
Visitor.D = D;
|
||||
for (auto I = Scope->body_rbegin(), E = Scope->body_rend(); I != E; ++I) {
|
||||
const Stmt *S = *I;
|
||||
for (const Stmt *S : llvm::reverse(Scope->body())) {
|
||||
if (!Visitor.TraverseStmt(const_cast<Stmt *>(S)))
|
||||
return S;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue