[clang-tools-extra] 00a71cb - [clang-tidy] readability-identifier-naming.HungarianNotation: rename CharPrinter to CharPointer
Carlos Galvez via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 26 00:23:11 PST 2023
Author: Alexis Murzeau
Date: 2023-02-26T08:22:56Z
New Revision: 00a71cb47c36984dcd9f51492e1e831aec0e0460
URL: https://github.com/llvm/llvm-project/commit/00a71cb47c36984dcd9f51492e1e831aec0e0460
DIFF: https://github.com/llvm/llvm-project/commit/00a71cb47c36984dcd9f51492e1e831aec0e0460.diff
LOG: [clang-tidy] readability-identifier-naming.HungarianNotation: rename CharPrinter to CharPointer
The CharPrinter is a typo and should have been named CharPointer as it
configures the hungarian notation prefix for char pointers (char*).
As all configuration options within
readability-identifier-naming.HungarianNotation.CString.* were not read
at all in the previous clang-tidy version (fixed in D144431), this option
rename won't break existing users.
A note in release notes is added to let users know these options were
renamed.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D144790
Added:
Modified:
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst
clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation2/.clang-tidy
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index dd9a4fa9b8e30..61421a13d73ba 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -460,9 +460,9 @@ void IdentifierNamingCheck::HungarianNotation::loadFileConfig(
}
static constexpr std::pair<StringRef, StringRef> HNCStrings[] = {
- {"CharPrinter", "char*"},
+ {"CharPointer", "char*"},
{"CharArray", "char[]"},
- {"WideCharPrinter", "wchar_t*"},
+ {"WideCharPointer", "wchar_t*"},
{"WideCharArray", "wchar_t[]"}};
Buffer = {Section, "CString."};
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 4906d2c78cfaf..5979b9e6d592d 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -173,6 +173,11 @@ Changes in existing checks
:doc:`readability-identifier-naming
<clang-tidy/checks/readability/identifier-naming>` check.
+- Renamed `HungarianNotation.CString` options `CharPrinter` and
+ `WideCharPrinter` to `CharPointer` and `WideCharPointer` respectively in
+ :doc:`readability-identifier-naming
+ <clang-tidy/checks/readability/identifier-naming>` check.
+
- Fixed a false positive in :doc:`readability-container-size-empty
<clang-tidy/checks/readability/container-size-empty>` check when comparing
``std::array`` objects to default constructed ones. The behavior for this and
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst
index 3f98ed73dd953..621fe0258e277 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/identifier-naming.rst
@@ -2584,9 +2584,9 @@ Options for Hungarian Notation
- :option:`HungarianNotation.DerivedType.Pointer`
- :option:`HungarianNotation.DerivedType.FunctionPointer`
-- :option:`HungarianNotation.CString.CharPrinter`
+- :option:`HungarianNotation.CString.CharPointer`
- :option:`HungarianNotation.CString.CharArray`
-- :option:`HungarianNotation.CString.WideCharPrinter`
+- :option:`HungarianNotation.CString.WideCharPointer`
- :option:`HungarianNotation.CString.WideCharArray`
- :option:`HungarianNotation.PrimitiveType.*`
@@ -2642,7 +2642,7 @@ After:
FUNC_PTR fnFuncPtr = NULL;
-.. option:: HungarianNotation.CString.CharPrinter
+.. option:: HungarianNotation.CString.CharPointer
When defined, the check will ensure variable name will add the prefix with
the given string. The default prefix is `sz`.
@@ -2652,7 +2652,7 @@ After:
When defined, the check will ensure variable name will add the prefix with
the given string. The default prefix is `sz`.
-.. option:: HungarianNotation.CString.WideCharPrinter
+.. option:: HungarianNotation.CString.WideCharPointer
When defined, the check will ensure variable name will add the prefix with
the given string. The default prefix is `wsz`.
@@ -2667,13 +2667,13 @@ Before:
.. code-block:: c++
- // CharPrinter
+ // CharPointer
const char *NamePtr = "Name";
// CharArray
const char NameArray[] = "Name";
- // WideCharPrinter
+ // WideCharPointer
const wchar_t *WideNamePtr = L"Name";
// WideCharArray
@@ -2683,13 +2683,13 @@ After:
.. code-block:: c++
- // CharPrinter
+ // CharPointer
const char *szNamePtr = "Name";
// CharArray
const char szNameArray[] = "Name";
- // WideCharPrinter
+ // WideCharPointer
const wchar_t *wszWideNamePtr = L"Name";
// WideCharArray
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation2/.clang-tidy b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation2/.clang-tidy
index 86e2dad3d59f6..cc7619c56cbe5 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation2/.clang-tidy
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/hungarian-notation2/.clang-tidy
@@ -120,11 +120,11 @@ CheckOptions:
value: custp
- key: readability-identifier-naming.HungarianNotation.DerivedType.FunctionPointer
value: custfn
- - key: readability-identifier-naming.HungarianNotation.CString.CharPrinter
+ - key: readability-identifier-naming.HungarianNotation.CString.CharPointer
value: custsz
- key: readability-identifier-naming.HungarianNotation.CString.CharArray
value: custsz
- - key: readability-identifier-naming.HungarianNotation.CString.WideCharPrinter
+ - key: readability-identifier-naming.HungarianNotation.CString.WideCharPointer
value: custwsz
- key: readability-identifier-naming.HungarianNotation.CString.WideCharArray
value: custwsz
More information about the cfe-commits
mailing list