From c7e4e219b500d84eb5032afb0d0fde5db335d1e8 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 17 Mar 2014 14:19:37 +0000 Subject: [C++11] Replacing CompoundStmt iterators body_begin() and body_end() with iterator_range body(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204040 --- clang/lib/CodeGen/CGClass.cpp | 7 ++----- clang/lib/CodeGen/CGDecl.cpp | 7 +++---- clang/lib/CodeGen/CGObjC.cpp | 5 ++--- 3 files changed, 7 insertions(+), 12 deletions(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 0bfc188c1a6..071f8b32377 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1351,11 +1351,8 @@ void CodeGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList &Args) LexicalScope Scope(*this, RootCS->getSourceRange()); AssignmentMemcpyizer AM(*this, AssignOp, Args); - for (CompoundStmt::const_body_iterator I = RootCS->body_begin(), - E = RootCS->body_end(); - I != E; ++I) { - AM.emitAssignment(*I); - } + for (auto *I : RootCS->body()) + AM.emitAssignment(I); AM.finish(); } diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index cf1c36675e5..e16845c680e 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -1003,13 +1003,12 @@ static bool isCapturedBy(const VarDecl &var, const Expr *e) { if (const StmtExpr *SE = dyn_cast(e)) { const CompoundStmt *CS = SE->getSubStmt(); - for (CompoundStmt::const_body_iterator BI = CS->body_begin(), - BE = CS->body_end(); BI != BE; ++BI) - if (Expr *E = dyn_cast((*BI))) { + for (const auto *BI : CS->body()) + if (const auto *E = dyn_cast(BI)) { if (isCapturedBy(var, E)) return true; } - else if (DeclStmt *DS = dyn_cast((*BI))) { + else if (const auto *DS = dyn_cast(BI)) { // special case declarations for (const auto *I : DS->decls()) { if (const auto *VD = dyn_cast((I))) { diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 01ad1f22a2b..d0a3f653285 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -2834,9 +2834,8 @@ void CodeGenFunction::EmitObjCAutoreleasePoolStmt( EHStack.pushCleanup(NormalCleanup, token); } - for (CompoundStmt::const_body_iterator I = S.body_begin(), - E = S.body_end(); I != E; ++I) - EmitStmt(*I); + for (const auto *I : S.body()) + EmitStmt(I); if (DI) DI->EmitLexicalBlockEnd(Builder, S.getRBracLoc()); -- cgit v1.2.3