diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-01-16 06:50:08 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-01-16 06:50:08 +0000 |
commit | 860f6d4af5f37a151d5e5ea3538dc4708cab5d68 (patch) | |
tree | 58d41d08f1b320b9ba00de25bc4d3c40c185ff5e /lib/AST/Stmt.cpp | |
parent | d5ed8c3d7de82ee1f028806ccac9b921832fb528 (diff) |
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
Diffstat (limited to 'lib/AST/Stmt.cpp')
-rw-r--r-- | lib/AST/Stmt.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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) { |