diff options
Diffstat (limited to 'include/clang/AST/Stmt.h')
-rw-r--r-- | include/clang/AST/Stmt.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index d6f6a83..33edadc 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -20,6 +20,7 @@ #include "clang/AST/PrettyPrinter.h" #include "clang/AST/StmtIterator.h" #include "clang/AST/DeclGroup.h" +#include "clang/AST/FullExpr.h" #include "llvm/ADT/SmallVector.h" #include "clang/AST/ASTContext.h" #include <string> @@ -293,6 +294,9 @@ class DeclStmt : public Stmt { DeclGroupRef DG; SourceLocation StartLoc, EndLoc; +protected: + virtual void DoDestroy(ASTContext &Ctx); + public: DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc) : Stmt(DeclStmtClass), DG(dg), @@ -620,9 +624,9 @@ class IfStmt : public Stmt { SourceLocation ElseLoc; public: - IfStmt(SourceLocation IL, VarDecl *Var, Expr *cond, Stmt *then, + IfStmt(SourceLocation IL, VarDecl *var, Expr *cond, Stmt *then, SourceLocation EL = SourceLocation(), Stmt *elsev = 0) - : Stmt(IfStmtClass), Var(Var), IfLoc(IL), ElseLoc(EL) { + : Stmt(IfStmtClass), Var(var), IfLoc(IL), ElseLoc(EL) { SubExprs[COND] = reinterpret_cast<Stmt*>(cond); SubExprs[THEN] = then; SubExprs[ELSE] = elsev; @@ -670,9 +674,13 @@ public: } static bool classof(const IfStmt *) { return true; } - // Iterators + // Iterators over subexpressions. The iterators will include iterating + // over the initialization expression referenced by the condition variable. virtual child_iterator child_begin(); virtual child_iterator child_end(); + +protected: + virtual void DoDestroy(ASTContext &Ctx); }; /// SwitchStmt - This represents a 'switch' stmt. @@ -805,6 +813,9 @@ public: // Iterators virtual child_iterator child_begin(); virtual child_iterator child_end(); + +protected: + virtual void DoDestroy(ASTContext &Ctx); }; /// DoStmt - This represents a 'do/while' stmt. @@ -868,9 +879,9 @@ class ForStmt : public Stmt { SourceLocation LParenLoc, RParenLoc; public: - ForStmt(Stmt *Init, Expr *Cond, VarDecl *CondVar, Expr *Inc, Stmt *Body, + ForStmt(Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP) - : Stmt(ForStmtClass), CondVar(CondVar), ForLoc(FL), LParenLoc(LP), + : Stmt(ForStmtClass), CondVar(condVar), ForLoc(FL), LParenLoc(LP), RParenLoc(RP) { SubExprs[INIT] = Init; @@ -927,6 +938,9 @@ public: // Iterators virtual child_iterator child_begin(); virtual child_iterator child_end(); + +protected: + virtual void DoDestroy(ASTContext &Ctx); }; /// GotoStmt - This represents a direct goto. |