[cfe-commits] r51298 - in /cfe/trunk: include/clang/AST/Expr.h lib/AST/Stmt.cpp

Ted Kremenek kremenek at apple.com
Mon May 19 21:10:53 PDT 2008


Author: kremenek
Date: Mon May 19 23:10:52 2008
New Revision: 51298

URL: http://llvm.org/viewvc/llvm-project?rev=51298&view=rev
Log:
Delete AST nodes, not just Decls.

Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/lib/AST/Stmt.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=51298&r1=51297&r2=51298&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Mon May 19 23:10:52 2008
@@ -1116,8 +1116,8 @@
                     QualType Type, SourceLocation BLoc, 
                     SourceLocation RP) : 
     Expr(ShuffleVectorExprClass, Type), BuiltinLoc(BLoc),
-    RParenLoc(RP), NumExprs(nexpr)
-  {
+    RParenLoc(RP), NumExprs(nexpr) {
+      
     SubExprs = new Expr*[nexpr];
     for (unsigned i = 0; i < nexpr; i++)
       SubExprs[i] = args[i];
@@ -1132,8 +1132,6 @@
   static bool classof(const ShuffleVectorExpr *) { return true; }
   
   ~ShuffleVectorExpr() {
-    for (unsigned i = 0; i < NumExprs; i++)
-      delete SubExprs[i];
     delete [] SubExprs;
   }
   

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

==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Mon May 19 23:10:52 2008
@@ -49,7 +49,10 @@
 
 void Stmt::Destroy(ASTContext& C) {
   DestroyChildren(C);
-  this->~Stmt();
+  // FIXME: Eventually all Stmts should be allocated with the allocator
+  //  in ASTContext, just like with Decls.
+  // this->~Stmt();
+  delete this;
 }
 
 void Stmt::PrintStats() {





More information about the cfe-commits mailing list