[ORC] Replace lookupFlags in JITSymbolResolver with getResponsibilitySet.
The new method name/behavior more closely models the way it was being used.
It also fixes an assertion that can occur when using the new ORC Core APIs,
where flags alone don't necessarily provide enough context to decide whether
the caller is responsible for materializing a given symbol (which was always
the reason this API existed).
The default implementation of getResponsibilitySet uses lookupFlags to determine
responsibility as before, so existing JITSymbolResolvers should continue to
work.
llvm-svn: 340874
diff --git a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
index 1dfa90a..f82f5ec 100644
--- a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
@@ -44,27 +44,13 @@
return Result;
}
- Expected<LookupFlagsResult> lookupFlags(const LookupSet &Symbols) {
- auto &ES = MR.getTargetJITDylib().getExecutionSession();
+ Expected<LookupSet> getResponsibilitySet(const LookupSet &Symbols) {
+ LookupSet Result;
- SymbolNameSet InternedSymbols;
-
- for (auto &S : Symbols)
- InternedSymbols.insert(ES.getSymbolStringPool().intern(S));
-
- SymbolFlagsMap InternedResult;
- MR.getTargetJITDylib().withSearchOrderDo([&](const JITDylibList &JDs) {
- // An empty search order is pathalogical, but allowed.
- if (JDs.empty())
- return;
-
- assert(JDs.front() && "VSOList entry can not be null");
- InternedResult = JDs.front()->lookupFlags(InternedSymbols);
- });
-
- LookupFlagsResult Result;
- for (auto &KV : InternedResult)
- Result[*KV.first] = std::move(KV.second);
+ for (auto &KV : MR.getSymbols()) {
+ if (Symbols.count(*KV.first))
+ Result.insert(*KV.first);
+ }
return Result;
}