From fe7a9601e9409985647d043fcb434b5f9fc8a199 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 6 Feb 2009 01:42:09 +0000 Subject: [PATCH] Use ASTContext's allocator to deallocate Stmt objects instead of using 'delete'. This fixes . llvm-svn: 63905 --- clang/lib/AST/Stmt.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 74ed6e92c669..541bb0401c1e 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -15,6 +15,7 @@ #include "clang/AST/ExprCXX.h" #include "clang/AST/ExprObjC.h" #include "clang/AST/Type.h" +#include "clang/AST/ASTContext.h" using namespace clang; static struct StmtClassNameTable { @@ -52,13 +53,14 @@ void Stmt::Destroy(ASTContext& C) { DestroyChildren(C); // FIXME: Eventually all Stmts should be allocated with the allocator // in ASTContext, just like with Decls. - // this->~Stmt(); - delete this; + this->~Stmt(); + C.Deallocate((void *)this); } void DeclStmt::Destroy(ASTContext& C) { DG.Destroy(C); - delete this; + this->~DeclStmt(); + C.Deallocate((void *)this); } void Stmt::PrintStats() {