diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/RPCUtils.h @@ -243,6 +243,8 @@ static void consumeAbandoned(ErrorReturnType RetOrErr) { consumeError(RetOrErr.takeError()); } + + ErrorReturnType returnError(Error Err) { return std::move(Err); } }; // ResultTraits specialization for void functions. @@ -275,6 +277,8 @@ static void consumeAbandoned(ErrorReturnType Err) { consumeError(std::move(Err)); } + + ErrorReturnType returnError(Error Err) { return Err; } }; // ResultTraits is equivalent to ResultTraits. This allows @@ -1494,8 +1498,9 @@ typename detail::ResultTraits::ErrorReturnType callB(const ArgTs &...Args) { bool ReceivedResponse = false; - using ResultType = typename detail::ResultTraits::ErrorReturnType; - auto Result = detail::ResultTraits::createBlankErrorReturnValue(); + using RTraits = detail::ResultTraits; + using ResultType = typename RTraits::ErrorReturnType; + ResultType Result = RTraits::createBlankErrorReturnValue(); // We have to 'Check' result (which we know is in a success state at this // point) so that it can be overwritten in the async handler. @@ -1508,22 +1513,19 @@ return Error::success(); }, Args...)) { - detail::ResultTraits::consumeAbandoned( - std::move(Result)); - return std::move(Err); + RTraits::consumeAbandoned(std::move(Result)); + return RTraits::returnError(std::move(Err)); } if (auto Err = this->C.send()) { - detail::ResultTraits::consumeAbandoned( - std::move(Result)); - return std::move(Err); + RTraits::consumeAbandoned(std::move(Result)); + return RTraits::returnError(std::move(Err)); } while (!ReceivedResponse) { if (auto Err = this->handleOne()) { - detail::ResultTraits::consumeAbandoned( - std::move(Result)); - return std::move(Err); + RTraits::consumeAbandoned(std::move(Result)); + return RTraits::returnError(std::move(Err)); } }