[cfe-commits] r172629 - /cfe/trunk/lib/Serialization/ASTReader.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Jan 16 09:42:08 PST 2013


Author: akirtzidis
Date: Wed Jan 16 11:42:07 2013
New Revision: 172629

URL: http://llvm.org/viewvc/llvm-project?rev=172629&view=rev
Log:
[PCH/Modules] The iterator may become invalidated because a new macro can be added
while deserializing a macro, make sure to copy/move what we need from it.

Fixes clang-x86_64-debian-fast bot.

Modified:
    cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=172629&r1=172628&r2=172629&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Jan 16 11:42:07 2013
@@ -6854,11 +6854,13 @@
     // Note that new macros may be added while deserializing a macro.
     for (unsigned I = 0; I != PendingMacroIDs.size(); ++I) {
       PendingMacroIDsMap::iterator PMIt = PendingMacroIDs.begin() + I;
-      SmallVector<serialization::MacroID, 2> &MacroIDs = PMIt->second;
+      IdentifierInfo *II = PMIt->first;
+      SmallVector<serialization::MacroID, 2> MacroIDs;
+      MacroIDs.swap(PMIt->second);
       for (SmallVectorImpl<serialization::MacroID>::iterator
              MIt = MacroIDs.begin(), ME = MacroIDs.end(); MIt != ME; ++MIt) {
         MacroInfo *MI = getMacro(*MIt);
-        PP.addLoadedMacroInfo(PMIt->first, MI);
+        PP.addLoadedMacroInfo(II, MI);
       }
     }
     PendingMacroIDs.clear();





More information about the cfe-commits mailing list