Avoid using an invalidated iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148681 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2012-01-23 05:07:16 +00:00
parent 603d6b56a2
commit 4254df3062

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)