summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Stmt.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-12-23 08:56:00 +0000
committerTed Kremenek <kremenek@apple.com>2009-12-23 08:56:00 +0000
commit00d19ee130200b063c001723b7c5d074b925a175 (patch)
treec4261bbbea09d088906f647c91a25511309ec0c7 /clang/lib/AST/Stmt.cpp
parentd2ab38e3f4244e6af87ce16cfc7aff71bc022647 (diff)
downloadbcm5719-llvm-00d19ee130200b063c001723b7c5d074b925a175.tar.gz
bcm5719-llvm-00d19ee130200b063c001723b7c5d074b925a175.zip
Add 'DeclStmt::DoDestroy()' which doesn't actually recurse over its child expressions (via StmtIterator), as those expressions are owned by the Decls and Types (which are destroyed elsewhere). This fixes a crasher reported in <rdar://problem/7487294>.
llvm-svn: 91990
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r--clang/lib/AST/Stmt.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index fad80ec0cf2..14f0c8d744d 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -426,6 +426,14 @@ Stmt::child_iterator DeclStmt::child_end() {
return StmtIterator(DG.end(), DG.end());
}
+void DeclStmt::DoDestroy(ASTContext &C) {
+ // Don't use StmtIterator to iterate over the Decls, as that can recurse
+ // into VLA size expressions (which are owned by the VLA). Further, Decls
+ // are owned by the DeclContext, and will be destroyed with them.
+ if (DG.isDeclGroup())
+ DG.getDeclGroup().Destroy(C);
+}
+
// NullStmt
Stmt::child_iterator NullStmt::child_begin() { return child_iterator(); }
Stmt::child_iterator NullStmt::child_end() { return child_iterator(); }
OpenPOWER on IntegriCloud