[llvm] [Offload] Use llvm::Error throughout liboffload internals (PR #140879)
Callum Fare via llvm-commits
llvm-commits at lists.llvm.org
Wed May 21 04:18:30 PDT 2025
================
@@ -13,20 +13,24 @@
//===----------------------------------------------------------------------===//
#include "OffloadAPI.h"
+#include "Shared/OffloadError.h"
+#include "llvm/Support/Error.h"
#include <cstring>
template <typename T, typename Assign>
-ol_errc_t getInfoImpl(size_t ParamValueSize, void *ParamValue,
- size_t *ParamValueSizeRet, T Value, size_t ValueSize,
- Assign &&AssignFunc) {
+llvm::Error getInfoImpl(size_t ParamValueSize, void *ParamValue,
+ size_t *ParamValueSizeRet, T Value, size_t ValueSize,
+ Assign &&AssignFunc) {
if (!ParamValue && !ParamValueSizeRet) {
- return OL_ERRC_INVALID_NULL_POINTER;
+ return error::createOffloadError(error::ErrorCode::INVALID_NULL_POINTER,
----------------
callumfare wrote:
Could we have an overload of `createOffloadError` that takes a `ol_errc_t`? That way we could use `OL_ERRC_INVALID_NULL_POINTER` here instead of the longer `error::ErrorCode::INVALID_NULL_POINTER`. The same is true of the autogenerated entry point code. It's purely subjective but that would seem tidier to me.
https://github.com/llvm/llvm-project/pull/140879
More information about the llvm-commits
mailing list