Skip to content

Commit 4bae981

Browse files
committed
Move matcher out of lambda
1 parent 7353f87 commit 4bae981

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,18 @@ void RedundantTypenameCheck::registerMatchers(MatchFinder *Finder) {
2828

2929
// NOLINTBEGIN(readability-identifier-naming)
3030
const VariadicDynCastAllOfMatcher<Stmt, CXXNamedCastExpr> cxxNamedCastExpr;
31-
const auto inImplicitTypenameContext = [&] {
32-
return anyOf(hasParent(typedefNameDecl()),
33-
hasParent(templateTypeParmDecl()),
34-
hasParent(nonTypeTemplateParmDecl()),
35-
hasParent(cxxNamedCastExpr()), hasParent(cxxNewExpr()),
36-
hasParent(friendDecl()), hasParent(fieldDecl()),
37-
hasParent(parmVarDecl(hasParent(expr(requiresExpr())))),
38-
hasParent(parmVarDecl(hasParent(typeLoc(hasParent(namedDecl(
39-
anyOf(cxxMethodDecl(), hasParent(friendDecl()),
40-
functionDecl(has(nestedNameSpecifier()))))))))),
41-
// Match return types.
42-
hasParent(functionDecl(unless(cxxConversionDecl()))));
43-
};
31+
const auto inImplicitTypenameContext = anyOf(
32+
hasParent(typedefNameDecl()), hasParent(templateTypeParmDecl()),
33+
hasParent(nonTypeTemplateParmDecl()), hasParent(cxxNamedCastExpr()),
34+
hasParent(cxxNewExpr()), hasParent(friendDecl()), hasParent(fieldDecl()),
35+
hasParent(parmVarDecl(hasParent(expr(requiresExpr())))),
36+
hasParent(parmVarDecl(hasParent(typeLoc(hasParent(
37+
namedDecl(anyOf(cxxMethodDecl(), hasParent(friendDecl()),
38+
functionDecl(has(nestedNameSpecifier()))))))))),
39+
// Match return types.
40+
hasParent(functionDecl(unless(cxxConversionDecl()))));
4441
// NOLINTEND(readability-identifier-naming)
45-
Finder->addMatcher(typeLoc(inImplicitTypenameContext()).bind("typeloc"),
46-
this);
42+
Finder->addMatcher(typeLoc(inImplicitTypenameContext).bind("typeloc"), this);
4743
}
4844

4945
void RedundantTypenameCheck::check(const MatchFinder::MatchResult &Result) {

0 commit comments

Comments
 (0)