[ORC] Thread Error/Expected through the RPC library.
This replaces use of std::error_code and ErrorOr in the ORC RPC support library
with Error and Expected. This required updating the OrcRemoteTarget API, Client,
and server code, as well as updating the Orc C API.
This patch also fixes several instances where Errors were dropped.
llvm-svn: 267457
diff --git a/llvm/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp
index a27e649..fedf163 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp
@@ -25,12 +25,12 @@
class DummyStubsManager : public orc::IndirectStubsManager {
public:
- std::error_code createStub(StringRef StubName, TargetAddress InitAddr,
+ Error createStub(StringRef StubName, TargetAddress InitAddr,
JITSymbolFlags Flags) override {
llvm_unreachable("Not implemented");
}
- std::error_code createStubs(const StubInitsMap &StubInits) override {
+ Error createStubs(const StubInitsMap &StubInits) override {
llvm_unreachable("Not implemented");
}
@@ -42,7 +42,7 @@
llvm_unreachable("Not implemented");
}
- std::error_code updatePointer(StringRef Name,
+ Error updatePointer(StringRef Name,
TargetAddress NewAddr) override {
llvm_unreachable("Not implemented");
}
diff --git a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
index 9bf861a..b2680aa 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
@@ -29,7 +29,7 @@
QueueChannel(Queue &InQueue, Queue &OutQueue)
: InQueue(InQueue), OutQueue(OutQueue) {}
- std::error_code readBytes(char *Dst, unsigned Size) override {
+ Error readBytes(char *Dst, unsigned Size) override {
while (Size != 0) {
// If there's nothing to read then yield.
while (InQueue.empty())
@@ -43,17 +43,17 @@
InQueue.pop();
}
}
- return std::error_code();
+ return Error::success();
}
- std::error_code appendBytes(const char *Src, unsigned Size) override {
+ Error appendBytes(const char *Src, unsigned Size) override {
std::lock_guard<std::mutex> Lock(OutQueue.getLock());
while (Size--)
OutQueue.push(*Src++);
- return std::error_code();
+ return Error::success();
}
- std::error_code send() override { return std::error_code(); }
+ Error send() override { return Error::success(); }
private:
Queue &InQueue;
@@ -95,7 +95,7 @@
[&](bool &B) {
EXPECT_EQ(B, true)
<< "Bool serialization broken";
- return std::error_code();
+ return Error::success();
});
EXPECT_FALSE(EC) << "Simple expect over queue failed";
}
@@ -123,7 +123,7 @@
{
// Expect a call to Proc1.
auto EC = expect<IntInt>(C2,
- [&](int32_t I) {
+ [&](int32_t I) -> Expected<int32_t> {
EXPECT_EQ(I, 21)
<< "Bool serialization broken";
return 2 * I;
@@ -202,7 +202,7 @@
<< "std::string serialization broken";
EXPECT_EQ(v, std::vector<int>({42, 7}))
<< "std::vector serialization broken";
- return std::error_code();
+ return Error::success();
});
EXPECT_FALSE(EC) << "Big (serialization test) call over queue failed";
}