Avoid using an invalidated iterator.

llvm-svn: 148681
This commit is contained in:
Rafael Espindola 2012-01-23 05:07:16 +00:00
parent c53beeb5f6
commit 02f4d661a1

View File

@ -572,7 +572,11 @@ Archive::findModulesDefiningSymbols(std::set<std::string>& symbols,
SmallPtrSet<Module*, 16> Added;
for (std::set<std::string>::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)