]> granicus.if.org Git - clang/commitdiff
Better way to free NestedNameSpecifiers. Thanks, Chris
authorDouglas Gregor <dgregor@apple.com>
Fri, 27 Mar 2009 23:54:10 +0000 (23:54 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 27 Mar 2009 23:54:10 +0000 (23:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67880 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp

index 76671576cee9d093289e14772b3a3271515e7df7..2fc6a7d5273f6230a9a992e941c95d37963afd6c 100644 (file)
@@ -78,22 +78,12 @@ ASTContext::~ASTContext() {
   }
 
   // Destroy nested-name-specifiers.
-  llvm::SmallVector<NestedNameSpecifier *, 16> NestedNameSpecs; 
-  {
-    for (llvm::FoldingSet<NestedNameSpecifier>::iterator
-           NNS = NestedNameSpecifiers.begin(),
-           NNSEnd = NestedNameSpecifiers.end(); 
-         NNS != NNSEnd; 
-         ++NNS)
-      NestedNameSpecs.push_back(&*NNS);
-  }
-  NestedNameSpecifiers.clear();
-  for (llvm::SmallVector<NestedNameSpecifier *, 16>::iterator
-         NNS = NestedNameSpecs.begin(),
-         NNSEnd = NestedNameSpecs.end(); 
+  for (llvm::FoldingSet<NestedNameSpecifier>::iterator
+         NNS = NestedNameSpecifiers.begin(),
+         NNSEnd = NestedNameSpecifiers.end(); 
        NNS != NNSEnd; 
-       ++NNS)
-    (*NNS)->Destroy(*this);
+       /* Increment in loop */)
+    (*NNS++).Destroy(*this);
 
   if (GlobalNestedNameSpecifier)
     GlobalNestedNameSpecifier->Destroy(*this);