[llvm-commits] [llvm] r148681 - /llvm/trunk/lib/Archive/ArchiveReader.cpp

Rafael Espindola rafael.espindola at gmail.com
Sun Jan 22 21:07:16 PST 2012


Author: rafael
Date: Sun Jan 22 23:07:16 2012
New Revision: 148681

URL: http://llvm.org/viewvc/llvm-project?rev=148681&view=rev
Log:
Avoid using an invalidated iterator.

Modified:
    llvm/trunk/lib/Archive/ArchiveReader.cpp

Modified: llvm/trunk/lib/Archive/ArchiveReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveReader.cpp?rev=148681&r1=148680&r2=148681&view=diff
==============================================================================
--- llvm/trunk/lib/Archive/ArchiveReader.cpp (original)
+++ llvm/trunk/lib/Archive/ArchiveReader.cpp Sun Jan 22 23:07:16 2012
@@ -572,7 +572,11 @@
 
   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)





More information about the llvm-commits mailing list