summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/TranslationUnit.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-05-21 05:33:10 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-05-21 05:33:10 +0000
commitb158b4a47b4455c3a9f92cee1ed46bfbcaf07669 (patch)
tree5b25a4df27c0bdd48ff003dc1bb11e9487880b9c /clang/lib/AST/TranslationUnit.cpp
parent0883bfb54195eec4f716d11ee35f3931c8665bdd (diff)
downloadbcm5719-llvm-b158b4a47b4455c3a9f92cee1ed46bfbcaf07669.tar.gz
bcm5719-llvm-b158b4a47b4455c3a9f92cee1ed46bfbcaf07669.zip
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. llvm-svn: 51364
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