[PATCH] D144135: [clang-tidy] Add performance-enum-size check

Daniil Dudkin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 08:29:36 PDT 2023


unterumarmung added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/performance/EnumSizeCheck.cpp:127-128
+
+  diag(MatchedDecl->getLocation(), "enum %0 derive from %1 of size %2 bytes, "
+                                   "derive from '%3' to reduce it size to %4")
+      << MatchedDecl << MatchedDecl->getIntegerType() << Size << NewType.first
----------------
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.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/performance/enum-size.rst:62
+Requires C++11 or above.
+Does not provide auto-fixes.
+
----------------
Why not? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144135/new/

https://reviews.llvm.org/D144135



More information about the cfe-commits mailing list