[all-commits] [llvm/llvm-project] d4cb6c: [clang-tidy] readability-identifier-naming: fix hu...

Alexis Murzeau via All-commits all-commits at lists.llvm.org
Sat Mar 18 23:25:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4cb6c208231b36ef44871f4f3d0167f8b206a5e
      https://github.com/llvm/llvm-project/commit/d4cb6c208231b36ef44871f4f3d0167f8b206a5e
  Author: Alexis Murzeau <amubtdx at gmail.com>
  Date:   2023-03-19 (Sun, 19 Mar 2023)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    A clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-c-language.c
    M clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation-cfgfile.cpp
    M clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-hungarian-notation.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-standard-types.h

  Log Message:
  -----------
  [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




More information about the All-commits mailing list