[PATCH] D86671: [clang-tidy] Add new case type to check variables with Hungarian notation

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 15:23:10 PST 2020


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:235-239
+  for (const auto &Opt : Options) {
+    std::string Val = HNOption.General.lookup(Opt.first);
+    if (Val.empty())
+      HNOption.General.insert({Opt.first, Opt.second.str()});
+  }
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:244-248
+  for (const auto &Other : DerivedTypes) {
+    std::string Val = HNOption.DerivedType.lookup(Other.first);
+    if (Val.empty())
+      HNOption.DerivedType.insert({Other.first, Other.second.str()});
+  }
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:256-260
+  for (const auto &CStr : CStrings) {
+    std::string Val = HNOption.CString.lookup(CStr.first);
+    if (Val.empty())
+      HNOption.CString.insert({CStr.first, CStr.second.str()});
+  }
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:308-312
+  for (const auto &Type : PrimitiveTypes) {
+    std::string Val = HNOption.PrimitiveType.lookup(Type.first);
+    if (Val.empty())
+      HNOption.PrimitiveType.insert({Type.first, Type.second.str()});
+  }
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:347-348
+  for (const auto &Type : UserDefinedTypes) {
+    std::string Val = HNOption.UserDefinedType.lookup(Type.first);
+    if (Val.empty())
+      HNOption.UserDefinedType.insert({Type.first, Type.second.str()});
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:366
+    if (!Val.empty())
+      HNOption.General[Opt] = Val;
+  }
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:373
+    if (!Val.empty())
+      HNOption.DerivedType[Type] = Val;
+  }
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:386
+    if (!Val.empty())
+      HNOption.CString[CStr.first] = Val;
+  }
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:392-401
+    std::string Type = PrimType.str();
+    if (!Val.empty()) {
+      if (Type.find('-') != std::string::npos) {
+        for (size_t I = 0; I < Type.length(); ++I) {
+          if (Type[I] == '-')
+            Type.replace(I, 1, " ");
+        }
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:407-409
+    std::string Type = WDType.str();
+    if (!Val.empty())
+      HNOption.UserDefinedType[Type] = Val;
----------------



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.h:124-125
   const bool IgnoreFailedSplit;
+
+  IdentifierNamingCheck::HungarianNotationOption HNOption;
 };
----------------
This should be part of the `FileStyle` struct.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86671



More information about the cfe-commits mailing list