From: Sebastian Redl Date: Thu, 5 Feb 2009 15:12:41 +0000 (+0000) Subject: Fix the symptom of the regression, by having the CXXConditionDeclExpr not destroy... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df2d3cf2be8b91e1e21234ff5a3aa4f820e7001a;p=clang Fix the symptom of the regression, by having the CXXConditionDeclExpr not destroy its Decl. However, the cause still remains: the Decl is linked into the chain of its DeclContext and remains there despite being deleted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63868 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index b95ff3e180..04ee44a480 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -212,12 +212,14 @@ VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, } void VarDecl::Destroy(ASTContext& C) { + Expr *Init = getInit(); + if (Init) + Init->Destroy(C); this->~VarDecl(); C.Deallocate((void *)this); } VarDecl::~VarDecl() { - delete getInit(); } //===----------------------------------------------------------------------===// diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index dbc811a68b..b328c1ef3d 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -17,7 +17,9 @@ using namespace clang; void CXXConditionDeclExpr::Destroy(ASTContext& C) { - getVarDecl()->Destroy(C); + // FIXME: Cannot destroy the decl here, because it is linked into the + // DeclContext's chain. + //getVarDecl()->Destroy(C); delete this; }