[clang-tools-extra] [clang-tidy] Fix false positive from `readability-redundant-typename` on partially specialized variables (PR #175473)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 11 17:00:38 PST 2026


================
@@ -25,22 +25,25 @@ void RedundantTypenameCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus20)
     return;
 
-  const auto InImplicitTypenameContext = anyOf(
-      hasParent(decl(anyOf(
-          typedefNameDecl(), templateTypeParmDecl(), nonTypeTemplateParmDecl(),
-          friendDecl(), fieldDecl(),
-          varDecl(hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl())),
-                  unless(parmVarDecl())),
----------------
localspook wrote:

It's a bit hard to see what's happening here, but I'm taking these two lines and splitting them out into a separate matcher. The new matcher works top-down instead of bototm-up.

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


More information about the cfe-commits mailing list