diff options
| author | Ted Kremenek <kremenek@apple.com> | 2009-02-07 01:47:29 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2009-02-07 01:47:29 +0000 |
| commit | 5a201951cafa73ca51fc58c4a380b4f0cab38676 (patch) | |
| tree | 74c8aa1764c05d4ef05fc85de0e3c9581bcd31fa /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
| parent | 773ca057b10ae87c05d9f5206e24ee07d3ed4f70 (diff) | |
| download | bcm5719-llvm-5a201951cafa73ca51fc58c4a380b4f0cab38676.tar.gz bcm5719-llvm-5a201951cafa73ca51fc58c4a380b4f0cab38676.zip | |
Overhaul of Stmt allocation:
- 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
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
0 files changed, 0 insertions, 0 deletions

