1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[Support] Add a C-API function to create a StringError instance.

This will allow C API clients to return errors from callbacks. This
functionality will be used in upcoming Orc C-bindings functions.
This commit is contained in:
Lang Hames 2020-10-15 17:31:14 -07:00
parent dff52178bf
commit 3dc14bfbf7
2 changed files with 9 additions and 0 deletions

View File

@ -62,6 +62,11 @@ void LLVMDisposeErrorMessage(char *ErrMsg);
*/
LLVMErrorTypeId LLVMGetStringErrorTypeId(void);
/**
* Create a StringError.
*/
LLVMErrorRef LLVMCreateStringError(const char *ErrMsg);
LLVM_C_EXTERN_C_END
#endif

View File

@ -168,3 +168,7 @@ void LLVMDisposeErrorMessage(char *ErrMsg) { delete[] ErrMsg; }
LLVMErrorTypeId LLVMGetStringErrorTypeId() {
return reinterpret_cast<void *>(&StringError::ID);
}
LLVMErrorRef LLVMCreateStringError(const char *ErrMsg) {
return wrap(make_error<StringError>(ErrMsg, inconvertibleErrorCode()));
}