[clang] [clang] Assert the enum FPOpts and LangOpts fit into the storage (PR #126166)

Florian Mayer via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 11 12:25:03 PST 2025


fmayer wrote:

> The idea here makes sense to me and I don't mind if it lands without "NFC" in the title, but I think enforcing this at compile time would be more robust. Could we use `static_assert` with something like `llvm::BitWidth` and supporting infrastructure from `llvm/include/ADT/BitmaskEnum.h`?

That would involve annotating all the enums with the largest value, and that's a bigger change, and also prone to error, so even if we did this the `assert` here is a good idea. We can do this later.

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


More information about the cfe-commits mailing list