diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-05-21 05:33:10 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-05-21 05:33:10 +0000 |
commit | 5f1adf8fb4b41988a8715492cc97c62873d25969 (patch) | |
tree | 4933042e6065e9a0caa4df00a34ffb2e2b6b673b /lib/AST/TranslationUnit.cpp | |
parent | b0c0554bd62689f48a1c42fc46c78c531cdb3cbf (diff) |
Fix the destruction "properly" in the sense that we actually destroy the
ASTs. This is a hack, but I haven't considered how we really
want to do this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51364 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/TranslationUnit.cpp')
-rw-r--r-- | lib/AST/TranslationUnit.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/AST/TranslationUnit.cpp b/lib/AST/TranslationUnit.cpp index bfe6ee27fb..f1505b0621 100644 --- a/lib/AST/TranslationUnit.cpp +++ b/lib/AST/TranslationUnit.cpp @@ -31,7 +31,7 @@ enum { BasicMetadataBlock = 1, DeclsBlock = 3 }; TranslationUnit::~TranslationUnit() { - if (OwnsMetaData && Context) { + if (OwnsDecls) { llvm::DenseSet<Decl*> Killed; for (iterator I=begin(), E=end(); I!=E; ++I) { if (Killed.count(*I)) continue; @@ -39,10 +39,13 @@ TranslationUnit::~TranslationUnit() { Killed.insert(*I); (*I)->Destroy(*Context); } + } + if (OwnsMetaData && Context) { // The ASTContext object has the sole references to the IdentifierTable // Selectors, and the Target information. Go and delete them, since // the TranslationUnit effectively owns them. + delete &(Context->Idents); delete &(Context->Selectors); delete &(Context->Target); |