[cfe-commits] r63868 - in /cfe/trunk/lib/AST: Decl.cpp ExprCXX.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Thu Feb 5 07:12:41 PST 2009


Author: cornedbee
Date: Thu Feb  5 09:12:41 2009
New Revision: 63868

URL: http://llvm.org/viewvc/llvm-project?rev=63868&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/lib/AST/ExprCXX.cpp

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

==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Feb  5 09:12:41 2009
@@ -212,12 +212,14 @@
 }
 
 void VarDecl::Destroy(ASTContext& C) {
+  Expr *Init = getInit();
+  if (Init)
+    Init->Destroy(C);
   this->~VarDecl();
   C.Deallocate((void *)this);
 }
 
 VarDecl::~VarDecl() {
-  delete getInit();
 }
 
 //===----------------------------------------------------------------------===//

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

==============================================================================
--- cfe/trunk/lib/AST/ExprCXX.cpp (original)
+++ cfe/trunk/lib/AST/ExprCXX.cpp Thu Feb  5 09:12:41 2009
@@ -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;
 }
 





More information about the cfe-commits mailing list