================ @@ -375,8 +375,13 @@ ENUM_CODEGENOPT(Inlining, InliningMethod, 2, NormalInlining) /// The maximum stack size a function can have to be considered for inlining. VALUE_CODEGENOPT(InlineMaxStackSize, 32, UINT_MAX) +// Ensure the VecLib bitfield has enough space for future vector libraries. +// If new vector libraries are added beyond the current limit of 16, this static assertion will fail. +static_assert(static_cast<int>(llvm::driver::VectorLibrary::NoLibrary) <= 16, ---------------- erichkeane wrote:
Hmm... I would very much like to avoid the magic # of 16 here. Does LLVM have any helper libraries for 'get size of bitfield' that we could use? If not, I think we need to be better about the comment, the 16 seems a little 'magic number'y with out some sort of, "As defined by the number of bits in the VecLib CODEGENOPT, defined below" in there. So I guess I'm asking for either: 1- Make the comment VERY clear for our downstreams that these two are linked 2- (better) find a way to make the 16 get picked up 'automatically' based on the ENUM_CODEGENOPT below. For 2, I might suggest doing something like: ``` #define VecLibBits static_assert(blah blah) ENUM_CODEGENOPT(blah blah...) #undef VecLibBits ``` https://github.com/llvm/llvm-project/pull/108804 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits