summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-03-17 14:19:37 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-03-17 14:19:37 +0000
commitc7e4e219b500d84eb5032afb0d0fde5db335d1e8 (patch)
tree5063b67f2bcd5fb782384842a9c2576cb676f189 /clang/lib/Sema
parenta0eb97a50b40ac96cd79298a0fd132fd267339fb (diff)
downloadbcm5719-llvm-c7e4e219b500d84eb5032afb0d0fde5db335d1e8.tar.gz
bcm5719-llvm-c7e4e219b500d84eb5032afb0d0fde5db335d1e8.zip
[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
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp10
-rw-r--r--clang/lib/Sema/TreeTransform.h9
2 files changed, 8 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index c9fee1e1f53..d0560678353 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -997,9 +997,8 @@ CheckConstexprFunctionStmt(Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S,
Cxx1yLoc = S->getLocStart();
CompoundStmt *CompStmt = cast<CompoundStmt>(S);
- for (CompoundStmt::body_iterator BodyIt = CompStmt->body_begin(),
- BodyEnd = CompStmt->body_end(); BodyIt != BodyEnd; ++BodyIt) {
- if (!CheckConstexprFunctionStmt(SemaRef, Dcl, *BodyIt, ReturnStmts,
+ for (auto *BodyIt : CompStmt->body()) {
+ if (!CheckConstexprFunctionStmt(SemaRef, Dcl, BodyIt, ReturnStmts,
Cxx1yLoc))
return false;
}
@@ -1101,9 +1100,8 @@ bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) {
// [... list of cases ...]
CompoundStmt *CompBody = cast<CompoundStmt>(Body);
SourceLocation Cxx1yLoc;
- for (CompoundStmt::body_iterator BodyIt = CompBody->body_begin(),
- BodyEnd = CompBody->body_end(); BodyIt != BodyEnd; ++BodyIt) {
- if (!CheckConstexprFunctionStmt(*this, Dcl, *BodyIt, ReturnStmts, Cxx1yLoc))
+ for (auto *BodyIt : CompBody->body()) {
+ if (!CheckConstexprFunctionStmt(*this, Dcl, BodyIt, ReturnStmts, Cxx1yLoc))
return false;
}
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 60dfb133342..5000d280981 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -5273,13 +5273,12 @@ TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S,
bool SubStmtInvalid = false;
bool SubStmtChanged = false;
SmallVector<Stmt*, 8> Statements;
- for (CompoundStmt::body_iterator B = S->body_begin(), BEnd = S->body_end();
- B != BEnd; ++B) {
- StmtResult Result = getDerived().TransformStmt(*B);
+ for (auto *B : S->body()) {
+ StmtResult Result = getDerived().TransformStmt(B);
if (Result.isInvalid()) {
// Immediately fail if this was a DeclStmt, since it's very
// likely that this will cause problems for future statements.
- if (isa<DeclStmt>(*B))
+ if (isa<DeclStmt>(B))
return StmtError();
// Otherwise, just keep processing substatements and fail later.
@@ -5287,7 +5286,7 @@ TreeTransform<Derived>::TransformCompoundStmt(CompoundStmt *S,
continue;
}
- SubStmtChanged = SubStmtChanged || Result.get() != *B;
+ SubStmtChanged = SubStmtChanged || Result.get() != B;
Statements.push_back(Result.takeAs<Stmt>());
}
OpenPOWER on IntegriCloud