From a5d954b187be1e00de5eae34052d07791110a575 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 5 Aug 2014 15:33:46 +0000 Subject: [PATCH] [clang-tidy] Simplify ast matcher. Turns out there is a better way to do this. No functionality change. llvm-svn: 214874 --- .../clang-tidy/google/ExplicitMakePairCheck.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp index e29b1ad..1331c57 100644 --- a/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp @@ -20,15 +20,6 @@ namespace ast_matchers { AST_MATCHER(DeclRefExpr, hasExplicitTemplateArgs) { return Node.hasExplicitTemplateArgs(); } - -// FIXME: This should just be callee(ignoringImpCasts()) but it's not overloaded -// for Expr. -AST_MATCHER_P(CallExpr, calleeIgnoringParenImpCasts, internal::Matcher, - InnerMatcher) { - const Expr *ExprNode = Node.getCallee(); - return (ExprNode != nullptr && - InnerMatcher.matches(*ExprNode->IgnoreParenImpCasts(), Finder, Builder)); -} } // namespace ast_matchers namespace tidy { @@ -42,10 +33,10 @@ ExplicitMakePairCheck::registerMatchers(ast_matchers::MatchFinder *Finder) { callExpr(unless(hasAncestor(decl(anyOf( recordDecl(ast_matchers::isTemplateInstantiation()), functionDecl(ast_matchers::isTemplateInstantiation()))))), - calleeIgnoringParenImpCasts( + callee(expr(ignoringParenImpCasts( declRefExpr(hasExplicitTemplateArgs(), to(functionDecl(hasName("::std::make_pair")))) - .bind("declref"))).bind("call"), + .bind("declref"))))).bind("call"), this); } -- 2.7.4