forked from OSchip/llvm-project
[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
This commit is contained in:
parent
949e82216c
commit
8078a5a449
|
@ -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<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();
|
||||
|
|
Loading…
Reference in New Issue