From: Ted Kremenek Date: Thu, 24 Dec 2009 01:59:46 +0000 (+0000) Subject: Fix bug I just introduced in ForStmt::child_end() where we could iterate off into... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6281213d87e71b76f64c4ca62fbe7a97f18ae0a0;p=clang Fix bug I just introduced in ForStmt::child_end() where we could iterate off into garbage values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92115 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 406684c8aa..33edadc3a5 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -879,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; diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index ad1db9004f..7c7aeb8d3e 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -519,7 +519,7 @@ Stmt::child_iterator ForStmt::child_begin() { 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