]> granicus.if.org Git - clang/commitdiff
Fix the symptom of the regression, by having the CXXConditionDeclExpr not destroy...
authorSebastian Redl <sebastian.redl@getdesigned.at>
Thu, 5 Feb 2009 15:12:41 +0000 (15:12 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Thu, 5 Feb 2009 15:12:41 +0000 (15:12 +0000)
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

lib/AST/Decl.cpp
lib/AST/ExprCXX.cpp

index b95ff3e180af420f5e40632027af17b019889f9f..04ee44a480a86c5826d233a0ab78e2fc3db1ecb7 100644 (file)
@@ -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();
 }
 
 //===----------------------------------------------------------------------===//
index dbc811a68b11cf80e19028527f2e8dae9d774fce..b328c1ef3dac0a9f8a57e5814f6720f88ef1b06f 100644 (file)
@@ -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;
 }