From: Ted Kremenek Date: Tue, 20 May 2008 04:10:52 +0000 (+0000) Subject: Delete AST nodes, not just Decls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f809e3bd0c3d063f22ba34981072dae306ca9272;p=clang Delete AST nodes, not just Decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51298 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h index 3699ba1df7..6f2ff83f5f 100644 --- a/include/clang/AST/Expr.h +++ b/include/clang/AST/Expr.h @@ -1116,8 +1116,8 @@ public: 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 @@ public: static bool classof(const ShuffleVectorExpr *) { return true; } ~ShuffleVectorExpr() { - for (unsigned i = 0; i < NumExprs; i++) - delete SubExprs[i]; delete [] SubExprs; } diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index 993dda71c9..6ed9966135 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -49,7 +49,10 @@ void Stmt::DestroyChildren(ASTContext& C) { 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() {