[llvm] [Offload] Use llvm::Error throughout liboffload internals (PR #140879)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Tue May 27 05:52:30 PDT 2025
================
@@ -69,48 +69,29 @@ struct ErrPtrHash {
using ErrSetT = std::unordered_set<ErrPtrT, ErrPtrHash, ErrPtrEqual>;
ErrSetT &errors();
-struct ol_impl_result_t {
- ol_impl_result_t(std::nullptr_t) : Result(OL_SUCCESS) {}
- ol_impl_result_t(ol_errc_t Code) {
- if (Code == OL_ERRC_SUCCESS) {
- Result = nullptr;
- } else {
- auto Err = std::unique_ptr<ol_error_struct_t>(
- new ol_error_struct_t{Code, nullptr});
- Result = errors().emplace(std::move(Err)).first->get();
- }
+namespace {
+ol_errc_t GetErrorCode(std::error_code Code) {
+ if (Code.category() ==
+ error::make_error_code(error::ErrorCode::SUCCESS).category()) {
+ return static_cast<ol_errc_t>(Code.value());
}
----------------
jhuber6 wrote:
```suggestion
error::make_error_code(error::ErrorCode::SUCCESS).category())
return static_cast<ol_errc_t>(Code.value());
```
https://github.com/llvm/llvm-project/pull/140879
More information about the llvm-commits
mailing list