llvm-project/clang-tools-extra/clang-tidy
Alexis Murzeau d4cb6c2082 [clang-tidy] readability-identifier-naming: fix hungarian enum prefix in C
When checking a C file, enum tags are of type `int` instead of the enum
type as in C++.
So the checker was using `i` as the prefix for enum tags instead of main
letters of the enum type name (for example `rt` for `enum REV_TYPE`).

This commit fixes this divergence and makes the behavior the same between
C and C++ files.

For example, `enum REV_TYPE { rtRevValid };` won't be reported as badly
named when in a C file. Previously, it would have proposed a rename to
`iRevValid`.

This commit also add a file to test the hungarian notation checker with C
files.
The test file was made from identifier-naming-hungarian-notation.cpp
with C++-only features removed.

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D144912
2023-03-19 06:22:16 +00:00
..
abseil
altera
android
boost
bugprone
cert
concurrency
cppcoreguidelines
darwin
fuchsia
google
hicpp
linuxkernel
llvm
llvmlibc
misc
modernize
mpi
objc
openmp
performance
plugin
portability
readability [clang-tidy] readability-identifier-naming: fix hungarian enum prefix in C 2023-03-19 06:22:16 +00:00
tool
utils
zircon
add_new_check.py
clang-tidy-config.h.cmake
ClangTidy.cpp
ClangTidy.h
ClangTidyCheck.cpp
ClangTidyCheck.h
ClangTidyDiagnosticConsumer.cpp
ClangTidyDiagnosticConsumer.h
ClangTidyForceLinker.h
ClangTidyModule.cpp
ClangTidyModule.h
ClangTidyModuleRegistry.h
ClangTidyOptions.cpp
ClangTidyOptions.h
ClangTidyProfiling.cpp
ClangTidyProfiling.h
CMakeLists.txt
ExpandModularHeadersPPCallbacks.cpp
ExpandModularHeadersPPCallbacks.h
FileExtensionsSet.h
GlobList.cpp
GlobList.h
NoLintDirectiveHandler.cpp
NoLintDirectiveHandler.h
rename_check.py