]> granicus.if.org Git - clang/commit
Try to plug some memory leaks...
authorTed Kremenek <kremenek@apple.com>
Tue, 20 May 2008 00:43:19 +0000 (00:43 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 20 May 2008 00:43:19 +0000 (00:43 +0000)
commit27f8a28bee33bb0e857cfe1a61c281bbc234b338
tree5e0cc27d9b0948a8cd6bc99306411a03d35d49fe
parent017cbdfd5417d4d31ae6406421276f90269f75e2
Try to plug some memory leaks...

1) Sema::ParseAST now constructs a TranslationUnit object to own the top-level Decls, which releases the top-level Decls upon exiting ParseAST.

2) Bug fix: TranslationUnit::~TranslationUnit handles the case where a Decl is added more than once as a top-level Decl.

3) Decl::Destroy is now a virtual method, obviating the need for a special dispatch based on DeclKind.

3) FunctionDecl::Destroy now releases its Body using its Destroy method.

4) Added Stmt::Destroy and Stmt::DestroyChildren, which recursively delete the child ASTs of a Stmt and call their dstors.  We may need to special case dstor/Destroy methods for particular Stmt subclasses that own other dynamically allocated objects besides AST nodes.

5) REGRESSION: We temporarily are not deallocating attributes; a FIXME is provided.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51286 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Decl.h
include/clang/AST/DeclBase.h
include/clang/AST/DeclObjC.h
include/clang/AST/Stmt.h
lib/AST/Decl.cpp
lib/AST/Stmt.cpp
lib/AST/TranslationUnit.cpp
lib/Sema/ParseAST.cpp