forked from OSchip/llvm-project
[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:
parent
4b477e7763
commit
19402ce79a
|
@ -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
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue