r203959 - [C++11] Replacing CapturedStmt iterators capture_init_begin() and capture_init_end() with iterator_range capture_inits(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman
aaron at aaronballman.com
Fri Mar 14 12:41:04 PDT 2014
Author: aaronballman
Date: Fri Mar 14 14:41:04 2014
New Revision: 203959
URL: http://llvm.org/viewvc/llvm-project?rev=203959&view=rev
Log:
[C++11] Replacing CapturedStmt iterators capture_init_begin() and capture_init_end() with iterator_range capture_inits(). Updating all of the usages of the iterators with range-based for loops.
Modified:
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=203959&r1=203958&r2=203959&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Fri Mar 14 14:41:04 2014
@@ -2073,6 +2073,11 @@ public:
/// \brief Iterator that walks over the capture initialization arguments.
typedef Expr **capture_init_iterator;
+ typedef llvm::iterator_range<capture_init_iterator> capture_init_range;
+
+ capture_init_range capture_inits() const {
+ return capture_init_range(capture_init_begin(), capture_init_end());
+ }
/// \brief Retrieve the first initialization argument.
capture_init_iterator capture_init_begin() const {
Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=203959&r1=203958&r2=203959&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Fri Mar 14 14:41:04 2014
@@ -300,10 +300,8 @@ void ASTStmtWriter::VisitCapturedStmt(Ca
Writer.AddDeclRef(S->getCapturedRecordDecl(), Record);
// Capture inits
- for (CapturedStmt::capture_init_iterator I = S->capture_init_begin(),
- E = S->capture_init_end();
- I != E; ++I)
- Writer.AddStmt(*I);
+ for (auto *I : S->capture_inits())
+ Writer.AddStmt(I);
// Body
Writer.AddStmt(S->getCapturedStmt());
More information about the cfe-commits
mailing list