diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 84976a02944..e433769a9ce 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -81,8 +81,14 @@ ASTContext::~ASTContext() { for (llvm::FoldingSet<NestedNameSpecifier>::iterator NNS = NestedNameSpecifiers.begin(), NNSEnd = NestedNameSpecifiers.end(); - NNS != NNSEnd; ++NNS) - NNS->Destroy(*this); + NNS != NNSEnd; ) { + // This loop iterates, then destroys so that it doesn't cause invalid + // reads. + // FIXME: Find a less fragile way to do this! + NestedNameSpecifier* N = &*NNS; + ++NNS; + N->Destroy(*this); + } if (GlobalNestedNameSpecifier) GlobalNestedNameSpecifier->Destroy(*this); |