[cfe-commits] r63905 - /cfe/trunk/lib/AST/Stmt.cpp

Ted Kremenek kremenek at apple.com
Thu Feb 5 17:42:09 PST 2009


Author: kremenek
Date: Thu Feb  5 19:42:09 2009
New Revision: 63905

URL: http://llvm.org/viewvc/llvm-project?rev=63905&view=rev
Log:
Use ASTContext's allocator to deallocate Stmt objects instead of using 'delete'.  This fixes <rdar://problem/6561143>.

Modified:
    cfe/trunk/lib/AST/Stmt.cpp

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=63905&r1=63904&r2=63905&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Thu Feb  5 19:42:09 2009
@@ -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 @@
   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() {





More information about the cfe-commits mailing list