[clang-tools-extra] [clang-tidy] Fix readability-identifier-naming FP with DefaultCase on function templates (PR #189788)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 5 00:30:15 PDT 2026


================
@@ -270,6 +270,10 @@ class RenamerClangTidyVisitor
   }
 
   bool VisitNamedDecl(NamedDecl *Decl) {
+    if (isa<FunctionTemplateDecl, ClassTemplateDecl, VarTemplateDecl,
+            TypeAliasTemplateDecl>(Decl))
+      return true;
----------------
vbvictor wrote:

This is a strange fix (or I don't get something)
We don't rename additional decls, but shouldn't they just don't be diagnosted at all?
> The issue seems to be that they are also visited as FunctionTemplateDecl, and after https://github.com/llvm/llvm-project/commit/2ffaf9d676e6ed2cffc5312d3306f8345bc5a4e5 that wrapper decl started falling back to DefaultCase, which produces an identifier diagnostic before the CXXMethodDecl path.

Can we stop visiting them in IdentifierNamingCheck and instead follow CXXMethodDecl path before "Template" path 

https://github.com/llvm/llvm-project/pull/189788


More information about the cfe-commits mailing list