[cfe-commits] r62205 - /cfe/trunk/lib/AST/DeclBase.cpp
Steve Naroff
snaroff at apple.com
Tue Jan 13 17:27:32 PST 2009
Author: snaroff
Date: Tue Jan 13 19:27:31 2009
New Revision: 62205
URL: http://llvm.org/viewvc/llvm-project?rev=62205&view=rev
Log:
Fix a subtle bug in DeclContext::DestroyDecls().
Modified:
cfe/trunk/lib/AST/DeclBase.cpp
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=62205&r1=62204&r2=62205&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Tue Jan 13 19:27:31 2009
@@ -88,6 +88,7 @@
case CXXRecord: return "CXXRecord";
case Enum: return "Enum";
case Block: return "Block";
+ case Field: return "Field";
}
}
@@ -405,10 +406,13 @@
}
void DeclContext::DestroyDecls(ASTContext &C) {
- for (decl_iterator D = decls_begin(); D != decls_end(); ++D) {
- // FIXME: assert that this condition holds.
- if ((*D)->getLexicalDeclContext() == this)
- (*D)->Destroy(C);
+ for (decl_iterator D = decls_begin(); D != decls_end(); ) {
+ // FIXME: assert that this condition holds.
+ if ((*D)->getLexicalDeclContext() == this)
+ // Advance the cursor (via NextDeclInScope) *before* doing the Destroy.
+ (*D++)->Destroy(C);
+ else
+ ++D;
}
}
More information about the cfe-commits
mailing list