diff options
author | John McCall <rjmccall@apple.com> | 2011-02-13 04:07:26 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-13 04:07:26 +0000 |
commit | 8322c3a19768bdc4f48dc7c206ed30035d9fa755 (patch) | |
tree | dd6e5f2da2678340e5dce3d2c765ef349c8f1b7e /clang/lib/Analysis/CFG.cpp | |
parent | 4f23f2be15d9d1342687dd49190dca0457fc9c9c (diff) | |
download | bcm5719-llvm-8322c3a19768bdc4f48dc7c206ed30035d9fa755.tar.gz bcm5719-llvm-8322c3a19768bdc4f48dc7c206ed30035d9fa755.zip |
Give some convenient idiomatic accessors to Stmt::child_range and
Stmt::const_child_range, then make a bunch of places use them instead
of the individual iterator accessors.
llvm-svn: 125450
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 2cf2751879b..bc3699ba68a 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -921,8 +921,7 @@ CFGBlock *CFGBuilder::VisitStmt(Stmt *S, AddStmtChoice asc) { /// VisitChildren - Visit the children of a Stmt. CFGBlock *CFGBuilder::VisitChildren(Stmt* Terminator) { CFGBlock *B = Block; - for (Stmt::child_iterator I = Terminator->child_begin(), - E = Terminator->child_end(); I != E; ++I) { + for (Stmt::child_range I = Terminator->children(); I; ++I) { if (*I) B = Visit(*I); } return B; @@ -2503,8 +2502,7 @@ CFGBlock *CFGBuilder::VisitChildrenForTemporaryDtors(Stmt *E) { // them in helper vector. typedef llvm::SmallVector<Stmt *, 4> ChildrenVect; ChildrenVect ChildrenRev; - for (Stmt::child_iterator I = E->child_begin(), L = E->child_end(); - I != L; ++I) { + for (Stmt::child_range I = E->children(); I; ++I) { if (*I) ChildrenRev.push_back(*I); } @@ -2697,7 +2695,7 @@ static void FindSubExprAssignments(Stmt *S, if (!S) return; - for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I!=E; ++I) { + for (Stmt::child_range I = S->children(); I; ++I) { Stmt *child = *I; if (!child) continue; @@ -3020,7 +3018,7 @@ static void print_elem(llvm::raw_ostream &OS, StmtPrinterHelper* Helper, if (StmtExpr* SE = dyn_cast<StmtExpr>(S)) { CompoundStmt* Sub = SE->getSubStmt(); - if (Sub->child_begin() != Sub->child_end()) { + if (Sub->children()) { OS << "({ ... ; "; Helper->handledStmt(*SE->getSubStmt()->body_rbegin(),OS); OS << " })\n"; |