[Orc] Fix iterator usage after remove

Differential Revision: https://reviews.llvm.org/D69805
This commit is contained in:
Alexandre Ganea 2019-11-06 17:11:12 -05:00
parent f0f73ed8b0
commit 007d173e2e
1 changed files with 4 additions and 1 deletions

View File

@ -1228,11 +1228,14 @@ void JITDylib::notifyFailed(FailedSymbolsWorklist Worklist) {
MI.UnemittedDependencies.clear();
// Collect queries to be failed for this MII.
AsynchronousSymbolQueryList ToDetach;
for (auto &Q : MII->second.pendingQueries()) {
// Add the query to the list to be failed and detach it.
FailedQueries.insert(Q);
Q->detach();
ToDetach.push_back(Q);
}
for (auto &Q : ToDetach)
Q->detach();
assert(MI.Dependants.empty() &&
"Can not delete MaterializingInfo with dependants still attached");