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 | 3dda64ec0fad2fa60d882565d135ff598897fa9d (patch) | |
tree | 5af4d49fbb89e1121682d04ba281bfccc2d47692 /lib/AST/TranslationUnit.cpp | |
parent | 4a1513e535f9db2027c60bc96a4276435743857c (diff) |
When destroying a translation unit, deallocate its owned declarations in reverse order, because there may be dependencies among the declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/TranslationUnit.cpp')
-rw-r--r-- | lib/AST/TranslationUnit.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/AST/TranslationUnit.cpp b/lib/AST/TranslationUnit.cpp index 659aa064de..42b7ceae1e 100644 --- a/lib/AST/TranslationUnit.cpp +++ b/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); |