summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/TranslationUnit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/TranslationUnit.cpp')
-rw-r--r--clang/lib/AST/TranslationUnit.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/TranslationUnit.cpp b/clang/lib/AST/TranslationUnit.cpp
index bfe6ee27fbe..f1505b06218 100644
--- a/clang/lib/AST/TranslationUnit.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud