[cfe-commits] r39590 - /cfe/cfe/trunk/include/clang/AST/Stmt.h
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:46:00 PDT 2007
Author: clattner
Date: Wed Jul 11 11:46:00 2007
New Revision: 39590
URL: http://llvm.org/viewvc/llvm-project?rev=39590&view=rev
Log:
rename forstmt accessors, add const accessors
Modified:
cfe/cfe/trunk/include/clang/AST/Stmt.h
Modified: cfe/cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Stmt.h?rev=39590&r1=39589&r2=39590&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Stmt.h Wed Jul 11 11:46:00 2007
@@ -257,7 +257,9 @@
: Stmt(DoStmtClass), Body(body), Cond(cond) {}
Stmt *getBody() { return Body; }
+ const Stmt *getBody() const { return Body; }
Expr *getCond() { return Cond; }
+ const Expr *getCond() const { return Cond; }
virtual void visit(StmtVisitor &Visitor);
static bool classof(const Stmt *T) {
@@ -267,22 +269,28 @@
};
-/// ForStmt - This represents a 'for' stmt.
+/// ForStmt - This represents a 'for (init;cond;inc)' stmt. Note that any of
+/// the init/cond/inc parts of the ForStmt will be null if they were not
+/// specified in the source.
///
class ForStmt : public Stmt {
- Stmt *First; // Expression or decl.
- Expr *Second, *Third;
+ Stmt *Init; // Expression or declstmt.
+ Expr *Cond, *Inc;
Stmt *Body;
public:
- ForStmt(Stmt *first, Expr *second, Expr *third, Stmt *body)
- : Stmt(ForStmtClass),
- First(first), Second(second), Third(third), Body(body) {}
-
- Stmt *getFirst() { return First; }
- Expr *getSecond() { return Second; }
- Expr *getThird() { return Third; }
+ ForStmt(Stmt *init, Expr *cond, Expr *inc, Stmt *body)
+ : Stmt(ForStmtClass), Init(init), Cond(cond), Inc(inc), Body(body) {}
+
+ Stmt *getInit() { return Init; }
+ Expr *getCond() { return Cond; }
+ Expr *getInc() { return Inc; }
Stmt *getBody() { return Body; }
+ const Stmt *getInit() const { return Init; }
+ const Expr *getCond() const { return Cond; }
+ const Expr *getInc() const { return Inc; }
+ const Stmt *getBody() const { return Body; }
+
virtual void visit(StmtVisitor &Visitor);
static bool classof(const Stmt *T) {
return T->getStmtClass() == ForStmtClass;
More information about the cfe-commits
mailing list