diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2008-12-17 22:30:25 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2008-12-17 22:30:25 +0000 |
commit | b74668edbc119880eb0a7e563432314432cb775d (patch) | |
tree | 03456627ab3409a7b4c3346e31639fe8351ccae5 /lib/AST/ASTContext.cpp | |
parent | 5f76494cbcb8334043aa3805d853a016e0e71d01 (diff) |
fix a few more memory leaks: clean the ASTRecordLayouts, ASTObjCInterfaces and ASTRecordForInterface maps
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 4983d217c3..281b2cd5de 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -48,6 +48,33 @@ ASTContext::~ASTContext() { Types.pop_back(); } + { + llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator + I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); + while (I != E) { + ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second); + delete R; + } + } + + { + llvm::DenseMap<const ObjCInterfaceDecl*, const ASTRecordLayout*>::iterator + I = ASTObjCInterfaces.begin(), E = ASTObjCInterfaces.end(); + while (I != E) { + ASTRecordLayout *R = const_cast<ASTRecordLayout*>((I++)->second); + delete R; + } + } + + { + llvm::DenseMap<const ObjCInterfaceDecl*, const RecordDecl*>::iterator + I = ASTRecordForInterface.begin(), E = ASTRecordForInterface.end(); + while (I != E) { + RecordDecl *R = const_cast<RecordDecl*>((I++)->second); + R->Destroy(*this); + } + } + TUDecl->Destroy(*this); } |