From 02f4d661a14cd032dbd5c8248731ffb44594da62 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. llvm-svn: 148681 --- 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)