diff options
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 |