[PATCH] D144912: [clang-tidy] readability-identifier-naming: fix hungarian enum prefix in C

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 15:14:15 PST 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:181-187
+- Changed hungarian prefixes for enums in C files to match C++ files (ie.
+  always use the enum type letters, for example `rt` prefix for enum tags of
+  `enum REV_TYPE`) in :doc:`readability-identifier-naming
+  <clang-tidy/checks/readability/identifier-naming>` check.
+  If you need `i` as the prefix for enum tags (to keep the previous behavior),
+  set `EnumConstantPrefix` to `i` instead of enabling
+  `EnumConstantHungarianPrefix`.
----------------
consider making it shorter (fit in 4/5 lines)...

maybe:
```
Updated the Hungarian prefixes for enums in C files to match those used in C++ 
files for improved readability, as checked by :doc:`readability-identifier-naming
<clang-tidy/checks/readability/identifier-naming>`. To preserve the previous
behavior of using `i` as the prefix for enum tags, set the EnumConstantPrefix 
option to `i` instead of using EnumConstantHungarianPrefix.
```



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-c-language.c:4
+// clang-format off
+typedef signed char         int8_t;     // NOLINT
+typedef short               int16_t;    // NOLINT
----------------
those typedefs looks to be duplicated already in identifier-naming-hungarian-notation.cpp and identifier-naming-hungarian-notation-cfgfile.cpp, move them to separate header file


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144912



More information about the cfe-commits mailing list