[llvm] r325179 - [ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 14:12:57 PST 2018
Author: lhames
Date: Wed Feb 14 14:12:56 2018
New Revision: 325179
URL: http://llvm.org/viewvc/llvm-project?rev=325179&view=rev
Log:
[ORC] Switch to shared_ptr ownership for AsynchronousSymbolQueries.
Queries need to stay alive until each owner has set the values they are
responsible for.
Modified:
llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/Legacy.h
llvm/trunk/include/llvm/ExecutionEngine/Orc/NullResolver.h
llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
llvm/trunk/lib/ExecutionEngine/Orc/Legacy.cpp
llvm/trunk/lib/ExecutionEngine/Orc/NullResolver.cpp
llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
llvm/trunk/tools/lli/OrcLazyJIT.h
llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
llvm/trunk/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp
llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h Wed Feb 14 14:12:56 2018
@@ -492,10 +492,10 @@ private:
return LD.BackingResolver->lookupFlags(SymbolFlags,
*NotFoundViaLegacyLookup);
},
- [&LD, LegacyLookup](AsynchronousSymbolQuery &Query,
+ [&LD, LegacyLookup](std::shared_ptr<AsynchronousSymbolQuery> Query,
SymbolNameSet Symbols) {
auto NotFoundViaLegacyLookup =
- lookupWithLegacyFn(Query, Symbols, LegacyLookup);
+ lookupWithLegacyFn(*Query, Symbols, LegacyLookup);
return LD.BackingResolver->lookup(Query, NotFoundViaLegacyLookup);
});
@@ -649,9 +649,10 @@ private:
return LD.BackingResolver->lookupFlags(SymbolFlags,
*NotFoundViaLegacyLookup);
},
- [&LD, LegacyLookup](AsynchronousSymbolQuery &Q, SymbolNameSet Symbols) {
+ [&LD, LegacyLookup](std::shared_ptr<AsynchronousSymbolQuery> Q,
+ SymbolNameSet Symbols) {
auto NotFoundViaLegacyLookup =
- lookupWithLegacyFn(Q, Symbols, LegacyLookup);
+ lookupWithLegacyFn(*Q, Symbols, LegacyLookup);
return LD.BackingResolver->lookup(Q,
std::move(NotFoundViaLegacyLookup));
});
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h Wed Feb 14 14:12:56 2018
@@ -107,7 +107,7 @@ public:
/// @brief For each symbol in Symbols that can be found, assigns that symbols
/// value in Query. Returns the set of symbols that could not be found.
- virtual SymbolNameSet lookup(AsynchronousSymbolQuery &Query,
+ virtual SymbolNameSet lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
SymbolNameSet Symbols) = 0;
private:
@@ -129,9 +129,9 @@ public:
return LookupFlags(Flags, Symbols);
}
- SymbolNameSet lookup(AsynchronousSymbolQuery &Query,
+ SymbolNameSet lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
SymbolNameSet Symbols) final {
- return Lookup(Query, std::move(Symbols));
+ return Lookup(std::move(Query), std::move(Symbols));
}
private:
@@ -258,23 +258,26 @@ public:
///
/// Any symbols not found in this VSO will be returned in the
/// UnresolvedSymbols field of the LookupResult.
- LookupResult lookup(AsynchronousSymbolQuery &Query, SymbolNameSet Symbols);
+ LookupResult lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
+ SymbolNameSet Symbols);
private:
class MaterializationInfo {
public:
- MaterializationInfo(JITSymbolFlags Flags, AsynchronousSymbolQuery &Query);
+ MaterializationInfo(JITSymbolFlags Flags,
+ std::shared_ptr<AsynchronousSymbolQuery> Query);
JITSymbolFlags getFlags() const;
JITTargetAddress getAddress() const;
- void query(SymbolStringPtr Name, AsynchronousSymbolQuery &Query);
+ void query(SymbolStringPtr Name,
+ std::shared_ptr<AsynchronousSymbolQuery> Query);
void resolve(SymbolStringPtr Name, JITEvaluatedSymbol Sym);
void finalize();
private:
JITSymbolFlags Flags;
JITTargetAddress Address = 0;
- std::vector<AsynchronousSymbolQuery *> PendingResolution;
- std::vector<AsynchronousSymbolQuery *> PendingFinalization;
+ std::vector<std::shared_ptr<AsynchronousSymbolQuery>> PendingResolution;
+ std::vector<std::shared_ptr<AsynchronousSymbolQuery>> PendingFinalization;
};
class SymbolTableEntry {
@@ -286,7 +289,8 @@ private:
JITSymbolFlags getFlags() const;
void replaceWithSource(VSO &V, SymbolStringPtr Name, JITSymbolFlags Flags,
SymbolSource &NewSource);
- SymbolSource *query(SymbolStringPtr Name, AsynchronousSymbolQuery &Query);
+ SymbolSource *query(SymbolStringPtr Name,
+ std::shared_ptr<AsynchronousSymbolQuery> Query);
void resolve(VSO &V, SymbolStringPtr Name, JITEvaluatedSymbol Sym);
void finalize();
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/Legacy.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/Legacy.h?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/Legacy.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Legacy.h Wed Feb 14 14:12:56 2018
@@ -114,9 +114,9 @@ public:
}
}
- SymbolNameSet lookup(AsynchronousSymbolQuery &Query,
+ SymbolNameSet lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
SymbolNameSet Symbols) final {
- return lookupWithLegacyFn(Query, Symbols, LegacyLookup);
+ return lookupWithLegacyFn(*Query, Symbols, LegacyLookup);
}
private:
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/NullResolver.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/NullResolver.h?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/NullResolver.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/NullResolver.h Wed Feb 14 14:12:56 2018
@@ -26,7 +26,7 @@ public:
SymbolNameSet lookupFlags(SymbolFlagsMap &Flags,
const SymbolNameSet &Symbols) override;
- SymbolNameSet lookup(AsynchronousSymbolQuery &Query,
+ SymbolNameSet lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
SymbolNameSet Symbols) override;
};
Modified: llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp Wed Feb 14 14:12:56 2018
@@ -64,9 +64,9 @@ void AsynchronousSymbolQuery::notifySymb
NotifySymbolsReady(Error::success());
}
-VSO::MaterializationInfo::MaterializationInfo(JITSymbolFlags Flags,
- AsynchronousSymbolQuery &Query)
- : Flags(std::move(Flags)), PendingResolution({&Query}) {}
+VSO::MaterializationInfo::MaterializationInfo(
+ JITSymbolFlags Flags, std::shared_ptr<AsynchronousSymbolQuery> Query)
+ : Flags(std::move(Flags)), PendingResolution({std::move(Query)}) {}
JITSymbolFlags VSO::MaterializationInfo::getFlags() const { return Flags; }
@@ -74,13 +74,13 @@ JITTargetAddress VSO::MaterializationInf
return Address;
}
-void VSO::MaterializationInfo::query(SymbolStringPtr Name,
- AsynchronousSymbolQuery &Query) {
+void VSO::MaterializationInfo::query(
+ SymbolStringPtr Name, std::shared_ptr<AsynchronousSymbolQuery> Query) {
if (Address != 0) {
- Query.setDefinition(Name, JITEvaluatedSymbol(Address, Flags));
- PendingFinalization.push_back(&Query);
+ Query->setDefinition(Name, JITEvaluatedSymbol(Address, Flags));
+ PendingFinalization.push_back(std::move(Query));
} else
- PendingResolution.push_back(&Query);
+ PendingResolution.push_back(std::move(Query));
}
void VSO::MaterializationInfo::resolve(SymbolStringPtr Name,
@@ -88,15 +88,15 @@ void VSO::MaterializationInfo::resolve(S
// FIXME: Sanity check flags?
Flags = Sym.getFlags();
Address = Sym.getAddress();
- for (auto *Query : PendingResolution) {
+ for (auto &Query : PendingResolution) {
Query->setDefinition(Name, std::move(Sym));
- PendingFinalization.push_back(Query);
+ PendingFinalization.push_back(std::move(Query));
}
PendingResolution = {};
}
void VSO::MaterializationInfo::finalize() {
- for (auto *Query : PendingFinalization)
+ for (auto &Query : PendingFinalization)
Query->notifySymbolFinalized();
PendingFinalization = {};
}
@@ -140,19 +140,20 @@ void VSO::SymbolTableEntry::replaceWithS
this->Source = &NewSource;
}
-SymbolSource *VSO::SymbolTableEntry::query(SymbolStringPtr Name,
- AsynchronousSymbolQuery &Query) {
+SymbolSource *
+VSO::SymbolTableEntry::query(SymbolStringPtr Name,
+ std::shared_ptr<AsynchronousSymbolQuery> Query) {
if (Flags.isMaterializing()) {
- MatInfo->query(std::move(Name), Query);
+ MatInfo->query(std::move(Name), std::move(Query));
return nullptr;
} else if (Flags.isMaterialized()) {
- Query.setDefinition(std::move(Name), JITEvaluatedSymbol(Address, Flags));
- Query.notifySymbolFinalized();
+ Query->setDefinition(std::move(Name), JITEvaluatedSymbol(Address, Flags));
+ Query->notifySymbolFinalized();
return nullptr;
}
SymbolSource *S = Source;
new (&MatInfo) std::unique_ptr<MaterializationInfo>(
- llvm::make_unique<MaterializationInfo>(Flags, Query));
+ llvm::make_unique<MaterializationInfo>(Flags, std::move(Query)));
Flags |= JITSymbolFlags::Materializing;
return S;
}
@@ -307,7 +308,7 @@ SymbolNameSet VSO::lookupFlags(SymbolFla
return Names;
}
-VSO::LookupResult VSO::lookup(AsynchronousSymbolQuery &Query,
+VSO::LookupResult VSO::lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
SymbolNameSet Names) {
SourceWorkMap MaterializationWork;
Modified: llvm/trunk/lib/ExecutionEngine/Orc/Legacy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Legacy.cpp?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Legacy.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/Legacy.cpp Wed Feb 14 14:12:56 2018
@@ -41,9 +41,10 @@ JITSymbolResolverAdapter::lookup(const L
"legacy resolver received on-ready error:\n");
};
- AsynchronousSymbolQuery Query(InternedSymbols, OnResolve, OnReady);
+ auto Query = std::make_shared<AsynchronousSymbolQuery>(InternedSymbols,
+ OnResolve, OnReady);
- auto UnresolvedSymbols = R.lookup(Query, InternedSymbols);
+ auto UnresolvedSymbols = R.lookup(std::move(Query), InternedSymbols);
if (!UnresolvedSymbols.empty()) {
std::string ErrorMsg = "Unresolved symbols: ";
Modified: llvm/trunk/lib/ExecutionEngine/Orc/NullResolver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/NullResolver.cpp?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/NullResolver.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/NullResolver.cpp Wed Feb 14 14:12:56 2018
@@ -19,8 +19,9 @@ SymbolNameSet NullResolver::lookupFlags(
return Symbols;
}
-SymbolNameSet NullResolver::lookup(AsynchronousSymbolQuery &Query,
- SymbolNameSet Symbols) {
+SymbolNameSet
+NullResolver::lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
+ SymbolNameSet Symbols) {
assert(Symbols.empty() && "Null resolver: Symbols must be empty");
return Symbols;
}
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h Wed Feb 14 14:12:56 2018
@@ -147,20 +147,21 @@ private:
return SymbolsNotFound;
}
- orc::SymbolNameSet lookup(orc::AsynchronousSymbolQuery &Query,
- orc::SymbolNameSet Symbols) override {
+ orc::SymbolNameSet
+ lookup(std::shared_ptr<orc::AsynchronousSymbolQuery> Query,
+ orc::SymbolNameSet Symbols) override {
orc::SymbolNameSet UnresolvedSymbols;
for (auto &S : Symbols) {
if (auto Sym = findSymbol(*S)) {
if (auto Addr = Sym.getAddress())
- Query.setDefinition(S, JITEvaluatedSymbol(*Addr, Sym.getFlags()));
+ Query->setDefinition(S, JITEvaluatedSymbol(*Addr, Sym.getFlags()));
else {
- Query.setFailed(Addr.takeError());
+ Query->setFailed(Addr.takeError());
return orc::SymbolNameSet();
}
} else if (auto Err = Sym.takeError()) {
- Query.setFailed(std::move(Err));
+ Query->setFailed(std::move(Err));
return orc::SymbolNameSet();
} else
UnresolvedSymbols.insert(S);
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h Wed Feb 14 14:12:56 2018
@@ -166,32 +166,32 @@ class OrcMCJITReplacement : public Execu
return UnresolvedSymbols;
}
- SymbolNameSet lookup(AsynchronousSymbolQuery &Query,
+ SymbolNameSet lookup(std::shared_ptr<AsynchronousSymbolQuery> Query,
SymbolNameSet Symbols) override {
SymbolNameSet UnresolvedSymbols;
for (auto &S : Symbols) {
if (auto Sym = M.findMangledSymbol(*S)) {
if (auto Addr = Sym.getAddress())
- Query.setDefinition(S, JITEvaluatedSymbol(*Addr, Sym.getFlags()));
+ Query->setDefinition(S, JITEvaluatedSymbol(*Addr, Sym.getFlags()));
else {
- Query.setFailed(Addr.takeError());
+ Query->setFailed(Addr.takeError());
return SymbolNameSet();
}
} else if (auto Err = Sym.takeError()) {
- Query.setFailed(std::move(Err));
+ Query->setFailed(std::move(Err));
return SymbolNameSet();
} else {
if (auto Sym2 = M.ClientResolver->findSymbol(*S)) {
if (auto Addr = Sym2.getAddress())
- Query.setDefinition(S,
- JITEvaluatedSymbol(*Addr, Sym2.getFlags()));
+ Query->setDefinition(S,
+ JITEvaluatedSymbol(*Addr, Sym2.getFlags()));
else {
- Query.setFailed(Addr.takeError());
+ Query->setFailed(Addr.takeError());
return SymbolNameSet();
}
} else if (auto Err = Sym2.takeError()) {
- Query.setFailed(std::move(Err));
+ Query->setFailed(std::move(Err));
return SymbolNameSet();
} else
UnresolvedSymbols.insert(S);
Modified: llvm/trunk/tools/lli/OrcLazyJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.h?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/tools/lli/OrcLazyJIT.h (original)
+++ llvm/trunk/tools/lli/OrcLazyJIT.h Wed Feb 14 14:12:56 2018
@@ -174,9 +174,9 @@ public:
}
return std::move(*NotFoundViaLegacyLookup);
},
- [LegacyLookup](orc::AsynchronousSymbolQuery &Query,
+ [LegacyLookup](std::shared_ptr<orc::AsynchronousSymbolQuery> Query,
orc::SymbolNameSet Symbols) {
- return lookupWithLegacyFn(Query, Symbols, LegacyLookup);
+ return lookupWithLegacyFn(*Query, Symbols, LegacyLookup);
});
// Add the module to the JIT.
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp Wed Feb 14 14:12:56 2018
@@ -118,7 +118,8 @@ TEST(CoreAPIsTest, SimpleAsynchronousSym
OnReadyRun = true;
};
- AsynchronousSymbolQuery Q(Names, OnResolution, OnReady);
+ auto Q =
+ std::make_shared<AsynchronousSymbolQuery>(Names, OnResolution, OnReady);
VSO V;
SymbolMap Defs;
@@ -241,9 +242,10 @@ TEST(CoreAPIsTest, AddAndMaterializeLazy
OnReadyRun = true;
};
- AsynchronousSymbolQuery Q(Names, OnResolution, OnReady);
+ auto Q =
+ std::make_shared<AsynchronousSymbolQuery>(Names, OnResolution, OnReady);
- auto LR = V.lookup(Q, Names);
+ auto LR = V.lookup(std::move(Q), Names);
for (auto &SWKV : LR.MaterializationWork)
cantFail(SWKV.first->materialize(V, std::move(SWKV.second)));
@@ -271,8 +273,8 @@ TEST(CoreAPIsTest, TestLambdaSymbolResol
[&](SymbolFlagsMap &SymbolFlags, const SymbolNameSet &Symbols) {
return V.lookupFlags(SymbolFlags, Symbols);
},
- [&](AsynchronousSymbolQuery &Q, SymbolNameSet Symbols) {
- auto LR = V.lookup(Q, Symbols);
+ [&](std::shared_ptr<AsynchronousSymbolQuery> Q, SymbolNameSet Symbols) {
+ auto LR = V.lookup(std::move(Q), Symbols);
assert(LR.MaterializationWork.empty() &&
"Test generated unexpected materialization "
"work?");
@@ -314,8 +316,9 @@ TEST(CoreAPIsTest, TestLambdaSymbolResol
EXPECT_FALSE(!!Err) << "Finalization should never fail in this test";
};
- AsynchronousSymbolQuery Q({Foo, Bar}, OnResolved, OnReady);
- auto Unresolved = Resolver->lookup(Q, Symbols);
+ auto Q = std::make_shared<AsynchronousSymbolQuery>(SymbolNameSet({Foo, Bar}),
+ OnResolved, OnReady);
+ auto Unresolved = Resolver->lookup(std::move(Q), Symbols);
EXPECT_EQ(Unresolved.size(), 1U) << "Expected one unresolved symbol";
EXPECT_EQ(Unresolved.count(Baz), 1U) << "Expected baz to not be resolved";
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/LegacyAPIInteropTest.cpp Wed Feb 14 14:12:56 2018
@@ -14,31 +14,6 @@
using namespace llvm;
using namespace llvm::orc;
-class SimpleORCResolver : public SymbolResolver {
-public:
- using LookupFlagsFn = std::function<SymbolNameSet(SymbolFlagsMap &SymbolFlags,
- const SymbolNameSet &)>;
- using LookupFn = std::function<SymbolNameSet(AsynchronousSymbolQuery &Q,
- SymbolNameSet Symbols)>;
-
- SimpleORCResolver(LookupFlagsFn LookupFlags, LookupFn Lookup)
- : LookupFlags(std::move(LookupFlags)), Lookup(std::move(Lookup)) {}
-
- SymbolNameSet lookupFlags(SymbolFlagsMap &SymbolFlags,
- const SymbolNameSet &Symbols) override {
- return LookupFlags(SymbolFlags, Symbols);
- }
-
- SymbolNameSet lookup(AsynchronousSymbolQuery &Query,
- SymbolNameSet Symbols) override {
- return Lookup(Query, std::move(Symbols));
- };
-
-private:
- LookupFlagsFn LookupFlags;
- LookupFn Lookup;
-};
-
namespace {
TEST(LegacyAPIInteropTest, QueryAgainstVSO) {
@@ -58,16 +33,17 @@ TEST(LegacyAPIInteropTest, QueryAgainstV
return V.lookupFlags(SymbolFlags, Names);
};
- auto Lookup = [&](AsynchronousSymbolQuery &Query, SymbolNameSet Symbols) {
- auto R = V.lookup(Query, Symbols);
+ auto Lookup = [&](std::shared_ptr<AsynchronousSymbolQuery> Query,
+ SymbolNameSet Symbols) {
+ auto R = V.lookup(std::move(Query), Symbols);
EXPECT_TRUE(R.MaterializationWork.empty())
<< "Query resulted in unexpected materialization work";
return std::move(R.UnresolvedSymbols);
};
- SimpleORCResolver UnderlyingResolver(std::move(LookupFlags),
- std::move(Lookup));
- JITSymbolResolverAdapter Resolver(ES, UnderlyingResolver);
+ auto UnderlyingResolver =
+ createSymbolResolver(std::move(LookupFlags), std::move(Lookup));
+ JITSymbolResolverAdapter Resolver(ES, *UnderlyingResolver);
JITSymbolResolver::LookupSet Names{StringRef("foo")};
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp?rev=325179&r1=325178&r2=325179&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp Wed Feb 14 14:12:56 2018
@@ -196,8 +196,9 @@ TEST_F(RTDyldObjectLinkingLayerExecution
return cantFail(
lookupFlagsWithLegacyFn(SymbolFlags, Symbols, LegacyLookup));
},
- [&](AsynchronousSymbolQuery &Query, const SymbolNameSet &Symbols) {
- return lookupWithLegacyFn(Query, Symbols, LegacyLookup);
+ [&](std::shared_ptr<AsynchronousSymbolQuery> Query,
+ const SymbolNameSet &Symbols) {
+ return lookupWithLegacyFn(*Query, Symbols, LegacyLookup);
});
cantFail(ObjLayer.addObject(K2, std::move(Obj2)));
More information about the llvm-commits
mailing list