[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
Sun Aug 30 00:40:00 PDT 2020


njames93 added a comment.

As Hungarian notation enforces prefixes as well as casing styles it would be wise to warn on cases where the style is Hungarian but a prefix has also been set.

Another issue is this current set up will let you define any decls style as hungarian, this doesn't make sense for most decl types. 
Potentially some validation should happen for that too,



================
Comment at: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.h:127
   virtual llvm::Optional<FailureInfo>
-  GetDeclFailureInfo(const NamedDecl *Decl, const SourceManager &SM) const = 0;
+  GetDeclFailureInfo(const StringRef &Type, const NamedDecl *Decl,
+                     const SourceManager &SM) const = 0;
----------------
I'm not a fan of changing the base class for this support. The Type paramater can be inferred using the Decl. 
You can `dyn_cast` the Decl to a `ValueDecl` and then get its type from that.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D86671



More information about the cfe-commits mailing list