aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Error.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2020-10-15 17:31:14 -0700
committerLang Hames <lhames@gmail.com>2020-10-19 01:59:04 -0700
commit19402ce79a896563823fff45b853f229df4c1261 (patch)
tree9fc2af882c39f42064f900928ecc55d4bd6b2c42 /llvm/lib/Support/Error.cpp
parent4b477e776382a083e2bee2c1eb66068ad9186189 (diff)
downloadllvm-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.cpp4
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()));
+}