]> granicus.if.org Git - clang/commitdiff
When destroying DeclStmts, also destroy the associated Decl (reclaim its memory).
authorTed Kremenek <kremenek@apple.com>
Wed, 21 May 2008 15:53:55 +0000 (15:53 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 21 May 2008 15:53:55 +0000 (15:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51379 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Stmt.h
lib/AST/Stmt.cpp

index 8b29617fa0aa9155c54d4d3a70db22d3c3b169ff..c854bb5640423a7de7e0f91d0a5dc26f94041d84 100644 (file)
@@ -146,6 +146,8 @@ public:
   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; }
 
index 6ed996613553018e1d7372d8de7db1ddcdd1f251..b12518fa78c0ebbad8399dc6228fe127c6dcaa62 100644 (file)
@@ -55,6 +55,11 @@ void Stmt::Destroy(ASTContext& C) {
   delete this;
 }
 
+void DeclStmt::Destroy(ASTContext& C) {
+  TheDecl->Destroy(C);
+  Stmt::Destroy(C);
+}
+
 void Stmt::PrintStats() {
   // Ensure the table is primed.
   getStmtInfoTableEntry(Stmt::NullStmtClass);