Skip to content

Commit 99a7c14

Browse files
committed
reduce duplication in matchers
1 parent 8f33b21 commit 99a7c14

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

clang-tools-extra/clang-tidy/readability/RedundantTypenameCheck.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ void RedundantTypenameCheck::registerMatchers(MatchFinder *Finder) {
2525
return;
2626

2727
const auto InImplicitTypenameContext = anyOf(
28-
hasParent(typedefNameDecl()), hasParent(templateTypeParmDecl()),
29-
hasParent(nonTypeTemplateParmDecl()), hasParent(cxxNamedCastExpr()),
30-
hasParent(cxxNewExpr()), hasParent(friendDecl()), hasParent(fieldDecl()),
31-
hasParent(
28+
hasParent(decl(anyOf(
29+
typedefNameDecl(), templateTypeParmDecl(), nonTypeTemplateParmDecl(),
30+
friendDecl(), fieldDecl(),
3231
varDecl(hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl())),
33-
unless(parmVarDecl()))),
34-
hasParent(parmVarDecl(hasParent(expr(requiresExpr())))),
35-
hasParent(parmVarDecl(hasParent(typeLoc(hasParent(
36-
namedDecl(anyOf(cxxMethodDecl(), hasParent(friendDecl()),
37-
functionDecl(has(nestedNameSpecifier()))))))))),
38-
// Match return types.
39-
hasParent(functionDecl(unless(cxxConversionDecl()))));
32+
unless(parmVarDecl())),
33+
parmVarDecl(hasParent(expr(requiresExpr()))),
34+
parmVarDecl(hasParent(typeLoc(hasParent(
35+
decl(anyOf(cxxMethodDecl(), hasParent(friendDecl()),
36+
functionDecl(has(nestedNameSpecifier())))))))),
37+
// Match return types.
38+
functionDecl(unless(cxxConversionDecl()))))),
39+
hasParent(expr(anyOf(cxxNamedCastExpr(), cxxNewExpr()))));
4040
Finder->addMatcher(typeLoc(InImplicitTypenameContext).bind("typeloc"), this);
4141
}
4242

0 commit comments

Comments
 (0)