Index: llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h =================================================================== --- llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h +++ llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h @@ -52,8 +52,8 @@ explicit operator bool() const { return !!H; } void operator()(shared::WrapperFunctionResult WFR) { H(std::move(WFR)); } private: - template IncomingWFRHandler(FnT &&Fn) - : H(std::forward(Fn)) {} + template + IncomingWFRHandler(FnT &&Fn) : H(std::forward(Fn)) {} unique_function H; }; @@ -66,8 +66,7 @@ /// work as a Task. class RunInPlace { public: - template - IncomingWFRHandler operator()(FnT &&Fn) { + template IncomingWFRHandler operator()(FnT &&Fn) { return IncomingWFRHandler(std::forward(Fn)); } }; @@ -81,18 +80,17 @@ public: RunAsTask(TaskDispatcher &D) : D(D) {} - template - IncomingWFRHandler operator()(FnT &&Fn) { - return IncomingWFRHandler( - [&D = this->D, Fn = std::move(Fn)] - (shared::WrapperFunctionResult WFR) mutable { - D.dispatch( - makeGenericNamedTask( - [Fn = std::move(Fn), WFR = std::move(WFR)]() mutable { - Fn(std::move(WFR)); - }, "WFR handler task")); - }); + template IncomingWFRHandler operator()(FnT &&Fn) { + return IncomingWFRHandler([&D = this->D, Fn = std::forward(Fn)]( + shared::WrapperFunctionResult WFR) mutable { + D.dispatch(makeGenericNamedTask( + [Fn = std::move(Fn), WFR = std::move(WFR)]() mutable { + Fn(std::move(WFR)); + }, + "WFR handler task")); + }); } + private: TaskDispatcher &D; }; @@ -178,7 +176,7 @@ ExecutorProcessControl(std::shared_ptr SSP, std::unique_ptr D) - : SSP(std::move(SSP)), D(std::move(D)) {} + : SSP(std::move(SSP)), D(std::move(D)) {} virtual ~ExecutorProcessControl(); @@ -285,8 +283,8 @@ template void callWrapperAsync(RunPolicyT &&Runner, ExecutorAddr WrapperFnAddr, FnT &&OnComplete, ArrayRef ArgBuffer) { - callWrapperAsync( - WrapperFnAddr, Runner(std::forward(OnComplete)), ArgBuffer); + callWrapperAsync(WrapperFnAddr, Runner(std::forward(OnComplete)), + ArgBuffer); } /// Run a wrapper function in the executor. OnComplete will be dispatched @@ -310,9 +308,8 @@ auto RF = RP.get_future(); callWrapperAsync( RunInPlace(), WrapperFnAddr, - [&](shared::WrapperFunctionResult R) { - RP.set_value(std::move(R)); - }, ArgBuffer); + [&](shared::WrapperFunctionResult R) { RP.set_value(std::move(R)); }, + ArgBuffer); return RF.get(); } @@ -323,10 +320,10 @@ void callSPSWrapperAsync(RunPolicyT &&Runner, ExecutorAddr WrapperFnAddr, SendResultT &&SendResult, const ArgTs &...Args) { shared::WrapperFunction::callAsync( - [this, WrapperFnAddr, Runner = std::move(Runner)] - (auto &&SendResult, const char *ArgData, size_t ArgSize) mutable { + [this, WrapperFnAddr, Runner = std::forward(Runner)]( + auto &&SendResult, const char *ArgData, size_t ArgSize) mutable { this->callWrapperAsync(std::move(Runner), WrapperFnAddr, - std::move(SendResult), + std::forward(SendResult), ArrayRef(ArgData, ArgSize)); }, std::forward(SendResult), Args...); Index: llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h =================================================================== --- llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h +++ llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h @@ -287,11 +287,11 @@ return; } - auto SendResult = - [SendWFR = std::move(SendWrapperFunctionResult)](auto Result) mutable { - using ResultT = decltype(Result); - SendWFR(ResultSerializer::serialize(std::move(Result))); - }; + auto SendResult = [SendWFR = std::forward( + SendWrapperFunctionResult)](auto Result) mutable { + using ResultT = decltype(Result); + SendWFR(ResultSerializer::serialize(std::move(Result))); + }; callAsync(std::forward(H), std::move(SendResult), std::move(Args), ArgIndices{}); @@ -311,8 +311,9 @@ SerializeAndSendResultT &&SerializeAndSendResult, ArgTupleT Args, std::index_sequence) { (void)Args; // Silence a buggy GCC warning. - return std::forward(H)(std::move(SerializeAndSendResult), - std::move(std::get(Args))...); + return std::forward(H)( + std::forward(SerializeAndSendResult), + std::move(std::get(Args))...); } }; @@ -490,7 +491,8 @@ return; } - auto SendSerializedResult = [SDR = std::move(SendDeserializedResult)]( + auto SendSerializedResult = [SDR = std::forward( + SendDeserializedResult)]( WrapperFunctionResult R) mutable { RetT RetVal = detail::ResultDeserializer::makeValue(); detail::ResultDeserializer::makeSafe(RetVal); @@ -565,8 +567,8 @@ const ArgTs &...Args) { WrapperFunction::callAsync( std::forward(Caller), - [SDR = std::move(SendDeserializedResult)](Error SerializeErr, - SPSEmpty E) mutable { + [SDR = std::forward(SendDeserializedResult)]( + Error SerializeErr, SPSEmpty E) mutable { SDR(std::move(SerializeErr)); }, Args...); Index: llvm/include/llvm/Support/MSVCErrorWorkarounds.h =================================================================== --- llvm/include/llvm/Support/MSVCErrorWorkarounds.h +++ llvm/include/llvm/Support/MSVCErrorWorkarounds.h @@ -60,7 +60,7 @@ MSVCPExpected( OtherT &&Val, std::enable_if_t::value> * = nullptr) - : Expected(std::move(Val)) {} + : Expected(std::forward(Val)) {} template MSVCPExpected( Index: llvm/include/llvm/Support/TaskQueue.h =================================================================== --- llvm/include/llvm/Support/TaskQueue.h +++ llvm/include/llvm/Support/TaskQueue.h @@ -83,7 +83,7 @@ static_assert(false, "TaskQueue requires building with LLVM_ENABLE_THREADS!"); #endif - Task T{std::move(C), *this}; + Task T{std::forward(C), *this}; using ResultTy = std::invoke_result_t; std::future F = T.P->get_future(); {