diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareNotNullCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareNotNullCheck.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareNotNullCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/DeclareNotNullCheck.cpp @@ -24,17 +24,14 @@ binaryOperator(hasOperatorName("=="), hasLHS(ignoringImpCasts(expr().bind("exp"))), hasRHS(ignoringImpCasts(cxxNullPtrLiteralExpr())))))); - auto functMatcher = - functionDecl( - hasAnyParameter(parmVarDecl(hasType(pointerType())).bind("param"))) - .bind("funct"); + auto functMatcher = functionDecl( + hasAnyParameter(parmVarDecl(hasType(pointerType())).bind("param"))); Finder->addMatcher(ifStmt(hasParent(compoundStmt(hasParent(functMatcher))), hasCondition(NullCondition)), this); } void DeclareNotNullCheck::check(const MatchFinder::MatchResult &Result) { - const FunctionDecl *Funct = Result.Nodes.getNodeAs("funct"); const ParmVarDecl *Par = Result.Nodes.getNodeAs("param"); const Expr *Ex = Result.Nodes.getNodeAs("exp"); diag(Ex->getExprLoc(), "pointer parameter checked against nullptr") << Par;