diff options
| author | Ross Brunton <ross@codeplay.com> | 2025-05-20 14:50:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-20 08:50:20 -0500 |
| commit | 050892d2f879d278b3342edde028f62bf77d00d2 (patch) | |
| tree | d2dcb4f7a3117a00cdbf37265b428c35c44551d7 /offload/plugins-nextgen/common/include/PluginInterface.h | |
| parent | ba52b56e1864319b1044a8c6cd543be74c33b4d4 (diff) | |
[Offload] Use new error code handling mechanism and lower-case messages (#139275)
[Offload] Use new error code handling mechanism
This removes the old ErrorCode-less error method and requires
every user to provide a concrete error code. All calls have been
updated.
In addition, for consistency with error messages elsewhere in LLVM, all
messages have been made to start lower case.
Diffstat (limited to 'offload/plugins-nextgen/common/include/PluginInterface.h')
| -rw-r--r-- | offload/plugins-nextgen/common/include/PluginInterface.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/offload/plugins-nextgen/common/include/PluginInterface.h b/offload/plugins-nextgen/common/include/PluginInterface.h index fe603c6269b3..fa13e26bc348 100644 --- a/offload/plugins-nextgen/common/include/PluginInterface.h +++ b/offload/plugins-nextgen/common/include/PluginInterface.h @@ -1383,22 +1383,16 @@ static inline Error success() { return Error::success(); } /// Create an Offload error. template <typename... ArgsTy> static Error error(error::ErrorCode Code, const char *ErrFmt, ArgsTy... Args) { - std::string Buffer; - raw_string_ostream(Buffer) << format(ErrFmt, Args...); - return make_error<error::OffloadError>(Code, Buffer); -} - -template <typename... ArgsTy> -static Error error(const char *ErrFmt, ArgsTy... Args) { - return error(error::ErrorCode::UNKNOWN, ErrFmt, Args...); + return error::createOffloadError(Code, ErrFmt, Args...); } inline Error error(error::ErrorCode Code, const char *S) { return make_error<error::OffloadError>(Code, S); } -inline Error error(const char *S) { - return make_error<error::OffloadError>(error::ErrorCode::UNKNOWN, S); +inline Error error(error::ErrorCode Code, Error &&OtherError, + const char *Context) { + return error::createOffloadError(Code, std::move(OtherError), Context); } /// Check the plugin-specific error code and return an error or success |
