Finds enum type definitions that could use smaller integral type as a base.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Removed change in list.rst that is related to cppcoreguidelines-avoid-capture-default-when-capturing-this.
Looks like that check have fixes but didnt mark fixes in that file.
Fix tests on windows (they use int as base for enums, when on linux unsigned int is used)
clang-tools-extra/clang-tidy/performance/EnumSizeCheck.cpp | ||
---|---|---|
128–129 | I find the enum's type derivation message to be a bit unintuitive. It would slightly improve the user experience if the error message provided clearer information, like stating "enum %0 has a base type of %1..." or "the base type of enum %0 appears excessive for its value set...". However, please remember that these are merely personal thoughts, and as a non-contributor, my suggestions are not obligatory. | |
clang-tools-extra/docs/clang-tidy/checks/performance/enum-size.rst | ||
63 | Why not? |
clang-tools-extra/clang-tidy/performance/EnumSizeCheck.cpp | ||
---|---|---|
128–129 | Hmm, ok, I think I can change it to utilize a "base type" instead of "derive" and something like "appears excessive for its value set.". | |
clang-tools-extra/docs/clang-tidy/checks/performance/enum-size.rst | ||
63 | Problem is mainly with forward declarations, and a fact that some of these changes may be unnecessary from a domain point of view. I would prefer users to change enum sizes on their own risk. And I didn't wanted to add this at the beginning, in future maybe. |
This LGTM, but can't officially accept the patch so please wait for another reviewer to accept it.
Please do not use auto unless type is explicitly spelled in same function or iterator.