[llvm] [Offload] Add Error Codes to PluginInterface (PR #138258)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Mon May 5 05:25:49 PDT 2025


================
@@ -0,0 +1,37 @@
+//===- Auto-generated file, part of the LLVM/Offload project --------------===//
+//
+// 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 OFFLOAD_ERRC
+#error Please define the macro OFFLOAD_ERRCODE(Name, Desc, Value)
+#endif
+
+// Error codes are shared between PluginInterface and liboffload.
+// To add new error codes, add them to offload/liboffload/API/Common.td and run
+// the GenerateOffload target.
+
+OFFLOAD_ERRC(SUCCESS, "Success", 0)
+OFFLOAD_ERRC(UNKNOWN, "Unknown or internal error", 1)
----------------
jhuber6 wrote:

I'm wondering if we even need these string arguments. The main benefit of doing errors the way we do with the LLVM error type and a tuple is that we can create error codes that are more descriptive. I suppose they serve as a good default if someone doesn't specify, but realistically the intended string should be generated where the error is created.

https://github.com/llvm/llvm-project/pull/138258


More information about the llvm-commits mailing list