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/src/JIT.cpp | |
| 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/src/JIT.cpp')
| -rw-r--r-- | offload/plugins-nextgen/common/src/JIT.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/offload/plugins-nextgen/common/src/JIT.cpp b/offload/plugins-nextgen/common/src/JIT.cpp index affedb1a3368..c82a06e36d8f 100644 --- a/offload/plugins-nextgen/common/src/JIT.cpp +++ b/offload/plugins-nextgen/common/src/JIT.cpp @@ -62,8 +62,8 @@ createModuleFromMemoryBuffer(std::unique_ptr<MemoryBuffer> &MB, SMDiagnostic Err; auto Mod = parseIR(*MB, Err, Context); if (!Mod) - return make_error<StringError>("Failed to create module", - inconvertibleErrorCode()); + return error::createOffloadError(error::ErrorCode::UNKNOWN, + "failed to create module"); return std::move(Mod); } Expected<std::unique_ptr<Module>> @@ -100,7 +100,8 @@ createTargetMachine(Module &M, std::string CPU, unsigned OptLevel) { std::string Msg; const Target *T = TargetRegistry::lookupTarget(M.getTargetTriple(), Msg); if (!T) - return make_error<StringError>(Msg, inconvertibleErrorCode()); + return error::createOffloadError(error::ErrorCode::INVALID_BINARY, + Msg.data()); SubtargetFeatures Features; Features.getDefaultSubtargetFeatures(TT); @@ -118,8 +119,8 @@ createTargetMachine(Module &M, std::string CPU, unsigned OptLevel) { T->createTargetMachine(M.getTargetTriple(), CPU, Features.getString(), Options, RelocModel, CodeModel, CGOptLevel)); if (!TM) - return make_error<StringError>("Failed to create target machine", - inconvertibleErrorCode()); + return error::createOffloadError(error::ErrorCode::INVALID_BINARY, + "failed to create target machine"); return std::move(TM); } @@ -221,7 +222,8 @@ JITEngine::backend(Module &M, const std::string &ComputeUnitKind, raw_fd_stream FD(PostOptIRModuleFileName.get(), EC); if (EC) return createStringError( - EC, "Could not open %s to write the post-opt IR module\n", + error::ErrorCode::HOST_IO, + "Could not open %s to write the post-opt IR module\n", PostOptIRModuleFileName.get().c_str()); M.print(FD, nullptr); } |
