diff options
author | Lang Hames <lhames@gmail.com> | 2020-10-15 17:31:14 -0700 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2020-10-19 01:59:04 -0700 |
commit | 19402ce79a896563823fff45b853f229df4c1261 (patch) | |
tree | 9fc2af882c39f42064f900928ecc55d4bd6b2c42 /llvm/lib/Support/Error.cpp | |
parent | 4b477e776382a083e2bee2c1eb66068ad9186189 (diff) | |
download | llvm-19402ce79a896563823fff45b853f229df4c1261.zip llvm-19402ce79a896563823fff45b853f229df4c1261.tar.gz llvm-19402ce79a896563823fff45b853f229df4c1261.tar.bz2 |
[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.
Diffstat (limited to 'llvm/lib/Support/Error.cpp')
-rw-r--r-- | llvm/lib/Support/Error.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp index 315a11e..e7ab438 100644 --- a/llvm/lib/Support/Error.cpp +++ b/llvm/lib/Support/Error.cpp @@ -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())); +} |