]> granicus.if.org Git - clang/commitdiff
fix a bug introduced by the recent childification of ForStmt.
authorChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 04:11:23 +0000 (04:11 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 04:11:23 +0000 (04:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41417 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h

index f341f8f112e0496fecb9a2b206ade3570b170193..20ecb860e09553aef84eca750d27984004ee33b5 100644 (file)
@@ -410,13 +410,13 @@ public:
 class ForStmt : public Stmt {
   enum { INIT, COND, INC, BODY, END_EXPR };
   Stmt* SubExprs[END_EXPR]; // SubExprs[INIT] is an expression or declstmt.
-  
-  Stmt *Init;  
-  Expr *Cond, *Inc;
-  Stmt *Body;
 public:
-  ForStmt(Stmt *init, Expr *cond, Expr *inc, Stmt *body)
-    : Stmt(ForStmtClass), Init(init), Cond(cond), Inc(inc), Body(body) {}
+  ForStmt(Stmt *Init, Expr *Cond, Expr *Inc, Stmt *Body) : Stmt(ForStmtClass) {
+    SubExprs[INIT] = Init;
+    SubExprs[COND] = reinterpret_cast<Stmt*>(Cond);
+    SubExprs[INC] = reinterpret_cast<Stmt*>(Inc);
+    SubExprs[BODY] = Body;
+  }
   
   Stmt *getInit() { return SubExprs[INIT]; }
   Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }