mirror of
https://github.com/intel/llvm.git
synced 2026-02-05 04:19:25 +08:00
dont call iterator::end() on every cycle and dont read already-deleted memory
llvm-svn: 61015
This commit is contained in:
@@ -261,10 +261,11 @@ DeclarationNameTable::DeclarationNameTable() {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user