diff options
| author | Ted Kremenek <kremenek@apple.com> | 2010-03-08 20:56:29 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2010-03-08 20:56:29 +0000 |
| commit | c3015a914fc8558ddfcd5e7c581808c5c8eae6cf (patch) | |
| tree | 59a1414347c2bb8d9f77b4e60f8b2fd81b090b01 /clang/lib/AST/ASTContext.cpp | |
| parent | d3cbaa1ddfa4f3a07b90ac87dff54e0bb9f06927 (diff) | |
| download | bcm5719-llvm-c3015a914fc8558ddfcd5e7c581808c5c8eae6cf.tar.gz bcm5719-llvm-c3015a914fc8558ddfcd5e7c581808c5c8eae6cf.zip | |
Allocate ASTRecordLayout objects using the allocator associated with ASTContext.
This allows them to be allocated using a BumpPtrAllocated
in the common case.
llvm-svn: 97978
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index d8c1c848582..e2c80a6da59 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -78,21 +78,21 @@ ASTContext::~ASTContext() { // Increment in loop to prevent using deallocated memory. Deallocate(&*I++); } - } - for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator - I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) { - // Increment in loop to prevent using deallocated memory. - ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second); - delete R; - } + for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator + I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) { + // Increment in loop to prevent using deallocated memory. + if (ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second)) + R->Destroy(*this); + } - for (llvm::DenseMap<const ObjCContainerDecl*, - const ASTRecordLayout*>::iterator - I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; ) { - // Increment in loop to prevent using deallocated memory. - ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second); - delete R; + for (llvm::DenseMap<const ObjCContainerDecl*, + const ASTRecordLayout*>::iterator + I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; ) { + // Increment in loop to prevent using deallocated memory. + if (ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second)) + R->Destroy(*this); + } } // Destroy nested-name-specifiers. |

