[cfe-commits] r61015 - /cfe/trunk/lib/AST/DeclarationName.cpp
Nuno Lopes
nunoplopes at sapo.pt
Sun Dec 14 13:53:25 PST 2008
Author: nlopes
Date: Sun Dec 14 15:53:25 2008
New Revision: 61015
URL: http://llvm.org/viewvc/llvm-project?rev=61015&view=rev
Log:
dont call iterator::end() on every cycle and dont read already-deleted memory
Modified:
cfe/trunk/lib/AST/DeclarationName.cpp
Modified: cfe/trunk/lib/AST/DeclarationName.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclarationName.cpp?rev=61015&r1=61014&r2=61015&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclarationName.cpp (original)
+++ cfe/trunk/lib/AST/DeclarationName.cpp Sun Dec 14 15:53:25 2008
@@ -261,10 +261,11 @@
DeclarationNameTable::~DeclarationNameTable() {
llvm::FoldingSet<CXXSpecialName> *set =
static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
- llvm::FoldingSetIterator<CXXSpecialName> it = set->begin();
+ llvm::FoldingSetIterator<CXXSpecialName> I = set->begin(), E = set->end();
- while (it != set->end()) {
- delete &*it++;
+ while (I != E) {
+ CXXSpecialName *n = &*I++;
+ delete n;
}
delete set;
More information about the cfe-commits
mailing list