summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/LLJIT.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/Orc/Legacy.cpp5
-rw-r--r--llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp13
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp18
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h2
5 files changed, 18 insertions, 24 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index a80f78afe80..c6532c60fb8 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -132,9 +132,7 @@ LLJIT::LLJIT(LLJITBuilderState &S, Error &Err)
CompileThreads = std::make_unique<ThreadPool>(S.NumCompileThreads);
ES->setDispatchMaterialization(
[this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
- // FIXME: Switch to move capture once we have c++14.
- auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move(MU));
- auto Work = [SharedMU, &JD]() { SharedMU->doMaterialize(JD); };
+ auto Work = [MU = std::move(MU), &JD] { MU->doMaterialize(JD); };
CompileThreads->async(std::move(Work));
});
}
diff --git a/llvm/lib/ExecutionEngine/Orc/Legacy.cpp b/llvm/lib/ExecutionEngine/Orc/Legacy.cpp
index ce6368b57a8..9f9a6730b2c 100644
--- a/llvm/lib/ExecutionEngine/Orc/Legacy.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Legacy.cpp
@@ -23,7 +23,8 @@ void JITSymbolResolverAdapter::lookup(const LookupSet &Symbols,
for (auto &S : Symbols)
InternedSymbols.insert(ES.intern(S));
- auto OnResolvedWithUnwrap = [OnResolved](Expected<SymbolMap> InternedResult) {
+ auto OnResolvedWithUnwrap = [OnResolved = std::move(OnResolved)](
+ Expected<SymbolMap> InternedResult) mutable {
if (!InternedResult) {
OnResolved(InternedResult.takeError());
return;
@@ -36,7 +37,7 @@ void JITSymbolResolverAdapter::lookup(const LookupSet &Symbols,
};
auto Q = std::make_shared<AsynchronousSymbolQuery>(
- InternedSymbols, SymbolState::Resolved, OnResolvedWithUnwrap);
+ InternedSymbols, SymbolState::Resolved, std::move(OnResolvedWithUnwrap));
auto Unresolved = R.lookup(Q, InternedSymbols);
if (Unresolved.empty()) {
diff --git a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
index 7ea1351af8f..939cd539d1f 100644
--- a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
@@ -27,9 +27,9 @@ public:
// Build an OnResolve callback to unwrap the interned strings and pass them
// to the OnResolved callback.
- // FIXME: Switch to move capture of OnResolved once we have c++14.
auto OnResolvedWithUnwrap =
- [OnResolved](Expected<SymbolMap> InternedResult) {
+ [OnResolved = std::move(OnResolved)](
+ Expected<SymbolMap> InternedResult) mutable {
if (!InternedResult) {
OnResolved(InternedResult.takeError());
return;
@@ -50,7 +50,7 @@ public:
MR.getTargetJITDylib().withSearchOrderDo(
[&](const JITDylibSearchList &JDs) { SearchOrder = JDs; });
ES.lookup(SearchOrder, InternedSymbols, SymbolState::Resolved,
- OnResolvedWithUnwrap, RegisterDependencies);
+ std::move(OnResolvedWithUnwrap), RegisterDependencies);
}
Expected<LookupSet> getResponsibilitySet(const LookupSet &Symbols) {
@@ -133,8 +133,6 @@ void RTDyldObjectLinkingLayer::emit(MaterializationResponsibility R,
JITDylibSearchOrderResolver Resolver(*SharedR);
- // FIXME: Switch to move-capture for the 'O' buffer once we have c++14.
- MemoryBuffer *UnownedObjBuffer = O.release();
jitLinkForORC(
**Obj, std::move(O), *MemMgr, Resolver, ProcessAllSections,
[this, K, SharedR, &Obj, InternalSymbols](
@@ -143,9 +141,8 @@ void RTDyldObjectLinkingLayer::emit(MaterializationResponsibility R,
return onObjLoad(K, *SharedR, **Obj, std::move(LoadedObjInfo),
ResolvedSymbols, *InternalSymbols);
},
- [this, K, SharedR, UnownedObjBuffer](Error Err) {
- std::unique_ptr<MemoryBuffer> ObjBuffer(UnownedObjBuffer);
- onObjEmit(K, std::move(ObjBuffer), *SharedR, std::move(Err));
+ [this, K, SharedR, O = std::move(O)](Error Err) mutable {
+ onObjEmit(K, std::move(O), *SharedR, std::move(Err));
});
}
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index e000b7b227e..18c74172a07 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -1180,17 +1180,15 @@ Error RuntimeDyldImpl::resolveExternalSymbols() {
}
void RuntimeDyldImpl::finalizeAsync(
- std::unique_ptr<RuntimeDyldImpl> This, std::function<void(Error)> OnEmitted,
+ std::unique_ptr<RuntimeDyldImpl> This,
+ unique_function<void(Error)> OnEmitted,
std::unique_ptr<MemoryBuffer> UnderlyingBuffer) {
- // FIXME: Move-capture OnRelocsApplied and UnderlyingBuffer once we have
- // c++14.
- auto SharedUnderlyingBuffer =
- std::shared_ptr<MemoryBuffer>(std::move(UnderlyingBuffer));
auto SharedThis = std::shared_ptr<RuntimeDyldImpl>(std::move(This));
auto PostResolveContinuation =
- [SharedThis, OnEmitted, SharedUnderlyingBuffer](
- Expected<JITSymbolResolver::LookupResult> Result) {
+ [SharedThis, OnEmitted = std::move(OnEmitted),
+ UnderlyingBuffer = std::move(UnderlyingBuffer)](
+ Expected<JITSymbolResolver::LookupResult> Result) mutable {
if (!Result) {
OnEmitted(Result.takeError());
return;
@@ -1224,7 +1222,7 @@ void RuntimeDyldImpl::finalizeAsync(
}
if (!Symbols.empty()) {
- SharedThis->Resolver.lookup(Symbols, PostResolveContinuation);
+ SharedThis->Resolver.lookup(Symbols, std::move(PostResolveContinuation));
} else
PostResolveContinuation(std::map<StringRef, JITEvaluatedSymbol>());
}
@@ -1400,11 +1398,11 @@ void jitLinkForORC(object::ObjectFile &Obj,
std::unique_ptr<MemoryBuffer> UnderlyingBuffer,
RuntimeDyld::MemoryManager &MemMgr,
JITSymbolResolver &Resolver, bool ProcessAllSections,
- std::function<Error(
+ unique_function<Error(
std::unique_ptr<RuntimeDyld::LoadedObjectInfo> LoadedObj,
std::map<StringRef, JITEvaluatedSymbol>)>
OnLoaded,
- std::function<void(Error)> OnEmitted) {
+ unique_function<void(Error)> OnEmitted) {
RuntimeDyld RTDyld(MemMgr, Resolver);
RTDyld.setProcessAllSections(ProcessAllSections);
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
index 68b3468fbc9..cec7b92b8c4 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
@@ -549,7 +549,7 @@ public:
void resolveLocalRelocations();
static void finalizeAsync(std::unique_ptr<RuntimeDyldImpl> This,
- std::function<void(Error)> OnEmitted,
+ unique_function<void(Error)> OnEmitted,
std::unique_ptr<MemoryBuffer> UnderlyingBuffer);
void reassignSectionAddress(unsigned SectionID, uint64_t Addr);
OpenPOWER on IntegriCloud