diff options
| author | Douglas Gregor <dgregor@apple.com> | 2008-10-27 12:50:38 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2008-10-27 12:50:38 +0000 |
| commit | 89ebcb9d8d4372c4cd06016cada925bf39b35efd (patch) | |
| tree | b9ee0242d03745ae2507ee42052e7a40c16a5d95 /clang/lib/AST | |
| parent | 36d4ade4be78855e6cba0e52ae70a2d307591353 (diff) | |
| download | bcm5719-llvm-89ebcb9d8d4372c4cd06016cada925bf39b35efd.tar.gz bcm5719-llvm-89ebcb9d8d4372c4cd06016cada925bf39b35efd.zip | |
When destroying a translation unit, deallocate its owned declarations in reverse order, because there may be dependencies among the declarations.
llvm-svn: 58244
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/TranslationUnit.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/TranslationUnit.cpp b/clang/lib/AST/TranslationUnit.cpp index 659aa064de1..42b7ceae1e7 100644 --- a/clang/lib/AST/TranslationUnit.cpp +++ b/clang/lib/AST/TranslationUnit.cpp @@ -33,7 +33,9 @@ enum { BasicMetadataBlock = 1, TranslationUnit::~TranslationUnit() { if (OwnsDecls) { llvm::DenseSet<Decl*> Killed; - for (iterator I=begin(), E=end(); I!=E; ++I) { + for (std::vector<Decl*>::reverse_iterator I=TopLevelDecls.rbegin(), + E=TopLevelDecls.rend(); + I!=E; ++I) { if (Killed.count(*I)) continue; Killed.insert(*I); |

