[llvm] [ORC] Rename WrapperFunctionResult to WrapperFunctionBuffer. NFCI. (PR #172633)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 17 03:24:18 PST 2025


https://github.com/lhames created https://github.com/llvm/llvm-project/pull/172633

Also renames CWrapperFunctionResult to CWrapperFunctionBuffer.

These types are used as argument buffers, as well as result buffers. The new name better reflects their purpose, and is consistent with naming in the new ORC runtime (llvm-project/orc-rt).

>From 4569b4d6f48d8f6ce2fa73c7f417f96ecffde431 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Wed, 17 Dec 2025 22:18:48 +1100
Subject: [PATCH] [ORC] Rename WrapperFunctionResult to WrapperFunctionBuffer.
 NFCI.

Also renames CWrapperFunctionResult to CWrapperFunctionBuffer.

These types are used as argument buffers, as well as result buffers. The new
name better reflects their purpose, and is consistent with naming in the new
ORC runtime (llvm-project/orc-rt).
---
 .../llvm/ExecutionEngine/Orc/CallSPSViaEPC.h  |   8 +-
 .../llvm/ExecutionEngine/Orc/CallViaEPC.h     |   2 +-
 llvm/include/llvm/ExecutionEngine/Orc/Core.h  |   8 +-
 .../Orc/ExecutorProcessControl.h              |  22 ++--
 .../Orc/SelfExecutorProcessControl.h          |   2 +-
 .../Orc/Shared/WrapperFunctionUtils.h         | 124 +++++++++---------
 .../ExecutorSharedMemoryMapperService.h       |   8 +-
 .../Orc/TargetProcess/JITLoaderGDB.h          |   2 +-
 .../Orc/TargetProcess/JITLoaderPerf.h         |   6 +-
 .../Orc/TargetProcess/JITLoaderVTune.h        |   6 +-
 .../Orc/TargetProcess/RegisterEHFrames.h      |   4 +-
 .../SimpleExecutorDylibManager.h              |   4 +-
 .../SimpleExecutorMemoryManager.h             |   8 +-
 .../Orc/TargetProcess/SimpleRemoteEPCServer.h |   6 +-
 llvm/lib/ExecutionEngine/Orc/Core.cpp         |   2 +-
 .../Orc/SelfExecutorProcessControl.cpp        |  10 +-
 .../ExecutionEngine/Orc/SimpleRemoteEPC.cpp   |  14 +-
 .../ExecutorSharedMemoryMapperService.cpp     |   8 +-
 .../Orc/TargetProcess/JITLoaderGDB.cpp        |   2 +-
 .../Orc/TargetProcess/JITLoaderPerf.cpp       |  12 +-
 .../Orc/TargetProcess/JITLoaderVTune.cpp      |  12 +-
 .../Orc/TargetProcess/OrcRTBootstrap.cpp      |  20 +--
 .../Orc/TargetProcess/RegisterEHFrames.cpp    |   4 +-
 .../SimpleExecutorDylibManager.cpp            |   4 +-
 .../SimpleExecutorMemoryManager.cpp           |   8 +-
 .../TargetProcess/SimpleRemoteEPCServer.cpp   |  20 +--
 .../Orc/TargetProcess/UnwindInfoManager.cpp   |   4 +-
 .../ExecutionEngine/Orc/CallSPSViaEPCTest.cpp |   4 +-
 .../EPCGenericJITLinkMemoryManagerTest.cpp    |   6 +-
 .../Orc/EPCGenericMemoryAccessTest.cpp        |  14 +-
 ...ecutionSessionWrapperFunctionCallsTest.cpp |   8 +-
 .../ExecutionEngine/Orc/MemoryMapperTest.cpp  |   2 +-
 .../Orc/SharedMemoryMapperTest.cpp            |   2 +-
 .../Orc/SimpleExecutorMemoryManagerTest.cpp   |   2 +-
 .../Orc/WrapperFunctionUtilsTest.cpp          |  44 +++----
 35 files changed, 206 insertions(+), 206 deletions(-)

diff --git a/llvm/include/llvm/ExecutionEngine/Orc/CallSPSViaEPC.h b/llvm/include/llvm/ExecutionEngine/Orc/CallSPSViaEPC.h
index 768d0b3ec1000..c8e4efb20c4c8 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/CallSPSViaEPC.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/CallSPSViaEPC.h
@@ -26,8 +26,8 @@ struct SPSCallSerializationImpl {
   using ArgSerialization = shared::SPSArgList<SPSArgTs...>;
 
   template <typename... ArgTs>
-  Expected<shared::WrapperFunctionResult> serialize(ArgTs &&...Args) {
-    auto Buffer = shared::WrapperFunctionResult::allocate(
+  Expected<shared::WrapperFunctionBuffer> serialize(ArgTs &&...Args) {
+    auto Buffer = shared::WrapperFunctionBuffer::allocate(
         ArgSerialization::size(Args...));
     shared::SPSOutputBuffer OB(Buffer.data(), Buffer.size());
     if (!ArgSerialization::serialize(OB, Args...))
@@ -48,7 +48,7 @@ template <typename SPSSig>
 struct SPSCallSerializer : public detail::SPSCallSerialization<SPSSig> {
 
   template <typename RetT>
-  Expected<RetT> deserialize(shared::WrapperFunctionResult ResultBytes) {
+  Expected<RetT> deserialize(shared::WrapperFunctionBuffer ResultBytes) {
     using RetDeserialization =
         typename detail::SPSCallSerialization<SPSSig>::RetSerialization;
     shared::SPSInputBuffer IB(ResultBytes.data(), ResultBytes.size());
@@ -66,7 +66,7 @@ struct SPSCallSerializer<void(SPSArgTs...)>
     : public detail::SPSCallSerialization<void(SPSArgTs...)> {
   template <typename RetT>
   std::enable_if_t<std::is_void_v<RetT>, Error>
-  deserialize(shared::WrapperFunctionResult ResultBytes) {
+  deserialize(shared::WrapperFunctionBuffer ResultBytes) {
     if (!ResultBytes.empty())
       return make_error<StringError>("Could not deserialize return value",
                                      inconvertibleErrorCode());
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/CallViaEPC.h b/llvm/include/llvm/ExecutionEngine/Orc/CallViaEPC.h
index b825d82e1d5fd..296c234f315bc 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/CallViaEPC.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/CallViaEPC.h
@@ -67,7 +67,7 @@ callViaEPC(HandlerFn &&H, ExecutorProcessControl &EPC, Serializer S,
     EPC.callWrapperAsync(
         Fn.getAddress(),
         [S = std::move(S), H = std::forward<HandlerFn>(H)](
-            shared::WrapperFunctionResult R) mutable {
+            shared::WrapperFunctionBuffer R) mutable {
           if (const char *ErrMsg = R.getOutOfBandError())
             H(make_error<StringError>(ErrMsg, inconvertibleErrorCode()));
           else
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h
index 24a0cb74b1fbc..4ca63857ab464 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h
@@ -1352,7 +1352,7 @@ class ExecutionSession {
   using ErrorReporter = unique_function<void(Error)>;
 
   /// Send a result to the remote.
-  using SendResultFunction = unique_function<void(shared::WrapperFunctionResult)>;
+  using SendResultFunction = unique_function<void(shared::WrapperFunctionBuffer)>;
 
   /// An asynchronous wrapper-function callable from the executor via
   /// jit-dispatch.
@@ -1584,7 +1584,7 @@ class ExecutionSession {
   /// The wrapper function should be callable as:
   ///
   /// \code{.cpp}
-  ///   CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
+  ///   CWrapperFunctionBuffer fn(uint8_t *Data, uint64_t Size);
   /// \endcode{.cpp}
   void callWrapperAsync(ExecutorAddr WrapperFnAddr,
                         ExecutorProcessControl::IncomingWFRHandler OnComplete,
@@ -1614,9 +1614,9 @@ class ExecutionSession {
   /// callable as:
   ///
   /// \code{.cpp}
-  ///   CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
+  ///   CWrapperFunctionBuffer fn(uint8_t *Data, uint64_t Size);
   /// \endcode{.cpp}
-  shared::WrapperFunctionResult callWrapper(ExecutorAddr WrapperFnAddr,
+  shared::WrapperFunctionBuffer callWrapper(ExecutorAddr WrapperFnAddr,
                                             ArrayRef<char> ArgBuffer) {
     return EPC->callWrapper(WrapperFnAddr, ArgBuffer);
   }
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
index 90b0b4fbb2595..379f8e42dfce7 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
@@ -39,27 +39,27 @@ class LLVM_ABI ExecutorProcessControl {
   friend class ExecutionSession;
 public:
 
-  /// A handler or incoming WrapperFunctionResults -- either return values from
+  /// A handler or incoming WrapperFunctionBuffers -- either return values from
   /// callWrapper* calls, or incoming JIT-dispatch requests.
   ///
   /// IncomingWFRHandlers are constructible from
-  /// unique_function<void(shared::WrapperFunctionResult)>s using the
+  /// unique_function<void(shared::WrapperFunctionBuffer)>s using the
   /// runInPlace function or a RunWithDispatch object.
   class IncomingWFRHandler {
     friend class ExecutorProcessControl;
   public:
     IncomingWFRHandler() = default;
     explicit operator bool() const { return !!H; }
-    void operator()(shared::WrapperFunctionResult WFR) { H(std::move(WFR)); }
+    void operator()(shared::WrapperFunctionBuffer WFR) { H(std::move(WFR)); }
   private:
     template <typename FnT> IncomingWFRHandler(FnT &&Fn)
       : H(std::forward<FnT>(Fn)) {}
 
-    unique_function<void(shared::WrapperFunctionResult)> H;
+    unique_function<void(shared::WrapperFunctionBuffer)> H;
   };
 
   /// Constructs an IncomingWFRHandler from a function object that is callable
-  /// as void(shared::WrapperFunctionResult). The function object will be called
+  /// as void(shared::WrapperFunctionBuffer). The function object will be called
   /// directly. This should be used with care as it may block listener threads
   /// in remote EPCs. It is only suitable for simple tasks (e.g. setting a
   /// future), or for performing some quick analysis before dispatching "real"
@@ -85,7 +85,7 @@ class LLVM_ABI ExecutorProcessControl {
     IncomingWFRHandler operator()(FnT &&Fn) {
       return IncomingWFRHandler(
           [&D = this->D, Fn = std::move(Fn)]
-          (shared::WrapperFunctionResult WFR) mutable {
+          (shared::WrapperFunctionBuffer WFR) mutable {
               D.dispatch(
                 makeGenericNamedTask(
                     [Fn = std::move(Fn), WFR = std::move(WFR)]() mutable {
@@ -219,7 +219,7 @@ class LLVM_ABI ExecutorProcessControl {
   /// The wrapper function should be callable as:
   ///
   /// \code{.cpp}
-  ///   CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
+  ///   CWrapperFunctionBuffer fn(uint8_t *Data, uint64_t Size);
   /// \endcode{.cpp}
   virtual void callWrapperAsync(ExecutorAddr WrapperFnAddr,
                                 IncomingWFRHandler OnComplete,
@@ -247,15 +247,15 @@ class LLVM_ABI ExecutorProcessControl {
   /// callable as:
   ///
   /// \code{.cpp}
-  ///   CWrapperFunctionResult fn(uint8_t *Data, uint64_t Size);
+  ///   CWrapperFunctionBuffer fn(uint8_t *Data, uint64_t Size);
   /// \endcode{.cpp}
-  shared::WrapperFunctionResult callWrapper(ExecutorAddr WrapperFnAddr,
+  shared::WrapperFunctionBuffer callWrapper(ExecutorAddr WrapperFnAddr,
                                             ArrayRef<char> ArgBuffer) {
-    std::promise<shared::WrapperFunctionResult> RP;
+    std::promise<shared::WrapperFunctionBuffer> RP;
     auto RF = RP.get_future();
     callWrapperAsync(
         RunInPlace(), WrapperFnAddr,
-        [&](shared::WrapperFunctionResult R) {
+        [&](shared::WrapperFunctionBuffer R) {
           RP.set_value(std::move(R));
         }, ArgBuffer);
     return RF.get();
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h
index 805ac89aa9125..8c43073d83493 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h
@@ -54,7 +54,7 @@ class LLVM_ABI SelfExecutorProcessControl : public ExecutorProcessControl,
   Error disconnect() override;
 
 private:
-  static shared::CWrapperFunctionResult
+  static shared::CWrapperFunctionBuffer
   jitDispatchViaWrapperFunctionManager(void *Ctx, const void *FnTag,
                                        const char *Data, size_t Size);
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
index 28749e23d9742..45042d91baa16 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
@@ -24,60 +24,60 @@ namespace orc {
 namespace shared {
 
 // Must be kept in-sync with compiler-rt/lib/orc/c-api.h.
-union CWrapperFunctionResultDataUnion {
+union CWrapperFunctionBufferDataUnion {
   char *ValuePtr;
   char Value[sizeof(ValuePtr)];
 };
 
 // Must be kept in-sync with compiler-rt/lib/orc/c-api.h.
 typedef struct {
-  CWrapperFunctionResultDataUnion Data;
+  CWrapperFunctionBufferDataUnion Data;
   size_t Size;
-} CWrapperFunctionResult;
+} CWrapperFunctionBuffer;
 
-/// C++ wrapper function result: Same as CWrapperFunctionResult but
+/// C++ wrapper function buffer: Same as CWrapperFunctionBuffer but
 /// auto-releases memory.
-class WrapperFunctionResult {
+class WrapperFunctionBuffer {
 public:
-  /// Create a default WrapperFunctionResult.
-  WrapperFunctionResult() { init(R); }
+  /// Create a default WrapperFunctionBuffer.
+  WrapperFunctionBuffer() { init(R); }
 
-  /// Create a WrapperFunctionResult by taking ownership of a
-  /// CWrapperFunctionResult.
+  /// Create a WrapperFunctionBuffer by taking ownership of a
+  /// CWrapperFunctionBuffer.
   ///
   /// Warning: This should only be used by clients writing wrapper-function
   /// caller utilities (like TargetProcessControl).
-  explicit WrapperFunctionResult(CWrapperFunctionResult R) : R(R) {
+  explicit WrapperFunctionBuffer(CWrapperFunctionBuffer R) : R(R) {
     // Reset R.
     init(R);
   }
 
-  WrapperFunctionResult(const WrapperFunctionResult &) = delete;
-  WrapperFunctionResult &operator=(const WrapperFunctionResult &) = delete;
+  WrapperFunctionBuffer(const WrapperFunctionBuffer &) = delete;
+  WrapperFunctionBuffer &operator=(const WrapperFunctionBuffer &) = delete;
 
-  WrapperFunctionResult(WrapperFunctionResult &&Other) {
+  WrapperFunctionBuffer(WrapperFunctionBuffer &&Other) {
     init(R);
     std::swap(R, Other.R);
   }
 
-  WrapperFunctionResult &operator=(WrapperFunctionResult &&Other) {
-    WrapperFunctionResult Tmp(std::move(Other));
+  WrapperFunctionBuffer &operator=(WrapperFunctionBuffer &&Other) {
+    WrapperFunctionBuffer Tmp(std::move(Other));
     std::swap(R, Tmp.R);
     return *this;
   }
 
-  ~WrapperFunctionResult() {
+  ~WrapperFunctionBuffer() {
     if ((R.Size > sizeof(R.Data.Value)) ||
         (R.Size == 0 && R.Data.ValuePtr != nullptr))
       free(R.Data.ValuePtr);
   }
 
-  /// Release ownership of the contained CWrapperFunctionResult.
+  /// Release ownership of the contained CWrapperFunctionBuffer.
   /// Warning: Do not use -- this method will be removed in the future. It only
   /// exists to temporarily support some code that will eventually be moved to
   /// the ORC runtime.
-  CWrapperFunctionResult release() {
-    CWrapperFunctionResult Tmp;
+  CWrapperFunctionBuffer release() {
+    CWrapperFunctionBuffer Tmp;
     init(Tmp);
     std::swap(R, Tmp);
     return Tmp;
@@ -105,14 +105,14 @@ class WrapperFunctionResult {
   }
 
   /// Returns true if this value is equivalent to a default-constructed
-  /// WrapperFunctionResult.
+  /// WrapperFunctionBuffer.
   bool empty() const { return R.Size == 0 && R.Data.ValuePtr == nullptr; }
 
-  /// Create a WrapperFunctionResult with the given size and return a pointer
+  /// Create a WrapperFunctionBuffer with the given size and return a pointer
   /// to the underlying memory.
-  static WrapperFunctionResult allocate(size_t Size) {
+  static WrapperFunctionBuffer allocate(size_t Size) {
     // Reset.
-    WrapperFunctionResult WFR;
+    WrapperFunctionBuffer WFR;
     WFR.R.Size = Size;
     if (WFR.R.Size > sizeof(WFR.R.Data.Value))
       WFR.R.Data.ValuePtr = (char *)malloc(WFR.R.Size);
@@ -120,26 +120,26 @@ class WrapperFunctionResult {
   }
 
   /// Copy from the given char range.
-  static WrapperFunctionResult copyFrom(const char *Source, size_t Size) {
+  static WrapperFunctionBuffer copyFrom(const char *Source, size_t Size) {
     auto WFR = allocate(Size);
     memcpy(WFR.data(), Source, Size);
     return WFR;
   }
 
   /// Copy from the given null-terminated string (includes the null-terminator).
-  static WrapperFunctionResult copyFrom(const char *Source) {
+  static WrapperFunctionBuffer copyFrom(const char *Source) {
     return copyFrom(Source, strlen(Source) + 1);
   }
 
   /// Copy from the given std::string (includes the null terminator).
-  static WrapperFunctionResult copyFrom(const std::string &Source) {
+  static WrapperFunctionBuffer copyFrom(const std::string &Source) {
     return copyFrom(Source.c_str());
   }
 
   /// Create an out-of-band error by copying the given string.
-  static WrapperFunctionResult createOutOfBandError(const char *Msg) {
+  static WrapperFunctionBuffer createOutOfBandError(const char *Msg) {
     // Reset.
-    WrapperFunctionResult WFR;
+    WrapperFunctionBuffer WFR;
     char *Tmp = (char *)malloc(strlen(Msg) + 1);
     strcpy(Tmp, Msg);
     WFR.R.Data.ValuePtr = Tmp;
@@ -147,7 +147,7 @@ class WrapperFunctionResult {
   }
 
   /// Create an out-of-band error by copying the given string.
-  static WrapperFunctionResult createOutOfBandError(const std::string &Msg) {
+  static WrapperFunctionBuffer createOutOfBandError(const std::string &Msg) {
     return createOutOfBandError(Msg.c_str());
   }
 
@@ -158,23 +158,23 @@ class WrapperFunctionResult {
   }
 
 private:
-  static void init(CWrapperFunctionResult &R) {
+  static void init(CWrapperFunctionBuffer &R) {
     R.Data.ValuePtr = nullptr;
     R.Size = 0;
   }
 
-  CWrapperFunctionResult R;
+  CWrapperFunctionBuffer R;
 };
 
 namespace detail {
 
 template <typename SPSArgListT, typename... ArgTs>
-WrapperFunctionResult
-serializeViaSPSToWrapperFunctionResult(const ArgTs &...Args) {
-  auto Result = WrapperFunctionResult::allocate(SPSArgListT::size(Args...));
+WrapperFunctionBuffer
+serializeViaSPSToWrapperFunctionBuffer(const ArgTs &...Args) {
+  auto Result = WrapperFunctionBuffer::allocate(SPSArgListT::size(Args...));
   SPSOutputBuffer OB(Result.data(), Result.size());
   if (!SPSArgListT::serialize(OB, Args...))
-    return WrapperFunctionResult::createOutOfBandError(
+    return WrapperFunctionBuffer::createOutOfBandError(
         "Error serializing arguments to blob in call");
   return Result;
 }
@@ -214,11 +214,11 @@ class WrapperFunctionHandlerHelper<RetT(ArgTs...), ResultSerializer,
   using ArgIndices = std::make_index_sequence<std::tuple_size<ArgTuple>::value>;
 
   template <typename HandlerT>
-  static WrapperFunctionResult apply(HandlerT &&H, const char *ArgData,
+  static WrapperFunctionBuffer apply(HandlerT &&H, const char *ArgData,
                                      size_t ArgSize) {
     ArgTuple Args;
     if (!deserialize(ArgData, ArgSize, Args, ArgIndices{}))
-      return WrapperFunctionResult::createOutOfBandError(
+      return WrapperFunctionBuffer::createOutOfBandError(
           "Could not deserialize arguments for wrapper function call");
 
     auto HandlerResult = WrapperFunctionHandlerCaller<RetT>::call(
@@ -276,19 +276,19 @@ class WrapperFunctionAsyncHandlerHelper<RetT(SendResultT, ArgTs...),
   using ArgTuple = std::tuple<std::decay_t<ArgTs>...>;
   using ArgIndices = std::make_index_sequence<std::tuple_size<ArgTuple>::value>;
 
-  template <typename HandlerT, typename SendWrapperFunctionResultT>
+  template <typename HandlerT, typename SendWrapperFunctionBufferT>
   static void applyAsync(HandlerT &&H,
-                         SendWrapperFunctionResultT &&SendWrapperFunctionResult,
+                         SendWrapperFunctionBufferT &&SendWrapperFunctionBuffer,
                          const char *ArgData, size_t ArgSize) {
     ArgTuple Args;
     if (!deserialize(ArgData, ArgSize, Args, ArgIndices{})) {
-      SendWrapperFunctionResult(WrapperFunctionResult::createOutOfBandError(
+      SendWrapperFunctionBuffer(WrapperFunctionBuffer::createOutOfBandError(
           "Could not deserialize arguments for wrapper function call"));
       return;
     }
 
     auto SendResult =
-        [SendWFR = std::move(SendWrapperFunctionResult)](auto Result) mutable {
+        [SendWFR = std::move(SendWrapperFunctionBuffer)](auto Result) mutable {
           using ResultT = decltype(Result);
           SendWFR(ResultSerializer<ResultT>::serialize(std::move(Result)));
         };
@@ -342,16 +342,16 @@ class WrapperFunctionAsyncHandlerHelper<RetT (ClassT::*)(ArgTs...) const,
 
 template <typename SPSRetTagT, typename RetT> class ResultSerializer {
 public:
-  static WrapperFunctionResult serialize(RetT Result) {
-    return serializeViaSPSToWrapperFunctionResult<SPSArgList<SPSRetTagT>>(
+  static WrapperFunctionBuffer serialize(RetT Result) {
+    return serializeViaSPSToWrapperFunctionBuffer<SPSArgList<SPSRetTagT>>(
         Result);
   }
 };
 
 template <typename SPSRetTagT> class ResultSerializer<SPSRetTagT, Error> {
 public:
-  static WrapperFunctionResult serialize(Error Err) {
-    return serializeViaSPSToWrapperFunctionResult<SPSArgList<SPSRetTagT>>(
+  static WrapperFunctionBuffer serialize(Error Err) {
+    return serializeViaSPSToWrapperFunctionBuffer<SPSArgList<SPSRetTagT>>(
         toSPSSerializable(std::move(Err)));
   }
 };
@@ -359,8 +359,8 @@ template <typename SPSRetTagT> class ResultSerializer<SPSRetTagT, Error> {
 template <typename SPSRetTagT>
 class ResultSerializer<SPSRetTagT, ErrorSuccess> {
 public:
-  static WrapperFunctionResult serialize(ErrorSuccess Err) {
-    return serializeViaSPSToWrapperFunctionResult<SPSArgList<SPSRetTagT>>(
+  static WrapperFunctionBuffer serialize(ErrorSuccess Err) {
+    return serializeViaSPSToWrapperFunctionBuffer<SPSArgList<SPSRetTagT>>(
         toSPSSerializable(std::move(Err)));
   }
 };
@@ -368,8 +368,8 @@ class ResultSerializer<SPSRetTagT, ErrorSuccess> {
 template <typename SPSRetTagT, typename T>
 class ResultSerializer<SPSRetTagT, Expected<T>> {
 public:
-  static WrapperFunctionResult serialize(Expected<T> E) {
-    return serializeViaSPSToWrapperFunctionResult<SPSArgList<SPSRetTagT>>(
+  static WrapperFunctionBuffer serialize(Expected<T> E) {
+    return serializeViaSPSToWrapperFunctionBuffer<SPSArgList<SPSRetTagT>>(
         toSPSSerializable(std::move(E)));
   }
 };
@@ -441,7 +441,7 @@ class WrapperFunction<SPSRetTagT(SPSTagTs...)> {
 
 public:
   /// Call a wrapper function. Caller should be callable as
-  /// WrapperFunctionResult Fn(const char *ArgData, size_t ArgSize);
+  /// WrapperFunctionBuffer Fn(const char *ArgData, size_t ArgSize);
   template <typename CallerFn, typename RetT, typename... ArgTs>
   static Error call(const CallerFn &Caller, RetT &Result,
                     const ArgTs &...Args) {
@@ -452,12 +452,12 @@ class WrapperFunction<SPSRetTagT(SPSTagTs...)> {
     detail::ResultDeserializer<SPSRetTagT, RetT>::makeSafe(Result);
 
     auto ArgBuffer =
-        detail::serializeViaSPSToWrapperFunctionResult<SPSArgList<SPSTagTs...>>(
+        detail::serializeViaSPSToWrapperFunctionBuffer<SPSArgList<SPSTagTs...>>(
             Args...);
     if (const char *ErrMsg = ArgBuffer.getOutOfBandError())
       return make_error<StringError>(ErrMsg, inconvertibleErrorCode());
 
-    WrapperFunctionResult ResultBuffer =
+    WrapperFunctionBuffer ResultBuffer =
         Caller(ArgBuffer.data(), ArgBuffer.size());
     if (auto ErrMsg = ResultBuffer.getOutOfBandError())
       return make_error<StringError>(ErrMsg, inconvertibleErrorCode());
@@ -468,8 +468,8 @@ class WrapperFunction<SPSRetTagT(SPSTagTs...)> {
 
   /// Call an async wrapper function.
   /// Caller should be callable as
-  /// void Fn(unique_function<void(WrapperFunctionResult)> SendResult,
-  ///         WrapperFunctionResult ArgBuffer);
+  /// void Fn(unique_function<void(WrapperFunctionBuffer)> SendResult,
+  ///         WrapperFunctionBuffer ArgBuffer);
   template <typename AsyncCallerFn, typename SendDeserializedResultFn,
             typename... ArgTs>
   static void callAsync(AsyncCallerFn &&Caller,
@@ -481,7 +481,7 @@ class WrapperFunction<SPSRetTagT(SPSTagTs...)> {
                ResultSerializer, SPSRetTagT>::ArgTuple>::type;
 
     auto ArgBuffer =
-        detail::serializeViaSPSToWrapperFunctionResult<SPSArgList<SPSTagTs...>>(
+        detail::serializeViaSPSToWrapperFunctionBuffer<SPSArgList<SPSTagTs...>>(
             Args...);
     if (auto *ErrMsg = ArgBuffer.getOutOfBandError()) {
       SendDeserializedResult(
@@ -491,7 +491,7 @@ class WrapperFunction<SPSRetTagT(SPSTagTs...)> {
     }
 
     auto SendSerializedResult = [SDR = std::move(SendDeserializedResult)](
-                                    WrapperFunctionResult R) mutable {
+                                    WrapperFunctionBuffer R) mutable {
       RetT RetVal = detail::ResultDeserializer<SPSRetTagT, RetT>::makeValue();
       detail::ResultDeserializer<SPSRetTagT, RetT>::makeSafe(RetVal);
 
@@ -516,7 +516,7 @@ class WrapperFunction<SPSRetTagT(SPSTagTs...)> {
 
   /// Handle a call to a wrapper function.
   template <typename HandlerT>
-  static WrapperFunctionResult handle(const char *ArgData, size_t ArgSize,
+  static WrapperFunctionBuffer handle(const char *ArgData, size_t ArgSize,
                                       HandlerT &&Handler) {
     using WFHH =
         detail::WrapperFunctionHandlerHelper<std::remove_reference_t<HandlerT>,
@@ -593,7 +593,7 @@ class WrapperFunction<void(SPSTagTs...)>
 ///   using SPSMyMethodWrapperSignature =
 ///     SPSString(SPSExecutorAddr, uint32_t, bool);
 ///
-///   WrapperFunctionResult
+///   WrapperFunctionBuffer
 ///   myMethodCallWrapper(const char *ArgData, size_t ArgSize) {
 ///     return WrapperFunction<SPSMyMethodWrapperSignature>::handle(
 ///        ArgData, ArgSize, makeMethodWrapperHandler(&MyClass::myMethod));
@@ -662,11 +662,11 @@ class WrapperFunctionCall {
   /// WrapperFunctionCalls convert to true if the callee is non-null.
   explicit operator bool() const { return !!FnAddr; }
 
-  /// Run call returning raw WrapperFunctionResult.
-  shared::WrapperFunctionResult run() const {
+  /// Run call returning raw WrapperFunctionBuffer.
+  shared::WrapperFunctionBuffer run() const {
     using FnTy =
-        shared::CWrapperFunctionResult(const char *ArgData, size_t ArgSize);
-    return shared::WrapperFunctionResult(
+        shared::CWrapperFunctionBuffer(const char *ArgData, size_t ArgSize);
+    return shared::WrapperFunctionBuffer(
         FnAddr.toPtr<FnTy *>()(ArgData.data(), ArgData.size()));
   }
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h
index 8f876504eaf53..2c94113d83f39 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.h
@@ -56,16 +56,16 @@ class LLVM_ABI ExecutorSharedMemoryMapperService final
   };
   using ReservationMap = DenseMap<void *, Reservation>;
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   reserveWrapper(const char *ArgData, size_t ArgSize);
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   initializeWrapper(const char *ArgData, size_t ArgSize);
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   deinitializeWrapper(const char *ArgData, size_t ArgSize);
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   releaseWrapper(const char *ArgData, size_t ArgSize);
 
 #if (defined(LLVM_ON_UNIX) && !defined(__ANDROID__)) || defined(_WIN32)
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
index bc3c6fa332a2d..fb565cb7828cc 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
@@ -43,7 +43,7 @@ struct jit_descriptor {
 };
 }
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderGDBAllocAction(const char *ArgData, size_t ArgSize);
 
 #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_JITLOADERGDB_H
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.h
index 1aa187754ffa6..0a5f2d9386209 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.h
@@ -17,13 +17,13 @@
 #include "llvm/Support/Compiler.h"
 #include <cstdint>
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfImpl(const char *ArgData, size_t ArgSize);
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfStart(const char *ArgData, size_t ArgSize);
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfEnd(const char *ArgData, size_t ArgSize);
 
 #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_JITLOADERPERF_H
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h
index 4cc8bd66648c1..5ada9ede4897d 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.h
@@ -17,13 +17,13 @@
 #include "llvm/Support/Compiler.h"
 #include <cstdint>
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerVTuneImpl(const char *ArgData, size_t ArgSize);
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_unregisterVTuneImpl(const char *ArgData, size_t ArgSize);
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_test_registerVTuneImpl(const char *ArgData, size_t ArgSize);
 
 #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_JITLOADERVTUNE_H
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h
index b86c551a7ce31..24dee69f029d8 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h
@@ -34,10 +34,10 @@ LLVM_ABI Error deregisterEHFrameSection(const void *EHFrameSectionAddr,
 } // end namespace orc
 } // end namespace llvm
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerEHFrameSectionAllocAction(const char *ArgData, size_t ArgSize);
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
+extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_deregisterEHFrameSectionAllocAction(const char *ArgData,
                                              size_t ArgSize);
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.h
index 7ca2ff2a2fd94..043d2947768ac 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.h
@@ -47,10 +47,10 @@ class LLVM_ABI SimpleExecutorDylibManager : public ExecutorBootstrapService {
 private:
   using DylibSet = DenseSet<void *>;
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   openWrapper(const char *ArgData, size_t ArgSize);
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   resolveWrapper(const char *ArgData, size_t ArgSize);
 
   std::mutex M;
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.h
index 45256ec42463f..2de6dc53cc9d3 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.h
@@ -79,16 +79,16 @@ class LLVM_ABI SimpleExecutorMemoryManager : public ExecutorBootstrapService {
   /// address must represent the start of an existing initialized region.
   Expected<RegionInfo &> getRegionInfo(ExecutorAddr A, StringRef Context);
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   reserveWrapper(const char *ArgData, size_t ArgSize);
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   initializeWrapper(const char *ArgData, size_t ArgSize);
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   deinitializeWrapper(const char *ArgData, size_t ArgSize);
 
-  static llvm::orc::shared::CWrapperFunctionResult
+  static llvm::orc::shared::CWrapperFunctionBuffer
   releaseWrapper(const char *ArgData, size_t ArgSize);
 
   std::mutex M;
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.h
index 427afa93fdc91..70a226504e876 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.h
@@ -163,10 +163,10 @@ class LLVM_ABI SimpleRemoteEPCServer : public SimpleRemoteEPCTransportClient {
   void handleCallWrapper(uint64_t RemoteSeqNo, ExecutorAddr TagAddr,
                          SimpleRemoteEPCArgBytesVector ArgBytes);
 
-  shared::WrapperFunctionResult
+  shared::WrapperFunctionBuffer
   doJITDispatch(const void *FnTag, const char *ArgData, size_t ArgSize);
 
-  static shared::CWrapperFunctionResult jitDispatchEntry(void *DispatchCtx,
+  static shared::CWrapperFunctionBuffer jitDispatchEntry(void *DispatchCtx,
                                                          const void *FnTag,
                                                          const char *ArgData,
                                                          size_t ArgSize);
@@ -175,7 +175,7 @@ class LLVM_ABI SimpleRemoteEPCServer : public SimpleRemoteEPCTransportClient {
   void releaseSeqNo(uint64_t) {}
 
   using PendingJITDispatchResultsMap =
-      DenseMap<uint64_t, std::promise<shared::WrapperFunctionResult> *>;
+      DenseMap<uint64_t, std::promise<shared::WrapperFunctionBuffer> *>;
 
   std::mutex ServerStateMutex;
   std::condition_variable ShutdownCV;
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index 9233c8ed8d0dd..1b7a8a4e9005c 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -1912,7 +1912,7 @@ void ExecutionSession::runJITDispatchHandler(SendResultFunction SendResult,
   if (F)
     (*F)(std::move(SendResult), ArgBuffer.data(), ArgBuffer.size());
   else
-    SendResult(shared::WrapperFunctionResult::createOutOfBandError(
+    SendResult(shared::WrapperFunctionBuffer::createOutOfBandError(
         ("No function registered for tag " +
          formatv("{0:x16}", HandlerFnTagAddr))
             .str()));
diff --git a/llvm/lib/ExecutionEngine/Orc/SelfExecutorProcessControl.cpp b/llvm/lib/ExecutionEngine/Orc/SelfExecutorProcessControl.cpp
index 547559305f973..8a067c9d5d165 100644
--- a/llvm/lib/ExecutionEngine/Orc/SelfExecutorProcessControl.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/SelfExecutorProcessControl.cpp
@@ -132,9 +132,9 @@ void SelfExecutorProcessControl::callWrapperAsync(ExecutorAddr WrapperFnAddr,
                                                   IncomingWFRHandler SendResult,
                                                   ArrayRef<char> ArgBuffer) {
   using WrapperFnTy =
-      shared::CWrapperFunctionResult (*)(const char *Data, size_t Size);
+      shared::CWrapperFunctionBuffer (*)(const char *Data, size_t Size);
   auto *WrapperFn = WrapperFnAddr.toPtr<WrapperFnTy>();
-  SendResult(shared::WrapperFunctionResult(
+  SendResult(shared::WrapperFunctionBuffer(
       WrapperFn(ArgBuffer.data(), ArgBuffer.size())));
 }
 
@@ -143,7 +143,7 @@ Error SelfExecutorProcessControl::disconnect() {
   return Error::success();
 }
 
-shared::CWrapperFunctionResult
+shared::CWrapperFunctionBuffer
 SelfExecutorProcessControl::jitDispatchViaWrapperFunctionManager(
     void *Ctx, const void *FnTag, const char *Data, size_t Size) {
 
@@ -152,13 +152,13 @@ SelfExecutorProcessControl::jitDispatchViaWrapperFunctionManager(
            << " byte payload.\n";
   });
 
-  std::promise<shared::WrapperFunctionResult> ResultP;
+  std::promise<shared::WrapperFunctionBuffer> ResultP;
   auto ResultF = ResultP.get_future();
   static_cast<SelfExecutorProcessControl *>(Ctx)
       ->getExecutionSession()
       .runJITDispatchHandler(
           [ResultP = std::move(ResultP)](
-              shared::WrapperFunctionResult Result) mutable {
+              shared::WrapperFunctionBuffer Result) mutable {
             ResultP.set_value(std::move(Result));
           },
           ExecutorAddr::fromPtr(FnTag), {Data, Size});
diff --git a/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp b/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
index 893523ced8651..772aa99d8ea96 100644
--- a/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
@@ -116,7 +116,7 @@ void SimpleRemoteEPC::callWrapperAsync(ExecutorAddr WrapperFnAddr,
     }
 
     if (H)
-      H(shared::WrapperFunctionResult::createOutOfBandError("disconnecting"));
+      H(shared::WrapperFunctionBuffer::createOutOfBandError("disconnecting"));
 
     getExecutionSession().reportError(std::move(Err));
   }
@@ -202,7 +202,7 @@ void SimpleRemoteEPC::handleDisconnect(Error Err) {
 
   for (auto &KV : TmpPending)
     KV.second(
-        shared::WrapperFunctionResult::createOutOfBandError("disconnecting"));
+        shared::WrapperFunctionBuffer::createOutOfBandError("disconnecting"));
 
   std::lock_guard<std::mutex> Lock(SimpleRemoteEPCMutex);
   DisconnectErr = joinErrors(std::move(DisconnectErr), std::move(Err));
@@ -300,7 +300,7 @@ Error SimpleRemoteEPC::handleSetup(uint64_t SeqNo, ExecutorAddr TagAddr,
   PendingCallWrapperResults.erase(I);
 
   auto WFR =
-      shared::WrapperFunctionResult::copyFrom(ArgBytes.data(), ArgBytes.size());
+      shared::WrapperFunctionBuffer::copyFrom(ArgBytes.data(), ArgBytes.size());
   SetupMsgHandler(std::move(WFR));
   return Error::success();
 }
@@ -314,7 +314,7 @@ Error SimpleRemoteEPC::setup(Setup S) {
   // Prepare a handler for the setup packet.
   PendingCallWrapperResults[0] =
     RunInPlace()(
-      [&](shared::WrapperFunctionResult SetupMsgBytes) {
+      [&](shared::WrapperFunctionBuffer SetupMsgBytes) {
         if (const char *ErrMsg = SetupMsgBytes.getOutOfBandError()) {
           EIP.set_value(
               make_error<StringError>(ErrMsg, inconvertibleErrorCode()));
@@ -419,7 +419,7 @@ Error SimpleRemoteEPC::handleResult(uint64_t SeqNo, ExecutorAddr TagAddr,
   }
 
   auto WFR =
-      shared::WrapperFunctionResult::copyFrom(ArgBytes.data(), ArgBytes.size());
+      shared::WrapperFunctionBuffer::copyFrom(ArgBytes.data(), ArgBytes.size());
   SendResult(std::move(WFR));
   return Error::success();
 }
@@ -431,7 +431,7 @@ void SimpleRemoteEPC::handleCallWrapper(
   D->dispatch(makeGenericNamedTask(
       [this, RemoteSeqNo, TagAddr, ArgBytes = std::move(ArgBytes)]() {
         ES->runJITDispatchHandler(
-            [this, RemoteSeqNo](shared::WrapperFunctionResult WFR) {
+            [this, RemoteSeqNo](shared::WrapperFunctionBuffer WFR) {
               if (auto Err =
                       sendMessage(SimpleRemoteEPCOpcode::Result, RemoteSeqNo,
                                   ExecutorAddr(), {WFR.data(), WFR.size()}))
@@ -444,7 +444,7 @@ void SimpleRemoteEPC::handleCallWrapper(
 
 Error SimpleRemoteEPC::handleHangup(SimpleRemoteEPCArgBytesVector ArgBytes) {
   using namespace llvm::orc::shared;
-  auto WFR = WrapperFunctionResult::copyFrom(ArgBytes.data(), ArgBytes.size());
+  auto WFR = WrapperFunctionBuffer::copyFrom(ArgBytes.data(), ArgBytes.size());
   if (const char *ErrMsg = WFR.getOutOfBandError())
     return make_error<StringError>(ErrMsg, inconvertibleErrorCode());
 
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
index 4fbf232008c89..423a1bd496c96 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/ExecutorSharedMemoryMapperService.cpp
@@ -321,7 +321,7 @@ void ExecutorSharedMemoryMapperService::addBootstrapSymbols(
       ExecutorAddr::fromPtr(&releaseWrapper);
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 ExecutorSharedMemoryMapperService::reserveWrapper(const char *ArgData,
                                                   size_t ArgSize) {
   return shared::WrapperFunction<
@@ -332,7 +332,7 @@ ExecutorSharedMemoryMapperService::reserveWrapper(const char *ArgData,
           .release();
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 ExecutorSharedMemoryMapperService::initializeWrapper(const char *ArgData,
                                                      size_t ArgSize) {
   return shared::WrapperFunction<
@@ -343,7 +343,7 @@ ExecutorSharedMemoryMapperService::initializeWrapper(const char *ArgData,
           .release();
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 ExecutorSharedMemoryMapperService::deinitializeWrapper(const char *ArgData,
                                                        size_t ArgSize) {
   return shared::WrapperFunction<
@@ -354,7 +354,7 @@ ExecutorSharedMemoryMapperService::deinitializeWrapper(const char *ArgData,
           .release();
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 ExecutorSharedMemoryMapperService::releaseWrapper(const char *ArgData,
                                                   size_t ArgSize) {
   return shared::WrapperFunction<
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
index f255de093b24f..326279ccd862b 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
@@ -73,7 +73,7 @@ static void appendJITDebugDescriptor(const char *ObjAddr, size_t Size) {
   __jit_debug_descriptor.action_flag = JIT_REGISTER_FN;
 }
 
-extern "C" orc::shared::CWrapperFunctionResult
+extern "C" orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderGDBAllocAction(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   return WrapperFunction<SPSError(SPSExecutorAddrRange, bool)>::handle(
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp
index e609a7d3dc08e..eb69119bcafee 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp
@@ -395,7 +395,7 @@ static Error registerJITLoaderPerfEndImpl() {
   return Error::success();
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfImpl(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   return WrapperFunction<SPSError(SPSPerfJITRecordBatch)>::handle(
@@ -403,7 +403,7 @@ llvm_orc_registerJITLoaderPerfImpl(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfStart(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   return WrapperFunction<SPSError()>::handle(ArgData, ArgSize,
@@ -411,7 +411,7 @@ llvm_orc_registerJITLoaderPerfStart(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfEnd(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   return WrapperFunction<SPSError()>::handle(ArgData, ArgSize,
@@ -433,7 +433,7 @@ static Error badOS() {
 
 static Error badOSBatch(PerfJITRecordBatch &Batch) { return badOS(); }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfImpl(const char *ArgData, size_t ArgSize) {
   using namespace shared;
   return WrapperFunction<SPSError(SPSPerfJITRecordBatch)>::handle(
@@ -441,13 +441,13 @@ llvm_orc_registerJITLoaderPerfImpl(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfStart(const char *ArgData, size_t ArgSize) {
   using namespace shared;
   return WrapperFunction<SPSError()>::handle(ArgData, ArgSize, badOS).release();
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderPerfEnd(const char *ArgData, size_t ArgSize) {
   using namespace shared;
   return WrapperFunction<SPSError()>::handle(ArgData, ArgSize, badOS).release();
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.cpp
index 8f988c9689778..36f23e6b0ac57 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderVTune.cpp
@@ -91,7 +91,7 @@ static void registerJITLoaderVTuneUnregisterImpl(
   }
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerVTuneImpl(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   if (!JITEventWrapper::Wrapper)
@@ -102,7 +102,7 @@ llvm_orc_registerVTuneImpl(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_unregisterVTuneImpl(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   return WrapperFunction<void(SPSVTuneUnloadedMethodIDs)>::handle(
@@ -173,7 +173,7 @@ static unsigned int GetNewMethodID(void) {
   return ++id;
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_test_registerVTuneImpl(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   JITEventWrapper::Wrapper.reset(new IntelJITEventsWrapper(
@@ -197,7 +197,7 @@ static void unsuppported(const std::vector<std::pair<uint64_t, uint64_t>> &UM) {
 
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerVTuneImpl(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   return WrapperFunction<SPSError(SPSVTuneMethodBatch)>::handle(
@@ -205,7 +205,7 @@ llvm_orc_registerVTuneImpl(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_unregisterVTuneImpl(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   return WrapperFunction<void(SPSVTuneUnloadedMethodIDs)>::handle(
@@ -213,7 +213,7 @@ llvm_orc_unregisterVTuneImpl(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-extern "C" llvm::orc::shared::CWrapperFunctionResult
+extern "C" llvm::orc::shared::CWrapperFunctionBuffer
 llvm_orc_test_registerVTuneImpl(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
   return WrapperFunction<SPSError(SPSVTuneMethodBatch)>::handle(
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
index 06cb717750e35..475295a81d16c 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp
@@ -22,7 +22,7 @@ namespace orc {
 namespace rt_bootstrap {
 
 template <typename WriteT, typename SPSWriteT>
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 writeUIntsWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<void(SPSSequence<SPSWriteT>)>::handle(
              ArgData, ArgSize,
@@ -33,7 +33,7 @@ writeUIntsWrapper(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 writePointersWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<void(SPSSequence<SPSMemoryAccessPointerWrite>)>::
       handle(ArgData, ArgSize,
@@ -45,7 +45,7 @@ writePointersWrapper(const char *ArgData, size_t ArgSize) {
           .release();
 }
 
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 writeBuffersWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<void(SPSSequence<SPSMemoryAccessBufferWrite>)>::handle(
              ArgData, ArgSize,
@@ -58,7 +58,7 @@ writeBuffersWrapper(const char *ArgData, size_t ArgSize) {
 }
 
 template <typename ReadT>
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 readUIntsWrapper(const char *ArgData, size_t ArgSize) {
   using SPSSig = SPSSequence<ReadT>(SPSSequence<SPSExecutorAddr>);
   return WrapperFunction<SPSSig>::handle(ArgData, ArgSize,
@@ -73,7 +73,7 @@ readUIntsWrapper(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 readPointersWrapper(const char *ArgData, size_t ArgSize) {
   using SPSSig = SPSSequence<SPSExecutorAddr>(SPSSequence<SPSExecutorAddr>);
   return WrapperFunction<SPSSig>::handle(
@@ -88,7 +88,7 @@ readPointersWrapper(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 readBuffersWrapper(const char *ArgData, size_t ArgSize) {
   using SPSSig =
       SPSSequence<SPSSequence<uint8_t>>(SPSSequence<SPSExecutorAddrRange>);
@@ -108,7 +108,7 @@ readBuffersWrapper(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 readStringsWrapper(const char *ArgData, size_t ArgSize) {
   using SPSSig = SPSSequence<SPSString>(SPSSequence<SPSExecutorAddr>);
   return WrapperFunction<SPSSig>::handle(ArgData, ArgSize,
@@ -123,7 +123,7 @@ readStringsWrapper(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 runAsMainWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<rt::SPSRunAsMainSignature>::handle(
              ArgData, ArgSize,
@@ -134,7 +134,7 @@ runAsMainWrapper(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 runAsVoidFunctionWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<rt::SPSRunAsVoidFunctionSignature>::handle(
              ArgData, ArgSize,
@@ -144,7 +144,7 @@ runAsVoidFunctionWrapper(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-static llvm::orc::shared::CWrapperFunctionResult
+static llvm::orc::shared::CWrapperFunctionBuffer
 runAsIntFunctionWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<rt::SPSRunAsIntFunctionSignature>::handle(
              ArgData, ArgSize,
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
index f44a5f2889a22..1856181e36788 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
@@ -163,7 +163,7 @@ static Error deregisterEHFrameWrapper(ExecutorAddrRange EHFrame) {
       EHFrame.Start.toPtr<const void *>(), EHFrame.size());
 }
 
-extern "C" orc::shared::CWrapperFunctionResult
+extern "C" orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerEHFrameSectionAllocAction(const char *ArgData,
                                            size_t ArgSize) {
   return WrapperFunction<SPSError(SPSExecutorAddrRange)>::handle(
@@ -171,7 +171,7 @@ llvm_orc_registerEHFrameSectionAllocAction(const char *ArgData,
       .release();
 }
 
-extern "C" orc::shared::CWrapperFunctionResult
+extern "C" orc::shared::CWrapperFunctionBuffer
 llvm_orc_deregisterEHFrameSectionAllocAction(const char *ArgData,
                                              size_t ArgSize) {
   return WrapperFunction<SPSError(SPSExecutorAddrRange)>::handle(
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.cpp
index 52bb55d209e56..8da6d1b023772 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorDylibManager.cpp
@@ -65,7 +65,7 @@ void SimpleExecutorDylibManager::addBootstrapSymbols(
       ExecutorAddr::fromPtr(&resolveWrapper);
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 SimpleExecutorDylibManager::openWrapper(const char *ArgData, size_t ArgSize) {
   return shared::
       WrapperFunction<rt::SPSSimpleExecutorDylibManagerOpenSignature>::handle(
@@ -75,7 +75,7 @@ SimpleExecutorDylibManager::openWrapper(const char *ArgData, size_t ArgSize) {
           .release();
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 SimpleExecutorDylibManager::resolveWrapper(const char *ArgData,
                                            size_t ArgSize) {
   using ResolveResult = ExecutorResolver::ResolveResult;
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp
index af24540ceebcb..a61d9d50e4f75 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleExecutorMemoryManager.cpp
@@ -306,7 +306,7 @@ SimpleExecutorMemoryManager::getRegionInfo(ExecutorAddr A, StringRef Context) {
   return getRegionInfo(*Slab, A, Context);
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 SimpleExecutorMemoryManager::reserveWrapper(const char *ArgData,
                                             size_t ArgSize) {
   return shared::WrapperFunction<rt::SPSSimpleRemoteMemoryMapReserveSignature>::
@@ -316,7 +316,7 @@ SimpleExecutorMemoryManager::reserveWrapper(const char *ArgData,
           .release();
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 SimpleExecutorMemoryManager::initializeWrapper(const char *ArgData,
                                                size_t ArgSize) {
   return shared::
@@ -327,7 +327,7 @@ SimpleExecutorMemoryManager::initializeWrapper(const char *ArgData,
           .release();
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 SimpleExecutorMemoryManager::deinitializeWrapper(const char *ArgData,
                                                  size_t ArgSize) {
   return shared::WrapperFunction<
@@ -338,7 +338,7 @@ SimpleExecutorMemoryManager::deinitializeWrapper(const char *ArgData,
           .release();
 }
 
-llvm::orc::shared::CWrapperFunctionResult
+llvm::orc::shared::CWrapperFunctionBuffer
 SimpleExecutorMemoryManager::releaseWrapper(const char *ArgData,
                                             size_t ArgSize) {
   return shared::WrapperFunction<rt::SPSSimpleRemoteMemoryMapReleaseSignature>::
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp
index 987ed710b039d..781da7b319db0 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp
@@ -131,7 +131,7 @@ void SimpleRemoteEPCServer::handleDisconnect(Error Err) {
   // Send out-of-band errors to any waiting threads.
   for (auto &KV : TmpPending)
     KV.second->set_value(
-        shared::WrapperFunctionResult::createOutOfBandError("disconnecting"));
+        shared::WrapperFunctionBuffer::createOutOfBandError("disconnecting"));
 
   // Wait for dispatcher to clear.
   D->shutdown();
@@ -212,7 +212,7 @@ Error SimpleRemoteEPCServer::sendSetupMessage(
   using SPSSerialize =
       shared::SPSArgList<shared::SPSSimpleRemoteEPCExecutorInfo>;
   auto SetupPacketBytes =
-      shared::WrapperFunctionResult::allocate(SPSSerialize::size(EI));
+      shared::WrapperFunctionBuffer::allocate(SPSSerialize::size(EI));
   shared::SPSOutputBuffer OB(SetupPacketBytes.data(), SetupPacketBytes.size());
   if (!SPSSerialize::serialize(OB, EI))
     return make_error<StringError>("Could not send setup packet",
@@ -225,7 +225,7 @@ Error SimpleRemoteEPCServer::sendSetupMessage(
 Error SimpleRemoteEPCServer::handleResult(
     uint64_t SeqNo, ExecutorAddr TagAddr,
     SimpleRemoteEPCArgBytesVector ArgBytes) {
-  std::promise<shared::WrapperFunctionResult> *P = nullptr;
+  std::promise<shared::WrapperFunctionBuffer> *P = nullptr;
   {
     std::lock_guard<std::mutex> Lock(ServerStateMutex);
     auto I = PendingJITDispatchResults.find(SeqNo);
@@ -237,7 +237,7 @@ Error SimpleRemoteEPCServer::handleResult(
     PendingJITDispatchResults.erase(I);
     releaseSeqNo(SeqNo);
   }
-  auto R = shared::WrapperFunctionResult::allocate(ArgBytes.size());
+  auto R = shared::WrapperFunctionBuffer::allocate(ArgBytes.size());
   memcpy(R.data(), ArgBytes.data(), ArgBytes.size());
   P->set_value(std::move(R));
   return Error::success();
@@ -248,9 +248,9 @@ void SimpleRemoteEPCServer::handleCallWrapper(
     SimpleRemoteEPCArgBytesVector ArgBytes) {
   D->dispatch([this, RemoteSeqNo, TagAddr, ArgBytes = std::move(ArgBytes)]() {
     using WrapperFnTy =
-        shared::CWrapperFunctionResult (*)(const char *, size_t);
+        shared::CWrapperFunctionBuffer (*)(const char *, size_t);
     auto *Fn = TagAddr.toPtr<WrapperFnTy>();
-    shared::WrapperFunctionResult ResultBytes(
+    shared::WrapperFunctionBuffer ResultBytes(
         Fn(ArgBytes.data(), ArgBytes.size()));
     if (auto Err = sendMessage(SimpleRemoteEPCOpcode::Result, RemoteSeqNo,
                                ExecutorAddr(),
@@ -259,16 +259,16 @@ void SimpleRemoteEPCServer::handleCallWrapper(
   });
 }
 
-shared::WrapperFunctionResult
+shared::WrapperFunctionBuffer
 SimpleRemoteEPCServer::doJITDispatch(const void *FnTag, const char *ArgData,
                                      size_t ArgSize) {
   uint64_t SeqNo;
-  std::promise<shared::WrapperFunctionResult> ResultP;
+  std::promise<shared::WrapperFunctionBuffer> ResultP;
   auto ResultF = ResultP.get_future();
   {
     std::lock_guard<std::mutex> Lock(ServerStateMutex);
     if (RunState != ServerRunning)
-      return shared::WrapperFunctionResult::createOutOfBandError(
+      return shared::WrapperFunctionBuffer::createOutOfBandError(
           "jit_dispatch not available (EPC server shut down)");
 
     SeqNo = getNextSeqNo();
@@ -283,7 +283,7 @@ SimpleRemoteEPCServer::doJITDispatch(const void *FnTag, const char *ArgData,
   return ResultF.get();
 }
 
-shared::CWrapperFunctionResult
+shared::CWrapperFunctionBuffer
 SimpleRemoteEPCServer::jitDispatchEntry(void *DispatchCtx, const void *FnTag,
                                         const char *ArgData, size_t ArgSize) {
   return reinterpret_cast<SimpleRemoteEPCServer *>(DispatchCtx)
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp
index 3a9aa54155ba2..06dce487f7a18 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp
@@ -20,7 +20,7 @@ using namespace llvm;
 using namespace llvm::orc;
 using namespace llvm::orc::shared;
 
-static orc::shared::CWrapperFunctionResult
+static orc::shared::CWrapperFunctionBuffer
 llvm_orc_rt_alt_UnwindInfoManager_register(const char *ArgData,
                                            size_t ArgSize) {
   using SPSSig = SPSError(SPSSequence<SPSExecutorAddrRange>, SPSExecutorAddr,
@@ -37,7 +37,7 @@ llvm_orc_rt_alt_UnwindInfoManager_register(const char *ArgData,
       .release();
 }
 
-static orc::shared::CWrapperFunctionResult
+static orc::shared::CWrapperFunctionBuffer
 llvm_orc_rt_alt_UnwindInfoManager_deregister(const char *ArgData,
                                              size_t ArgSize) {
   using SPSSig = SPSError(SPSSequence<SPSExecutorAddrRange>);
diff --git a/llvm/unittests/ExecutionEngine/Orc/CallSPSViaEPCTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CallSPSViaEPCTest.cpp
index 7e3d468ac8552..aa3b96fda45c3 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CallSPSViaEPCTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CallSPSViaEPCTest.cpp
@@ -19,11 +19,11 @@ using namespace llvm;
 using namespace llvm::orc;
 using namespace llvm::orc::shared;
 
-static CWrapperFunctionResult voidWrapper(const char *ArgData, size_t ArgSize) {
+static CWrapperFunctionBuffer voidWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<void()>::handle(ArgData, ArgSize, []() {}).release();
 }
 
-static CWrapperFunctionResult mainWrapper(const char *ArgData, size_t ArgSize) {
+static CWrapperFunctionBuffer mainWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<int32_t(SPSSequence<SPSString>)>::handle(
              ArgData, ArgSize,
              [](std::vector<std::string> Args) -> int32_t {
diff --git a/llvm/unittests/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerTest.cpp
index 2c6650d25a0ec..fe0ff4f4c0a2a 100644
--- a/llvm/unittests/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManagerTest.cpp
@@ -82,14 +82,14 @@ class SimpleAllocator {
   DenseMap<void *, sys::OwningMemoryBlock> Blocks;
 };
 
-CWrapperFunctionResult testReserve(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testReserve(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<rt::SPSSimpleExecutorMemoryManagerReserveSignature>::
       handle(ArgData, ArgSize,
              makeMethodWrapperHandler(&SimpleAllocator::reserve))
           .release();
 }
 
-CWrapperFunctionResult testInitialize(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testInitialize(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<
              rt::SPSSimpleExecutorMemoryManagerInitializeSignature>::
       handle(ArgData, ArgSize,
@@ -97,7 +97,7 @@ CWrapperFunctionResult testInitialize(const char *ArgData, size_t ArgSize) {
           .release();
 }
 
-CWrapperFunctionResult testRelease(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testRelease(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<rt::SPSSimpleExecutorMemoryManagerReleaseSignature>::
       handle(ArgData, ArgSize,
              makeMethodWrapperHandler(&SimpleAllocator::release))
diff --git a/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp b/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
index a72dc5f7af7a6..86c7a2a79c091 100644
--- a/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/EPCGenericMemoryAccessTest.cpp
@@ -19,7 +19,7 @@ using namespace llvm::orc::shared;
 namespace {
 
 template <typename WriteT, typename SPSWriteT>
-CWrapperFunctionResult testWriteUInts(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testWriteUInts(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<void(SPSSequence<SPSWriteT>)>::handle(
              ArgData, ArgSize,
              [](std::vector<WriteT> Ws) {
@@ -29,7 +29,7 @@ CWrapperFunctionResult testWriteUInts(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-CWrapperFunctionResult testWritePointers(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testWritePointers(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<void(SPSSequence<SPSMemoryAccessPointerWrite>)>::
       handle(ArgData, ArgSize,
              [](std::vector<tpctypes::PointerWrite> Ws) {
@@ -39,7 +39,7 @@ CWrapperFunctionResult testWritePointers(const char *ArgData, size_t ArgSize) {
           .release();
 }
 
-CWrapperFunctionResult testWriteBuffers(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testWriteBuffers(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<void(SPSSequence<SPSMemoryAccessBufferWrite>)>::handle(
              ArgData, ArgSize,
              [](std::vector<tpctypes::BufferWrite> Ws) {
@@ -51,7 +51,7 @@ CWrapperFunctionResult testWriteBuffers(const char *ArgData, size_t ArgSize) {
 }
 
 template <typename ReadT>
-CWrapperFunctionResult testReadUInts(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testReadUInts(const char *ArgData, size_t ArgSize) {
   using SPSSig = SPSSequence<ReadT>(SPSSequence<SPSExecutorAddr>);
   return WrapperFunction<SPSSig>::handle(ArgData, ArgSize,
                                          [](std::vector<ExecutorAddr> Rs) {
@@ -65,7 +65,7 @@ CWrapperFunctionResult testReadUInts(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-CWrapperFunctionResult testReadPointers(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testReadPointers(const char *ArgData, size_t ArgSize) {
   using SPSSig = SPSSequence<SPSExecutorAddr>(SPSSequence<SPSExecutorAddr>);
   return WrapperFunction<SPSSig>::handle(
              ArgData, ArgSize,
@@ -80,7 +80,7 @@ CWrapperFunctionResult testReadPointers(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-CWrapperFunctionResult testReadBuffers(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testReadBuffers(const char *ArgData, size_t ArgSize) {
   using SPSSig =
       SPSSequence<SPSSequence<uint8_t>>(SPSSequence<SPSExecutorAddrRange>);
   return WrapperFunction<SPSSig>::handle(
@@ -99,7 +99,7 @@ CWrapperFunctionResult testReadBuffers(const char *ArgData, size_t ArgSize) {
       .release();
 }
 
-CWrapperFunctionResult testReadStrings(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer testReadStrings(const char *ArgData, size_t ArgSize) {
   using SPSSig = SPSSequence<SPSString>(SPSSequence<SPSExecutorAddr>);
   return WrapperFunction<SPSSig>::handle(
              ArgData, ArgSize,
diff --git a/llvm/unittests/ExecutionEngine/Orc/ExecutionSessionWrapperFunctionCallsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ExecutionSessionWrapperFunctionCallsTest.cpp
index 1f7067502b15b..6c53336b49365 100644
--- a/llvm/unittests/ExecutionEngine/Orc/ExecutionSessionWrapperFunctionCallsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/ExecutionSessionWrapperFunctionCallsTest.cpp
@@ -20,7 +20,7 @@ using namespace llvm;
 using namespace llvm::orc;
 using namespace llvm::orc::shared;
 
-static CWrapperFunctionResult addWrapper(const char *ArgData, size_t ArgSize) {
+static CWrapperFunctionBuffer addWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<int32_t(int32_t, int32_t)>::handle(
              ArgData, ArgSize, [](int32_t X, int32_t Y) { return X + Y; })
       .release();
@@ -31,7 +31,7 @@ static void addAsyncWrapper(unique_function<void(int32_t)> SendResult,
   SendResult(X + Y);
 }
 
-static CWrapperFunctionResult voidWrapper(const char *ArgData, size_t ArgSize) {
+static CWrapperFunctionBuffer voidWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<void()>::handle(ArgData, ArgSize, []() {}).release();
 }
 
@@ -99,12 +99,12 @@ TEST(ExecutionSessionWrapperFunctionCalls, RegisterAsyncHandlerAndRun) {
 
   using ArgSerialization = SPSArgList<int32_t, int32_t>;
   size_t ArgBufferSize = ArgSerialization::size(1, 2);
-  auto ArgBuffer = WrapperFunctionResult::allocate(ArgBufferSize);
+  auto ArgBuffer = WrapperFunctionBuffer::allocate(ArgBufferSize);
   SPSOutputBuffer OB(ArgBuffer.data(), ArgBuffer.size());
   EXPECT_TRUE(ArgSerialization::serialize(OB, 1, 2));
 
   ES.runJITDispatchHandler(
-      [&](WrapperFunctionResult ResultBuffer) {
+      [&](WrapperFunctionBuffer ResultBuffer) {
         int32_t Result;
         SPSInputBuffer IB(ResultBuffer.data(), ResultBuffer.size());
         EXPECT_TRUE(SPSArgList<int32_t>::deserialize(IB, Result));
diff --git a/llvm/unittests/ExecutionEngine/Orc/MemoryMapperTest.cpp b/llvm/unittests/ExecutionEngine/Orc/MemoryMapperTest.cpp
index 1174493397a62..b4051790c3511 100644
--- a/llvm/unittests/ExecutionEngine/Orc/MemoryMapperTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/MemoryMapperTest.cpp
@@ -49,7 +49,7 @@ Error release(MemoryMapper &M, const std::vector<ExecutorAddr> &Reservations) {
 }
 
 // A basic function to be used as both initializer/deinitializer
-CWrapperFunctionResult incrementWrapper(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer incrementWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
              ArgData, ArgSize,
              [](ExecutorAddr A) -> Error {
diff --git a/llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp b/llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp
index 7775f3cdf31f3..025b32c1f4b5b 100644
--- a/llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/SharedMemoryMapperTest.cpp
@@ -23,7 +23,7 @@ using namespace llvm::orc::rt_bootstrap;
 #if (defined(LLVM_ON_UNIX) && !defined(__ANDROID__)) || defined(_WIN32)
 
 // A basic function to be used as both initializer/deinitializer
-CWrapperFunctionResult incrementWrapper(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer incrementWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
              ArgData, ArgSize,
              [](ExecutorAddr A) -> Error {
diff --git a/llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp
index 005c67bcaa0ca..070ad8ef7de2d 100644
--- a/llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/SimpleExecutorMemoryManagerTest.cpp
@@ -19,7 +19,7 @@ using namespace llvm::orc::rt_bootstrap;
 
 namespace {
 
-CWrapperFunctionResult incrementWrapper(const char *ArgData, size_t ArgSize) {
+CWrapperFunctionBuffer incrementWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<SPSError(SPSExecutorAddr)>::handle(
              ArgData, ArgSize,
              [](ExecutorAddr A) -> Error {
diff --git a/llvm/unittests/ExecutionEngine/Orc/WrapperFunctionUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/WrapperFunctionUtilsTest.cpp
index 8de2412fed4d0..39f17bce17e54 100644
--- a/llvm/unittests/ExecutionEngine/Orc/WrapperFunctionUtilsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/WrapperFunctionUtilsTest.cpp
@@ -21,39 +21,39 @@ namespace {
 constexpr const char *TestString = "test string";
 } // end anonymous namespace
 
-TEST(WrapperFunctionUtilsTest, DefaultWrapperFunctionResult) {
-  WrapperFunctionResult R;
+TEST(WrapperFunctionUtilsTest, DefaultWrapperFunctionBuffer) {
+  WrapperFunctionBuffer R;
   EXPECT_TRUE(R.empty());
   EXPECT_EQ(R.size(), 0U);
   EXPECT_EQ(R.getOutOfBandError(), nullptr);
 }
 
-TEST(WrapperFunctionUtilsTest, WrapperFunctionResultFromRange) {
-  auto R = WrapperFunctionResult::copyFrom(TestString, strlen(TestString) + 1);
+TEST(WrapperFunctionUtilsTest, WrapperFunctionBufferFromRange) {
+  auto R = WrapperFunctionBuffer::copyFrom(TestString, strlen(TestString) + 1);
   EXPECT_EQ(R.size(), strlen(TestString) + 1);
   EXPECT_TRUE(strcmp(R.data(), TestString) == 0);
   EXPECT_FALSE(R.empty());
   EXPECT_EQ(R.getOutOfBandError(), nullptr);
 }
 
-TEST(WrapperFunctionUtilsTest, WrapperFunctionResultFromCString) {
-  auto R = WrapperFunctionResult::copyFrom(TestString);
+TEST(WrapperFunctionUtilsTest, WrapperFunctionBufferFromCString) {
+  auto R = WrapperFunctionBuffer::copyFrom(TestString);
   EXPECT_EQ(R.size(), strlen(TestString) + 1);
   EXPECT_TRUE(strcmp(R.data(), TestString) == 0);
   EXPECT_FALSE(R.empty());
   EXPECT_EQ(R.getOutOfBandError(), nullptr);
 }
 
-TEST(WrapperFunctionUtilsTest, WrapperFunctionResultFromStdString) {
-  auto R = WrapperFunctionResult::copyFrom(std::string(TestString));
+TEST(WrapperFunctionUtilsTest, WrapperFunctionBufferFromStdString) {
+  auto R = WrapperFunctionBuffer::copyFrom(std::string(TestString));
   EXPECT_EQ(R.size(), strlen(TestString) + 1);
   EXPECT_TRUE(strcmp(R.data(), TestString) == 0);
   EXPECT_FALSE(R.empty());
   EXPECT_EQ(R.getOutOfBandError(), nullptr);
 }
 
-TEST(WrapperFunctionUtilsTest, WrapperFunctionResultFromOutOfBandError) {
-  auto R = WrapperFunctionResult::createOutOfBandError(TestString);
+TEST(WrapperFunctionUtilsTest, WrapperFunctionBufferFromOutOfBandError) {
+  auto R = WrapperFunctionBuffer::createOutOfBandError(TestString);
   EXPECT_FALSE(R.empty());
   EXPECT_TRUE(strcmp(R.getOutOfBandError(), TestString) == 0);
 }
@@ -73,17 +73,17 @@ class AddClass {
   int32_t X;
 };
 
-static WrapperFunctionResult voidNoopWrapper(const char *ArgData,
+static WrapperFunctionBuffer voidNoopWrapper(const char *ArgData,
                                              size_t ArgSize) {
   return WrapperFunction<void()>::handle(ArgData, ArgSize, voidNoop);
 }
 
-static WrapperFunctionResult addWrapper(const char *ArgData, size_t ArgSize) {
+static WrapperFunctionBuffer addWrapper(const char *ArgData, size_t ArgSize) {
   return WrapperFunction<int32_t(int32_t, int32_t)>::handle(
       ArgData, ArgSize, [](int32_t X, int32_t Y) -> int32_t { return X + Y; });
 }
 
-static WrapperFunctionResult addMethodWrapper(const char *ArgData,
+static WrapperFunctionBuffer addMethodWrapper(const char *ArgData,
                                               size_t ArgSize) {
   return WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::handle(
       ArgData, ArgSize, makeMethodWrapperHandler(&AddClass::addMethod));
@@ -112,27 +112,27 @@ static void voidNoopAsync(unique_function<void(SPSEmpty)> SendResult) {
   SendResult(SPSEmpty());
 }
 
-static WrapperFunctionResult voidNoopAsyncWrapper(const char *ArgData,
+static WrapperFunctionBuffer voidNoopAsyncWrapper(const char *ArgData,
                                                   size_t ArgSize) {
-  std::promise<WrapperFunctionResult> RP;
+  std::promise<WrapperFunctionBuffer> RP;
   auto RF = RP.get_future();
 
   WrapperFunction<void()>::handleAsync(
       ArgData, ArgSize,
-      [&](WrapperFunctionResult R) { RP.set_value(std::move(R)); },
+      [&](WrapperFunctionBuffer R) { RP.set_value(std::move(R)); },
       voidNoopAsync);
 
   return RF.get();
 }
 
-static WrapperFunctionResult addAsyncWrapper(const char *ArgData,
+static WrapperFunctionBuffer addAsyncWrapper(const char *ArgData,
                                              size_t ArgSize) {
-  std::promise<WrapperFunctionResult> RP;
+  std::promise<WrapperFunctionBuffer> RP;
   auto RF = RP.get_future();
 
   WrapperFunction<int32_t(int32_t, int32_t)>::handleAsync(
       ArgData, ArgSize,
-      [&](WrapperFunctionResult R) { RP.set_value(std::move(R)); },
+      [&](WrapperFunctionBuffer R) { RP.set_value(std::move(R)); },
       [](unique_function<void(int32_t)> SendResult, int32_t X, int32_t Y) {
         SendResult(X + Y);
       });
@@ -150,12 +150,12 @@ TEST(WrapperFunctionUtilsTest, WrapperFunctionCallAndHandleAsyncRet) {
   EXPECT_EQ(Result, (int32_t)3);
 }
 
-static WrapperFunctionResult failingWrapper(const char *ArgData,
+static WrapperFunctionBuffer failingWrapper(const char *ArgData,
                                             size_t ArgSize) {
-  return WrapperFunctionResult::createOutOfBandError("failed");
+  return WrapperFunctionBuffer::createOutOfBandError("failed");
 }
 
-void asyncFailingWrapperCaller(unique_function<void(WrapperFunctionResult)> F,
+void asyncFailingWrapperCaller(unique_function<void(WrapperFunctionBuffer)> F,
                                const char *ArgData, size_t ArgSize) {
   F(failingWrapper(ArgData, ArgSize));
 }



More information about the llvm-commits mailing list