[PATCH] D147779: [clang-tidy] Fix hungarian notation failed to indicate the number of asterisks in check-clang-extra-clang-tidy-checkers-readability

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 7 04:41:25 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:367-379
+        if (const auto *TD = dyn_cast<ValueDecl>(ND)) {
+          QualType QT = TD->getType();
+
+          size_t PtrCount = 0;
+          if (QT->isPointerType()) {
+            PtrCount = getAsteriskCount(Type);
+          }
----------------
this function is already big, extract this to have something like:
```
if (removeReudnantAsterisks(Type, ND))
{
    RedundantRemoved = true;
    break;
}
```


================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:696-702
+    const std::string &TypeName) const {
+  size_t Pos = TypeName.find('*');
+  size_t Count = 0;
+  for (; Pos < TypeName.length(); Pos++, Count++) {
+    if ('*' != TypeName[Pos])
+      break;
+  }
----------------
what if type will be like std::optional<unsigned char**>, will this function also be executed ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147779



More information about the cfe-commits mailing list