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

Ted Kremenek kremenek at apple.com
Wed May 21 08:53:55 PDT 2008


Author: kremenek
Date: Wed May 21 10:53:55 2008
New Revision: 51379

URL: http://llvm.org/viewvc/llvm-project?rev=51379&view=rev
Log:
When destroying DeclStmts, also destroy the associated Decl (reclaim its memory).

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Wed May 21 10:53:55 2008
@@ -146,6 +146,8 @@
   DeclStmt(ScopedDecl *D, SourceLocation startLoc, SourceLocation endLoc)
     : Stmt(DeclStmtClass), TheDecl(D), StartLoc(startLoc), EndLoc(endLoc) {}
   
+  virtual void Destroy(ASTContext& Ctx);
+
   const ScopedDecl *getDecl() const { return TheDecl; }
   ScopedDecl *getDecl() { return TheDecl; }
 

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

==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Wed May 21 10:53:55 2008
@@ -55,6 +55,11 @@
   delete this;
 }
 
+void DeclStmt::Destroy(ASTContext& C) {
+  TheDecl->Destroy(C);
+  Stmt::Destroy(C);
+}
+
 void Stmt::PrintStats() {
   // Ensure the table is primed.
   getStmtInfoTableEntry(Stmt::NullStmtClass);





More information about the cfe-commits mailing list