When destroying DeclStmts, also destroy the associated Decl (reclaim its memory).

llvm-svn: 51379
This commit is contained in:
Ted Kremenek 2008-05-21 15:53:55 +00:00
parent b120ff1b95
commit 512d9412ec
2 changed files with 7 additions and 0 deletions

View 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; }

View 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);