[clang-tidy] Fix readability-identifer-naming Hungarian CString options
authorAlexis Murzeau <amubtdx@gmail.com>
Fri, 24 Feb 2023 06:53:00 +0000 (06:53 +0000)
committerCarlos Galvez <carlosgalvezp@gmail.com>
Fri, 24 Feb 2023 07:15:19 +0000 (07:15 +0000)
When reading readability-identifier-naming.HungarianNotation.CString
options, correctly use the type string stored in CStr.second instead of
the option name (CStr.first) as the HNOption.CString map key.

This will make CString options really working and properly parsed by the
checker.

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D144431

clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/docs/ReleaseNotes.rst

index 96bf035843577c622596cf38c177354e8b0cfe2d..dd9a4fa9b8e30d057876c1cb966e43f98dbc9411 100644 (file)
@@ -472,7 +472,7 @@ void IdentifierNamingCheck::HungarianNotation::loadFileConfig(
     Buffer.append(CStr.first);
     StringRef Val = Options.get(Buffer, "");
     if (!Val.empty())
-      HNOption.CString[CStr.first] = Val.str();
+      HNOption.CString[CStr.second] = Val.str();
   }
 
   Buffer = {Section, "PrimitiveType."};
index 6b757656377d318150825ef93f9bbd0c41bf9d78..10f8e4c179777c5d27d043cce87b36996bfac05e 100644 (file)
@@ -169,6 +169,10 @@ Changes in existing checks
   <clang-tidy/checks/misc/unused-using-decls>` check.
   Global options of the same name should be used instead.
 
+- Fixed reading `HungarianNotation.CString.*` options in
+  :doc:`readability-identifier-naming
+  <clang-tidy/checks/readability/identifier-naming>` check.
+
 Removed checks
 ^^^^^^^^^^^^^^