From: Douglas Gregor Date: Fri, 27 Mar 2009 23:54:10 +0000 (+0000) Subject: Better way to free NestedNameSpecifiers. Thanks, Chris X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ae0afaf14b7ce9bed33c1fe51077d01a313434d;p=clang Better way to free NestedNameSpecifiers. Thanks, Chris git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67880 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 76671576ce..2fc6a7d527 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -78,22 +78,12 @@ ASTContext::~ASTContext() { } // Destroy nested-name-specifiers. - llvm::SmallVector NestedNameSpecs; - { - for (llvm::FoldingSet::iterator - NNS = NestedNameSpecifiers.begin(), - NNSEnd = NestedNameSpecifiers.end(); - NNS != NNSEnd; - ++NNS) - NestedNameSpecs.push_back(&*NNS); - } - NestedNameSpecifiers.clear(); - for (llvm::SmallVector::iterator - NNS = NestedNameSpecs.begin(), - NNSEnd = NestedNameSpecs.end(); + for (llvm::FoldingSet::iterator + NNS = NestedNameSpecifiers.begin(), + NNSEnd = NestedNameSpecifiers.end(); NNS != NNSEnd; - ++NNS) - (*NNS)->Destroy(*this); + /* Increment in loop */) + (*NNS++).Destroy(*this); if (GlobalNestedNameSpecifier) GlobalNestedNameSpecifier->Destroy(*this);