[llvm] [Offload] Add `_LAST` variant for generated enumerations (PR #147314)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 8 05:26:38 PDT 2025
================
@@ -151,6 +151,12 @@ static void ProcessEnum(const EnumRec &Enum, raw_ostream &OS) {
Enum.getEnumValNamePrefix());
OS << formatv("} {0};\n", Enum.getName());
+
+ // Add field for the number of variants
+ OS << formatv(TAB_1
----------------
RossBrunton wrote:
Fair, it now looks like this:
```c
typedef enum ol_alloc_type_t {
/// Host allocation
OL_ALLOC_TYPE_HOST = 0,
/// Device allocation
OL_ALLOC_TYPE_DEVICE = 1,
/// Managed allocation
OL_ALLOC_TYPE_MANAGED = 2,
/// @cond
OL_ALLOC_TYPE_LAST = 3,
OL_ALLOC_TYPE_FORCE_UINT32 = 0x7fffffff
/// @endcond
} ol_alloc_type_t;
```
https://github.com/llvm/llvm-project/pull/147314
More information about the llvm-commits
mailing list