This is a proof-of-concept patch to be discussed on the dev ml.
Added support for some additional features:
- Allow limits from the C standard, either sharing the C++ constants or separately.
- Allow to document the design choices for the limit.
- Allow to track the status of the limit. (This may become obsolete ones all limits are implemented, but that can take a while.)
Added some additional fields to test the C support.
Removed the .inc file from the patch, this should not be committed.
These bitfields are assumed to fit into an unsigned, and this can no longer be verified locally (changes to the .td file can break this assumption). Please add a static_assert(sizeof(ParmVarDeclBitfields) <= sizeof(unsigned), "...") next to the union below (and likewise for NonParmVarDeclBitfields).
I think IQ is too terse. We don't need a really short name for this; how about ImpLimits:: or similar?
Switching between upper- and lower-case names for these fields seems surprising. Please pick a consistent capitalization scheme.
These three bitfields no longer obviously fit in 32 bits. Please keep the hard-coded 15 here and add an adjacent static_assert(IQ::BitFieldBits <= 15, "...") instead, or use some similar strategy so that the bit-field allocation and layout remains locally obvious.
Thanks for the feedback!
I feared ImpLimits would be considered too verbose, but I'll change it in the next revision.
I'm not too fond to use the static_assert(sizeof(ParamVarDeclBitFields <= sizeof(unsigned), "..."); here and use a hardcoded value and a static_assert in other places. If it's important to see the size of bit-field directly I prefer the style you suggested later: "Please keep the hard-coded 15 here and add an adjacent static_assert(IQ::BitFieldBits <= 15, "...") instead, or use some similar strategy so that the bit-field allocation and layout remains locally obvious."
I'll give it some more thoughts before updating the proposal.
This style is used in other .td files. But I'll switch to capitalize the is/has in the next revision.