From 76c4ac23631f7f89a5202c0d6dde0c679a1dc88a Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 21 Aug 2007 20:29:50 +0000 Subject: [PATCH] Added reverse iterators for the body of CompountStmt. These are useful for CFG construction (among other potential uses). llvm-svn: 41248 --- clang/include/clang/AST/Stmt.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index c2d46ab7816f..7eefd7fc566a 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -122,7 +122,16 @@ public: const_body_iterator body_begin() const { return Body.begin(); } const_body_iterator body_end() const { return Body.end(); } const Stmt *body_back() const { return Body.back(); } - + + typedef llvm::SmallVector::reverse_iterator reverse_body_iterator; + reverse_body_iterator body_rbegin() { return Body.rbegin(); } + reverse_body_iterator body_rend() { return Body.rend(); } + + typedef llvm::SmallVector::const_reverse_iterator + const_reverse_body_iterator; + const_reverse_body_iterator body_rbegin() const { return Body.rbegin(); } + const_reverse_body_iterator body_rend() const { return Body.rend(); } + void push_back(Stmt *S) { Body.push_back(S); } static bool classof(const Stmt *T) {