From: Douglas Gregor Date: Fri, 16 Jan 2009 06:50:08 +0000 (+0000) Subject: Don't advance the statement iterator after we've deallocated the statement X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=860f6d4af5f37a151d5e5ea3538dc4708cab5d68;p=clang Don't advance the statement iterator after we've deallocated the statement git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62306 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index 586e8f986a..74ed6e92c6 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -43,8 +43,9 @@ const char *Stmt::getStmtClassName() const { } void Stmt::DestroyChildren(ASTContext& C) { - for (child_iterator I = child_begin(), E = child_end(); I !=E; ++I) - if (Stmt* Child = *I) Child->Destroy(C); + for (child_iterator I = child_begin(), E = child_end(); I !=E; ) { + if (Stmt* Child = *I++) Child->Destroy(C); + } } void Stmt::Destroy(ASTContext& C) {