Author: kremenek
Date: Wed Dec 23 19:59:46 2009
New Revision: 92115

URL: http://llvm.org/viewvc/llvm-project?rev=92115&view=rev
Log:
Fix bug I just introduced in ForStmt::child_end() where we could iterate off 
into garbage values.

Modified:
    cfe/trunk/include/clang/AST/Stmt.h
    cfe/trunk/lib/AST/Stmt.cpp

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=92115&r1=92114&r2=92115&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Wed Dec 23 19:59:46 2009
@@ -879,9 +879,9 @@
   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;

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=92115&r1=92114&r2=92115&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Wed Dec 23 19:59:46 2009
@@ -519,7 +519,7 @@
   return child_iterator(CondVar, &SubExprs[0]);
 }
 Stmt::child_iterator ForStmt::child_end() {
-  return child_iterator(CondVar, &SubExprs[0]+END_EXPR);
+  return child_iterator(0, &SubExprs[0]+END_EXPR);
 }
 
 // ObjCForCollectionStmt


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to