summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Stmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Overhaul of Stmt allocation:Ted Kremenek2009-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Made allocation of Stmt objects using vanilla new/delete a *compiler error* by making this new/delete "protected" within class Stmt. - Now the only way to allocate Stmt objects is by using the new operator that takes ASTContext& as an argument. This ensures that all Stmt nodes are allocated from the same (pool) allocator. - Naturally, these two changes required that *all* creation sites for AST nodes use new (ASTContext&). This is a large patch, but the majority of the changes are just this mechanical adjustment. - The above changes also mean that AST nodes can no longer be deallocated using 'delete'. Instead, one most do StmtObject->Destroy(ASTContext&) or do ASTContextObject.Deallocate(StmtObject) (the latter not running the 'Destroy' method). Along the way I also... - Made CompoundStmt allocate its array of Stmt* using the allocator in ASTContext (previously it used std::vector). There are a whole bunch of other Stmt classes that need to be similarly changed to ensure that all memory allocated for ASTs comes from the allocator in ASTContext. - Added a new smart pointer ExprOwningPtr to Sema.h. This replaces the uses of llvm::OwningPtr within Sema, as llvm::OwningPtr used 'delete' to free memory instead of a Stmt's 'Destroy' method. Big thanks to Doug Gregor for helping with the acrobatics of making 'new/delete' private and the new smart pointer ExprOwningPtr! llvm-svn: 63997
* Use ASTContext's allocator to deallocate Stmt objects instead of using ↵Ted Kremenek2009-02-061-3/+5
| | | | | | 'delete'. This fixes <rdar://problem/6561143>. llvm-svn: 63905
* Don't advance the statement iterator after we've deallocated the statementDouglas Gregor2009-01-161-2/+3
| | | | llvm-svn: 62306
* Full AST support and better Sema support for C++ try-catch.Sebastian Redl2008-12-221-1/+13
| | | | llvm-svn: 61346
* Partial AST and Sema support for C++ try-catch.Sebastian Redl2008-12-221-0/+20
| | | | llvm-svn: 61337
* Don't require us to manually number the statements and expressions in ↵Douglas Gregor2008-11-141-3/+3
| | | | | | StmtNodes.def. We don't need stable numbers yet, renumbering is a pain, and LAST_STMT had the wrong value anyway. llvm-svn: 59300
* - Move ExprIterator to Stmt.h so that it can be used by classes defined in ↵Ted Kremenek2008-10-271-2/+19
| | | | | | | | | Stmt.h - Implement child_begin() and child_end() for AsmStmt. Previously these had stub implementations that did not iterate over the input/output operands of an inline assembly statement. - Use ExprIterator for performing iteration over input/output operands. llvm-svn: 58261
* Migrate DeclStmt over to using a DeclGroup instead of a pointer to a ↵Ted Kremenek2008-10-071-9/+5
| | | | | | | | ScopedDecl*. This also removes the ugly hack needed in CFG.cpp for subclassing DeclStmt to create a DeclStmt with one Decl*. llvm-svn: 57275
* Add DeclStmt::hasSolitaryDecl() and DeclStmt::getSolitaryDecl()Ted Kremenek2008-10-061-1/+5
| | | | llvm-svn: 57204
* More #include cleaningDaniel Dunbar2008-08-111-2/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* remove spaces at eol to test commit accessNico Weber2008-08-051-23/+23
| | | | llvm-svn: 54381
* Added decl_iterator to DeclStmt to provide an abstract interface to iterate ↵Ted Kremenek2008-08-051-0/+5
| | | | | | | | over the ScopedDecls of a DeclStmt. Updated a few clients of DeclStmt::getNextDeclarator() to use decl_iterator instead. Will update other clients after additional testing. llvm-svn: 54368
* Fix more strict-aliasing warnings.Ted Kremenek2008-06-171-10/+14
| | | | | | Fix indentation of class declarations in ExprCXX.h llvm-svn: 52380
* - Move ObjC Expresssion AST's from Expr.h => ExprObjC.hSteve Naroff2008-05-291-0/+1
| | | | | | - #include ExprObjC.h in many places llvm-svn: 51703
* Always initialize NEXT_CATCH; fixes a Valgrind uninitialized read error Eli Friedman2008-05-251-3/+2
| | | | | | (originally reported in PR1682). llvm-svn: 51551
* Fix potential double-free.Ted Kremenek2008-05-211-1/+1
| | | | llvm-svn: 51381
* When destroying DeclStmts, also destroy the associated Decl (reclaim its ↵Ted Kremenek2008-05-211-0/+5
| | | | | | memory). llvm-svn: 51379
* Delete AST nodes, not just Decls.Ted Kremenek2008-05-201-1/+4
| | | | llvm-svn: 51298
* Try to plug some memory leaks...Ted Kremenek2008-05-201-2/+7
| | | | | | | | | | | | | | | | 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. llvm-svn: 51286
* Added Stmt::DestroyChildren, which will be used by the dstors of the ↵Ted Kremenek2008-05-191-0/+5
| | | | | | subclasses of Stmt to recursively delete their child AST nodes. llvm-svn: 51278
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+293
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud