[cfe-commits] r67880 - /cfe/trunk/lib/AST/ASTContext.cpp

Douglas Gregor dgregor at apple.com
Fri Mar 27 16:54:11 PDT 2009


Author: dgregor
Date: Fri Mar 27 18:54:10 2009
New Revision: 67880

URL: http://llvm.org/viewvc/llvm-project?rev=67880&view=rev
Log:
Better way to free NestedNameSpecifiers. Thanks, Chris

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=67880&r1=67879&r2=67880&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Mar 27 18:54:10 2009
@@ -78,22 +78,12 @@
   }
 
   // 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);





More information about the cfe-commits mailing list