aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-27 23:54:10 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-27 23:54:10 +0000
commit1ae0afaf14b7ce9bed33c1fe51077d01a313434d (patch)
tree2896b64b8f7fe741f10f4076ba308ed2c17f3aed
parent68c56dea080efd6db7a444de84c270bf4e2d4d2e (diff)
Better way to free NestedNameSpecifiers. Thanks, Chris
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67880 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTContext.cpp20
1 files changed, 5 insertions, 15 deletions
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<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);