[cfe-commits] r67867 - /cfe/trunk/lib/AST/ASTContext.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Mar 27 13:56:18 PDT 2009
Author: efriedma
Date: Fri Mar 27 15:56:17 2009
New Revision: 67867
URL: http://llvm.org/viewvc/llvm-project?rev=67867&view=rev
Log:
Fix test failures caused by reading memory after freeing it. My fix is
rather nasty, but I can't think of a better fix off the top of my head.
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=67867&r1=67866&r2=67867&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Mar 27 15:56:17 2009
@@ -81,8 +81,14 @@
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);
More information about the cfe-commits
mailing list