diff options
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r-- | clang/lib/Analysis/AnalysisDeclContext.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 11 | ||||
-rw-r--r-- | clang/lib/Analysis/CallGraph.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Analysis/PseudoConstantAnalysis.cpp | 6 |
4 files changed, 14 insertions, 15 deletions
diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp index 4e623c8d6c3..d7fb7e95d75 100644 --- a/clang/lib/Analysis/AnalysisDeclContext.cpp +++ b/clang/lib/Analysis/AnalysisDeclContext.cpp @@ -472,9 +472,9 @@ public: : BEVals(bevals), BC(bc) {} void VisitStmt(Stmt *S) { - for (Stmt::child_range I = S->children(); I; ++I) - if (Stmt *child = *I) - Visit(child); + for (Stmt *Child : S->children()) + if (Child) + Visit(Child); } void VisitDeclRefExpr(DeclRefExpr *DR) { diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 19b3f5a4765..54d15bd232a 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -270,9 +270,8 @@ reverse_children::reverse_children(Stmt *S) { } // Default case for all other statements. - for (Stmt::child_range I = S->children(); I; ++I) { - childrenBuf.push_back(*I); - } + for (Stmt *SubStmt : S->children()) + childrenBuf.push_back(SubStmt); // This needs to be done *after* childrenBuf has been populated. children = childrenBuf; @@ -3641,11 +3640,11 @@ CFGBlock *CFGBuilder::VisitChildrenForTemporaryDtors(Stmt *E, // bottom-up, this means we visit them in their natural order, which // reverses them in the CFG. CFGBlock *B = Block; - for (Stmt::child_range I = E->children(); I; ++I) { - if (Stmt *Child = *I) + for (Stmt *Child : E->children()) + if (Child) if (CFGBlock *R = VisitForTemporaryDtors(Child, false, Context)) B = R; - } + return B; } diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp index 91a8492eaa5..d06603469dd 100644 --- a/clang/lib/Analysis/CallGraph.cpp +++ b/clang/lib/Analysis/CallGraph.cpp @@ -83,9 +83,9 @@ public: } void VisitChildren(Stmt *S) { - for (Stmt::child_range I = S->children(); I; ++I) - if (*I) - static_cast<CGBuilder*>(this)->Visit(*I); + for (Stmt *SubStmt : S->children()) + if (SubStmt) + this->Visit(SubStmt); } }; diff --git a/clang/lib/Analysis/PseudoConstantAnalysis.cpp b/clang/lib/Analysis/PseudoConstantAnalysis.cpp index 3f96ca877f1..5b917a7a27f 100644 --- a/clang/lib/Analysis/PseudoConstantAnalysis.cpp +++ b/clang/lib/Analysis/PseudoConstantAnalysis.cpp @@ -220,8 +220,8 @@ void PseudoConstantAnalysis::RunAnalysis() { } // switch (head->getStmtClass()) // Add all substatements to the worklist - for (Stmt::const_child_range I = Head->children(); I; ++I) - if (*I) - WorkList.push_back(*I); + for (const Stmt *SubStmt : Head->children()) + if (SubStmt) + WorkList.push_back(SubStmt); } // while (!WorkList.empty()) } |