From 4254df306268edb7f47a77eecd1f8b59f1b17fe0 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 23 Jan 2012 05:07:16 +0000 Subject: [PATCH] Avoid using an invalidated iterator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148681 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Archive/ArchiveReader.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp index 0c89baa0d7d..a78c0f59bc0 100644 --- a/lib/Archive/ArchiveReader.cpp +++ b/lib/Archive/ArchiveReader.cpp @@ -572,7 +572,11 @@ Archive::findModulesDefiningSymbols(std::set& symbols, SmallPtrSet Added; for (std::set::iterator I=symbols.begin(), - E=symbols.end(); I != E; ++I) { + Next = I, + E=symbols.end(); I != E; I = Next) { + // Increment Next before we invalidate it. + ++Next; + // See if this symbol exists Module* m = findModuleDefiningSymbol(*I,error); if (!m)