Page MenuHomePhabricator

[clang-tidy] Add performance-enum-size check
Needs ReviewPublic

Authored by PiotrZSL on Feb 15 2023, 1:57 PM.

Details

Summary

Finds enum type definitions that could use smaller integral type as a base.

Diff Detail

Event Timeline

PiotrZSL created this revision.Feb 15 2023, 1:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
PiotrZSL updated this revision to Diff 497787.Feb 15 2023, 2:03 PM

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.

PiotrZSL updated this revision to Diff 497804.Feb 15 2023, 2:23 PM

Fix typo in documentation.

PiotrZSL updated this revision to Diff 497826.Feb 15 2023, 3:32 PM

Fix tests on windows (they use int as base for enums, when on linux unsigned int is used)

Eugene.Zelenko added inline comments.
clang-tools-extra/clang-tidy/performance/EnumSizeCheck.cpp
100

Please do not use auto unless type is explicitly spelled in same function or iterator.

101

I don't think that literal boolean operators are part of LLVM coding guidelines.

104

Ditto.

121

Ditto.

PiotrZSL marked 4 inline comments as done.Feb 15 2023, 10:40 PM
PiotrZSL updated this revision to Diff 497887.Feb 15 2023, 10:40 PM

Fix review comments

PiotrZSL published this revision for review.Feb 15 2023, 11:22 PM

Ready for review

Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 11:22 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
PiotrZSL updated this revision to Diff 498471.Feb 17 2023, 11:52 AM

Updated documentation.

PiotrZSL updated this revision to Diff 498472.Feb 17 2023, 11:54 AM

Typo in doc

PiotrZSL planned changes to this revision.Sun, Mar 5, 1:21 PM

Option need to be changed from Regex to List

PiotrZSL updated this revision to Diff 502790.Mon, Mar 6, 1:49 PM

Ping, Rebase, Changed Regexp option into List