llvm-c166/offload/languages/include/kernel/LanguageErrors.h
Sophia Herrmann aa8bf3135b
[LLVMOffload] Add more error types + GetLastError/PeekAtLastError (#213389)
This PR expands LLVMOffloadKernel's error types with
`ErrorInvalidResourceHandle` and `ErrorInvalidConfiguration`.
It also adds a language local, thread local LastError which can be
read/retrieved with `PeekAtLastError`/`GetLastError` respectively. Tests
are in #213390

Assisted by GPT-5.5, checked and reviewed manually
2026-08-14 10:37:57 -07:00

31 lines
907 B
C++

//===-- LanguageErrors.h - Kernel language error API declarations ---------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_OFFLOAD_LANGUAGES_INCLUDE_KERNEL_LANGUAGE_ERRORS_H
#define LLVM_OFFLOAD_LANGUAGES_INCLUDE_KERNEL_LANGUAGE_ERRORS_H
#include <cstdint>
enum Error_t : uint32_t {
Success = 0,
ErrorInvalidValue = 1,
ErrorInvalidDevice = 2,
ErrorUnknown = 3,
ErrorInvalidResourceHandle = 4,
ErrorInvalidConfiguration = 5,
};
const char *GetErrorName(Error_t Error);
const char *GetErrorString(Error_t Error);
Error_t GetLastError();
Error_t PeekAtLastError();
#endif // LLVM_OFFLOAD_LANGUAGES_INCLUDE_KERNEL_LANGUAGE_ERRORS_H