Skip to content

Commit d32239b

Browse files
committed
[ORC] Move UnsupportedExecutorProcessControl into unittests.
The UnsupportedExecutorProcessControl implementation is only used in unit tests, so move it out of the public headers.
1 parent aeaf319 commit d32239b

File tree

3 files changed

+43
-41
lines changed

3 files changed

+43
-41
lines changed

llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -425,47 +425,6 @@ class LLVM_ABI InProcessMemoryAccess
425425
bool IsArch64Bit;
426426
};
427427

428-
/// A ExecutorProcessControl instance that asserts if any of its methods are
429-
/// used. Suitable for use is unit tests, and by ORC clients who haven't moved
430-
/// to ExecutorProcessControl-based APIs yet.
431-
class UnsupportedExecutorProcessControl : public ExecutorProcessControl,
432-
private InProcessMemoryAccess {
433-
public:
434-
UnsupportedExecutorProcessControl(
435-
std::shared_ptr<SymbolStringPool> SSP = nullptr,
436-
std::unique_ptr<TaskDispatcher> D = nullptr, const std::string &TT = "",
437-
unsigned PageSize = 0)
438-
: ExecutorProcessControl(
439-
SSP ? std::move(SSP) : std::make_shared<SymbolStringPool>(),
440-
D ? std::move(D) : std::make_unique<InPlaceTaskDispatcher>()),
441-
InProcessMemoryAccess(Triple(TT).isArch64Bit()) {
442-
this->TargetTriple = Triple(TT);
443-
this->PageSize = PageSize;
444-
this->MemAccess = this;
445-
}
446-
447-
Expected<int32_t> runAsMain(ExecutorAddr MainFnAddr,
448-
ArrayRef<std::string> Args) override {
449-
llvm_unreachable("Unsupported");
450-
}
451-
452-
Expected<int32_t> runAsVoidFunction(ExecutorAddr VoidFnAddr) override {
453-
llvm_unreachable("Unsupported");
454-
}
455-
456-
Expected<int32_t> runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override {
457-
llvm_unreachable("Unsupported");
458-
}
459-
460-
void callWrapperAsync(ExecutorAddr WrapperFnAddr,
461-
IncomingWFRHandler OnComplete,
462-
ArrayRef<char> ArgBuffer) override {
463-
llvm_unreachable("Unsupported");
464-
}
465-
466-
Error disconnect() override { return Error::success(); }
467-
};
468-
469428
/// A ExecutorProcessControl implementation targeting the current process.
470429
class LLVM_ABI SelfExecutorProcessControl : public ExecutorProcessControl,
471430
private InProcessMemoryAccess,

llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "llvm/Testing/Support/Error.h"
2020
#include "gtest/gtest.h"
2121

22+
#include "OrcTestCommon.h"
23+
2224
using namespace llvm;
2325
using namespace llvm::jitlink;
2426
using namespace llvm::orc;

llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,47 @@ class CoreAPIsBasedStandardTest : public testing::Test {
8282
unique_function<void(std::unique_ptr<Task>)> DispatchOverride;
8383
};
8484

85+
/// A ExecutorProcessControl instance that asserts if any of its methods are
86+
/// used. Suitable for use is unit tests, and by ORC clients who haven't moved
87+
/// to ExecutorProcessControl-based APIs yet.
88+
class UnsupportedExecutorProcessControl : public ExecutorProcessControl,
89+
private InProcessMemoryAccess {
90+
public:
91+
UnsupportedExecutorProcessControl(
92+
std::shared_ptr<SymbolStringPool> SSP = nullptr,
93+
std::unique_ptr<TaskDispatcher> D = nullptr, const std::string &TT = "",
94+
unsigned PageSize = 0)
95+
: ExecutorProcessControl(
96+
SSP ? std::move(SSP) : std::make_shared<SymbolStringPool>(),
97+
D ? std::move(D) : std::make_unique<InPlaceTaskDispatcher>()),
98+
InProcessMemoryAccess(Triple(TT).isArch64Bit()) {
99+
this->TargetTriple = Triple(TT);
100+
this->PageSize = PageSize;
101+
this->MemAccess = this;
102+
}
103+
104+
Expected<int32_t> runAsMain(ExecutorAddr MainFnAddr,
105+
ArrayRef<std::string> Args) override {
106+
llvm_unreachable("Unsupported");
107+
}
108+
109+
Expected<int32_t> runAsVoidFunction(ExecutorAddr VoidFnAddr) override {
110+
llvm_unreachable("Unsupported");
111+
}
112+
113+
Expected<int32_t> runAsIntFunction(ExecutorAddr IntFnAddr, int Arg) override {
114+
llvm_unreachable("Unsupported");
115+
}
116+
117+
void callWrapperAsync(ExecutorAddr WrapperFnAddr,
118+
IncomingWFRHandler OnComplete,
119+
ArrayRef<char> ArgBuffer) override {
120+
llvm_unreachable("Unsupported");
121+
}
122+
123+
Error disconnect() override { return Error::success(); }
124+
};
125+
85126
} // end namespace orc
86127

87128
class OrcNativeTarget {

0 commit comments

Comments
 (0)