Skip to content

Commit 06d962a

Browse files
committed
[Offload] Respond to feedback and fix extra definition
1 parent e8e6651 commit 06d962a

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

offload/liboffload/API/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (CLANG_FORMAT)
2121
add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CMAKE_COMMAND}
2222
-E copy_if_different ${FILES_TO_COPY} ${GEN_DIR})
2323
add_custom_command(TARGET OffloadGenerate POST_BUILD COMMAND ${CMAKE_COMMAND}
24-
-E copy_if_different OffloadErrcodes.inc "${LIBOFFLOAD_ROOT}/../plugins-nextgen/common/include/OffloadErrcodes.inc")
24+
-E copy_if_different OffloadErrcodes.inc "${LIBOMPTARGET_INCLUDE_DIR}/Shared/OffloadErrcodes.inc")
2525
else()
2626
message(WARNING "clang-format was not found, so the OffloadGenerate target\
2727
will not be available. Offload will still build, but you will not be\

offload/plugins-nextgen/common/include/OffloadError.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,10 @@ namespace plugin {
2121

2222
enum class ErrorCode {
2323
#define OFFLOAD_ERRC(Name, _, Value) Name = Value,
24-
#include "OffloadErrcodes.inc"
24+
#include "Shared/OffloadErrcodes.inc"
2525
#undef OFFLOAD_ERRC
2626
};
2727

28-
class OffloadErrorCategory : public std::error_category {
29-
const char *name() const noexcept override { return "Offload Error"; }
30-
std::string message(int ev) const override {
31-
switch (static_cast<ErrorCode>(ev)) {
32-
#define OFFLOAD_ERRC(Name, Desc, Value) \
33-
case ErrorCode::Name: \
34-
return #Desc;
35-
#include "OffloadErrcodes.inc"
36-
#undef OFFLOAD_ERRC
37-
}
38-
}
39-
};
4028
} // namespace plugin
4129
} // namespace target
4230
} // namespace omp

offload/plugins-nextgen/common/src/OffloadError.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ using namespace llvm;
1313
using namespace llvm::omp::target::plugin;
1414

1515
namespace {
16-
// FIXME: This class is only here to support the transition to llvm::Error. It
17-
// will be removed once this transition is complete. Clients should prefer to
18-
// deal with the Error value directly, rather than converting to error_code.
16+
// OffloadError inherits from llvm::StringError which requires a
17+
// std::error_code. Once/if that requirement is removed, then this
18+
// std::error_code machinery can be removed.
1919
class OffloadErrorCategory : public std::error_category {
2020
public:
2121
const char *name() const noexcept override { return "llvm.offload"; }
@@ -24,7 +24,7 @@ class OffloadErrorCategory : public std::error_category {
2424
#define OFFLOAD_ERRC(Name, Desc, Value) \
2525
case ErrorCode::Name: \
2626
return #Desc;
27-
#include "OffloadErrcodes.inc"
27+
#include "Shared/OffloadErrcodes.inc"
2828
#undef OFFLOAD_ERRC
2929
}
3030
llvm_unreachable("Unrecognized offload ErrorCode");

0 commit comments

Comments
 (0)