[clang] [BPF] Support preserve_access_index attribute for enum (PR #232498)

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 7 20:05:32 PST 2026


================
@@ -48,6 +48,7 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,
   Builder.defineMacro("__BPF_FEATURE_ATOMIC_MEM_ORDERING");
   Builder.defineMacro("__BPF_FEATURE_STACK_ARGUMENT");
   Builder.defineMacro("__BPF_FEATURE_UNWIND");
+  Builder.defineMacro("__BPF_FEATURE_ENUM_PRESERVE_ACCESS_INDEX");
----------------
4ast wrote:

`-mcpu=probe` returns a few lines above, so the macro is not defined there. The attribute doesn't depend on the cpu. With `probe` vmlinux.h doesn't apply the attribute, and nothing tells the user.

Should it go next to `__BPF__`? Pls also check `ac` for `CPU_GENERIC` and `CPU_PROBE` in the test.

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


More information about the cfe-commits mailing list