diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 3176e97f130184ece0e1a21352c8124cc83ff24a (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /include/clang/AST/StmtIterator.h | |
parent | 1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff) | |
download | FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz |
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'include/clang/AST/StmtIterator.h')
-rw-r--r-- | include/clang/AST/StmtIterator.h | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/include/clang/AST/StmtIterator.h b/include/clang/AST/StmtIterator.h index a5a57af..81f8ad43 100644 --- a/include/clang/AST/StmtIterator.h +++ b/include/clang/AST/StmtIterator.h @@ -139,86 +139,6 @@ struct ConstStmtIterator : public StmtIteratorImpl<ConstStmtIterator, StmtIteratorImpl<ConstStmtIterator,const Stmt*>(RHS) {} }; -/// A range of statement iterators. -/// -/// This class provides some extra functionality beyond std::pair -/// in order to allow the following idiom: -/// for (StmtRange range = stmt->children(); range; ++range) -struct StmtRange : std::pair<StmtIterator,StmtIterator> { - StmtRange() {} - StmtRange(const StmtIterator &begin, const StmtIterator &end) - : std::pair<StmtIterator,StmtIterator>(begin, end) {} - - bool empty() const { return first == second; } - explicit operator bool() const { return !empty(); } - - Stmt *operator->() const { return first.operator->(); } - Stmt *&operator*() const { return first.operator*(); } - - StmtRange &operator++() { - assert(!empty() && "incrementing on empty range"); - ++first; - return *this; - } - - StmtRange operator++(int) { - assert(!empty() && "incrementing on empty range"); - StmtRange copy = *this; - ++first; - return copy; - } - - friend const StmtIterator &begin(const StmtRange &range) { - return range.first; - } - friend const StmtIterator &end(const StmtRange &range) { - return range.second; - } -}; - -/// A range of const statement iterators. -/// -/// This class provides some extra functionality beyond std::pair -/// in order to allow the following idiom: -/// for (ConstStmtRange range = stmt->children(); range; ++range) -struct ConstStmtRange : std::pair<ConstStmtIterator,ConstStmtIterator> { - ConstStmtRange() {} - ConstStmtRange(const ConstStmtIterator &begin, - const ConstStmtIterator &end) - : std::pair<ConstStmtIterator,ConstStmtIterator>(begin, end) {} - ConstStmtRange(const StmtRange &range) - : std::pair<ConstStmtIterator,ConstStmtIterator>(range.first, range.second) - {} - ConstStmtRange(const StmtIterator &begin, const StmtIterator &end) - : std::pair<ConstStmtIterator,ConstStmtIterator>(begin, end) {} - - bool empty() const { return first == second; } - explicit operator bool() const { return !empty(); } - - const Stmt *operator->() const { return first.operator->(); } - const Stmt *operator*() const { return first.operator*(); } - - ConstStmtRange &operator++() { - assert(!empty() && "incrementing on empty range"); - ++first; - return *this; - } - - ConstStmtRange operator++(int) { - assert(!empty() && "incrementing on empty range"); - ConstStmtRange copy = *this; - ++first; - return copy; - } - - friend const ConstStmtIterator &begin(const ConstStmtRange &range) { - return range.first; - } - friend const ConstStmtIterator &end(const ConstStmtRange &range) { - return range.second; - } -}; - } // end namespace clang #endif |