]> granicus.if.org Git - clang/commitdiff
Use ASTContext's allocator to deallocate Stmt objects instead of using 'delete'....
authorTed Kremenek <kremenek@apple.com>
Fri, 6 Feb 2009 01:42:09 +0000 (01:42 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 6 Feb 2009 01:42:09 +0000 (01:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63905 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Stmt.cpp

index 74ed6e92c6697f6b587b271c5759247976ba997f..541bb0401c1e1a2af6f8ed09526c7aaa4b827574 100644 (file)
@@ -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() {