diff options
Diffstat (limited to 'lib/AST/TranslationUnit.cpp')
-rw-r--r-- | lib/AST/TranslationUnit.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/AST/TranslationUnit.cpp b/lib/AST/TranslationUnit.cpp index 9d7758648d..bfe6ee27fb 100644 --- a/lib/AST/TranslationUnit.cpp +++ b/lib/AST/TranslationUnit.cpp @@ -31,21 +31,18 @@ enum { BasicMetadataBlock = 1, DeclsBlock = 3 }; TranslationUnit::~TranslationUnit() { - - llvm::DenseSet<Decl*> Killed; - - for (iterator I=begin(), E=end(); I!=E; ++I) { - if (Killed.count(*I)) continue; - - Killed.insert(*I); - (*I)->Destroy(*Context); - } - if (OwnsMetaData && Context) { + llvm::DenseSet<Decl*> Killed; + for (iterator I=begin(), E=end(); I!=E; ++I) { + if (Killed.count(*I)) continue; + + Killed.insert(*I); + (*I)->Destroy(*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); |