This is a proof-of-concept patch to be discussed on the dev ml.
Details
- Reviewers
- None
Diff Detail
Event Timeline
Unit tests: pass. 61168 tests passed, 0 failed and 728 were skipped.
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
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.
clang/docs/ImplementationQuantities.rst | ||
---|---|---|
71 | should this say ‘not defined’? |
clang/docs/ImplementationQuantities.rst | ||
---|---|---|
71 | Yes, thanks for catching it! |
Made some improvements based on feedback of @craig.topper:
- Adds a not
- Implements an example of the maximum string length when using -Wpedantic
clang/docs/ImplementationQuantities.rst | ||
---|---|---|
11 | Typo: imposse -> impose. |
clang/docs/ImplementationQuantities.rst | ||
---|---|---|
11 | Thanks, it will be updated in the next revision of the patch. |
clang/include/clang/AST/Decl.h | ||
---|---|---|
903 | 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). | |
903 | I think IQ is too terse. We don't need a really short name for this; how about ImpLimits:: or similar? | |
clang/include/clang/Basic/ImplementationQuantities.td | ||
107–111 | Switching between upper- and lower-case names for these fields seems surprising. Please pick a consistent capitalization scheme. | |
clang/lib/CodeGen/CGRecordLayout.h | ||
72 | 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!
clang/include/clang/AST/Decl.h | ||
---|---|---|
903 | I feared ImpLimits would be considered too verbose, but I'll change it in the next revision. | |
903 | 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. | |
clang/include/clang/Basic/ImplementationQuantities.td | ||
107–111 | This style is used in other .td files. But I'll switch to capitalize the is/has in the next revision. |
Typo: imposse -> impose.