================
@@ -18,9 +18,13 @@ using namespace clang::ast_matchers;
namespace clang::tidy::readability {
void RedundantTypenameCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(typeLoc(unless(hasAncestor(decl(isInstantiated()))))
- .bind("nonDependentTypeLoc"),
- this);
+ Finder->addMatcher(
+ typeLoc(loc(TypeMatcher(anyOf(typedefType(), tagType(),
+ deducedTemplateSpecializationType(),
+ templateSpecializationType()))),
+ unless(hasAncestor(decl(isInstantiated()))))
+ .bind("nonDependentTypeLoc"),
+ this);
----------------
localspook wrote:
Ah, bingo. There are a bunch of `addMatcher` overloads. The ones for
`DeclarationMatcher` and `StatementMatcher` respect `getCheckTraversalKind`:
https://github.com/llvm/llvm-project/blob/722026886fb65f0d61e0384886ffc30e83623edf/clang/lib/ASTMatchers/ASTMatchFinder.cpp#L1670-L1680
And the rest (including the one we're calling) just... don't?!
https://github.com/llvm/llvm-project/blob/722026886fb65f0d61e0384886ffc30e83623edf/clang/lib/ASTMatchers/ASTMatchFinder.cpp#L1712-L1716
https://github.com/llvm/llvm-project/pull/170540
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits