From 8078a5a4497ee2b5a18e5694557fe61a9082755e Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 16 Jan 2013 17:42:07 +0000 Subject: [PATCH] [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. llvm-svn: 172629 --- clang/lib/Serialization/ASTReader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 5b1c5cd..d71bce5 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -6854,11 +6854,13 @@ void ASTReader::finishPendingActions() { // 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 &MacroIDs = PMIt->second; + IdentifierInfo *II = PMIt->first; + SmallVector MacroIDs; + MacroIDs.swap(PMIt->second); for (SmallVectorImpl::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(); -- 2.7.4