Expr and Stmt must be destroyed with Destroy, not delete. Fixes PR/3245.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61335 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 650b8d7..2957583 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -179,10 +179,10 @@
}
void Sema::DeleteExpr(ExprTy *E) {
- delete static_cast<Expr*>(E);
+ static_cast<Expr*>(E)->Destroy(Context);
}
void Sema::DeleteStmt(StmtTy *S) {
- delete static_cast<Stmt*>(S);
+ static_cast<Stmt*>(S)->Destroy(Context);
}
/// ActOnEndOfTranslationUnit - This is called at the very end of the