================
@@ -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())),
----------------
zwuis wrote:

`hasTypeLoc`visits the type of variables only, so it works.

I tested `varDecl(forEach(typeLoc().bind("t")))` and 
`varDecl(forEachDescendant(typeLoc().bind("t")))`. The latter binds template 
arguments of variable template partial specializations, but the former only 
binds the type of variables, which is different from `hasParent` in this check. 
I'm investigating what's going on.

https://github.com/llvm/llvm-project/pull/175473
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to