aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Archive
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-01-23 05:07:16 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-01-23 05:07:16 +0000
commit4254df306268edb7f47a77eecd1f8b59f1b17fe0 (patch)
tree33f937c00eee1b844fe63560db3e8f23d7ba84e1 /lib/Archive
parent603d6b56a2b72358e7b599aab743beb44823d76c (diff)
downloadexternal_llvm-4254df306268edb7f47a77eecd1f8b59f1b17fe0.zip
external_llvm-4254df306268edb7f47a77eecd1f8b59f1b17fe0.tar.gz
external_llvm-4254df306268edb7f47a77eecd1f8b59f1b17fe0.tar.bz2
Avoid using an invalidated iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Archive')
-rw-r--r--lib/Archive/ArchiveReader.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index 0c89baa..a78c0f5 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -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)