[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/include/llvm-c/OrcBindings.h b/llvm/include/llvm-c/OrcBindings.h
index 92e6ca3..4a2fa26 100644
--- a/llvm/include/llvm-c/OrcBindings.h
+++ b/llvm/include/llvm-c/OrcBindings.h
@@ -37,6 +37,11 @@
typedef uint64_t (*LLVMOrcLazyCompileCallbackFn)(LLVMOrcJITStackRef JITStack,
void *CallbackCtx);
+typedef enum {
+ LLVMOrcErrSuccess = 0,
+ LLVMOrcErrGeneric
+} LLVMOrcErrorCode;
+
/**
* Create an ORC JIT stack.
*
@@ -49,6 +54,14 @@
LLVMOrcJITStackRef LLVMOrcCreateInstance(LLVMTargetMachineRef TM);
/**
+ * Get the error message for the most recent error (if any).
+ *
+ * This message is owned by the ORC JIT Stack and will be freed when the stack
+ * is disposed of by LLVMOrcDisposeInstance.
+ */
+const char *LLVMOrcGetErrorMsg(LLVMOrcJITStackRef JITStack);
+
+/**
* Mangle the given symbol.
* Memory will be allocated for MangledSymbol to hold the result. The client
*/
@@ -58,7 +71,6 @@
/**
* Dispose of a mangled symbol.
*/
-
void LLVMOrcDisposeMangledSymbol(char *MangledSymbol);
/**
@@ -72,16 +84,16 @@
/**
* Create a named indirect call stub.
*/
-void LLVMOrcCreateIndirectStub(LLVMOrcJITStackRef JITStack,
- const char *StubName,
- LLVMOrcTargetAddress InitAddr);
+LLVMOrcErrorCode LLVMOrcCreateIndirectStub(LLVMOrcJITStackRef JITStack,
+ const char *StubName,
+ LLVMOrcTargetAddress InitAddr);
/**
* Set the pointer for the given indirect stub.
*/
-void LLVMOrcSetIndirectStubPointer(LLVMOrcJITStackRef JITStack,
- const char *StubName,
- LLVMOrcTargetAddress NewAddr);
+LLVMOrcErrorCode LLVMOrcSetIndirectStubPointer(LLVMOrcJITStackRef JITStack,
+ const char *StubName,
+ LLVMOrcTargetAddress NewAddr);
/**
* Add module to be eagerly compiled.