[llvm] d32239b - [ORC] Move UnsupportedExecutorProcessControl into unittests.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 25 00:44:29 PDT 2025


Author: Lang Hames
Date: 2025-06-25T17:44:23+10:00
New Revision: d32239b461ed61646c40e94970f5eac34aa84680

URL: https://github.com/llvm/llvm-project/commit/d32239b461ed61646c40e94970f5eac34aa84680
DIFF: https://github.com/llvm/llvm-project/commit/d32239b461ed61646c40e94970f5eac34aa84680.diff

LOG: [ORC] Move UnsupportedExecutorProcessControl into unittests.

The UnsupportedExecutorProcessControl implementation is only used in unit
tests, so move it out of the public headers.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
    llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp
    llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
index e63f5f7842520..4f0e151aceca0 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
@@ -425,47 +425,6 @@ class LLVM_ABI InProcessMemoryAccess
   bool IsArch64Bit;
 };
 
-/// A ExecutorProcessControl instance that asserts if any of its methods are
-/// used. Suitable for use is unit tests, and by ORC clients who haven't moved
-/// to ExecutorProcessControl-based APIs yet.
-class UnsupportedExecutorProcessControl : public ExecutorProcessControl,
-                                          private InProcessMemoryAccess {
-public:
-  UnsupportedExecutorProcessControl(
-      std::shared_ptr<SymbolStringPool> SSP = nullptr,
-      std::unique_ptr<TaskDispatcher> D = nullptr, const std::string &TT = "",
-      unsigned PageSize = 0)
-      : ExecutorProcessControl(
-            SSP ? std::move(SSP) : std::make_shared<SymbolStringPool>(),
-            D ? std::move(D) : std::make_unique<InPlaceTaskDispatcher>()),
-        InProcessMemoryAccess(Triple(TT).isArch64Bit()) {
-    this->TargetTriple = Triple(TT);
-    this->PageSize = PageSize;
-    this->MemAccess = this;
-  }
-
-  Expected<int32_t> runAsMain(ExecutorAddr MainFnAddr,
-                              ArrayRef<std::string> Args) override {
-    llvm_unreachable("Unsupported");
-  }
-
-  Expected<int32_t> runAsVoidFunction(ExecutorAddr VoidFnAddr) override {
-    llvm_unreachable("Unsupported");
-  }
-
-  Expected<int32_t> runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override {
-    llvm_unreachable("Unsupported");
-  }
-
-  void callWrapperAsync(ExecutorAddr WrapperFnAddr,
-                        IncomingWFRHandler OnComplete,
-                        ArrayRef<char> ArgBuffer) override {
-    llvm_unreachable("Unsupported");
-  }
-
-  Error disconnect() override { return Error::success(); }
-};
-
 /// A ExecutorProcessControl implementation targeting the current process.
 class LLVM_ABI SelfExecutorProcessControl : public ExecutorProcessControl,
                                             private InProcessMemoryAccess,

diff  --git a/llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp
index 0c2c06ec75d6e..8a6549b1b594e 100644
--- a/llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp
@@ -19,6 +19,8 @@
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
 
+#include "OrcTestCommon.h"
+
 using namespace llvm;
 using namespace llvm::jitlink;
 using namespace llvm::orc;

diff  --git a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
index 0981f4b8132bd..6675921c29eb4 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
@@ -82,6 +82,47 @@ class CoreAPIsBasedStandardTest : public testing::Test {
   unique_function<void(std::unique_ptr<Task>)> DispatchOverride;
 };
 
+/// A ExecutorProcessControl instance that asserts if any of its methods are
+/// used. Suitable for use is unit tests, and by ORC clients who haven't moved
+/// to ExecutorProcessControl-based APIs yet.
+class UnsupportedExecutorProcessControl : public ExecutorProcessControl,
+                                          private InProcessMemoryAccess {
+public:
+  UnsupportedExecutorProcessControl(
+      std::shared_ptr<SymbolStringPool> SSP = nullptr,
+      std::unique_ptr<TaskDispatcher> D = nullptr, const std::string &TT = "",
+      unsigned PageSize = 0)
+      : ExecutorProcessControl(
+            SSP ? std::move(SSP) : std::make_shared<SymbolStringPool>(),
+            D ? std::move(D) : std::make_unique<InPlaceTaskDispatcher>()),
+        InProcessMemoryAccess(Triple(TT).isArch64Bit()) {
+    this->TargetTriple = Triple(TT);
+    this->PageSize = PageSize;
+    this->MemAccess = this;
+  }
+
+  Expected<int32_t> runAsMain(ExecutorAddr MainFnAddr,
+                              ArrayRef<std::string> Args) override {
+    llvm_unreachable("Unsupported");
+  }
+
+  Expected<int32_t> runAsVoidFunction(ExecutorAddr VoidFnAddr) override {
+    llvm_unreachable("Unsupported");
+  }
+
+  Expected<int32_t> runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override {
+    llvm_unreachable("Unsupported");
+  }
+
+  void callWrapperAsync(ExecutorAddr WrapperFnAddr,
+                        IncomingWFRHandler OnComplete,
+                        ArrayRef<char> ArgBuffer) override {
+    llvm_unreachable("Unsupported");
+  }
+
+  Error disconnect() override { return Error::success(); }
+};
+
 } // end namespace orc
 
 class OrcNativeTarget {


        


More information about the llvm-commits mailing list