timshen created this revision. timshen added a reviewer: rsmith. timshen added a subscriber: cfe-commits. Herald added a subscriber: klimek.
This is part of the fix of clang-tidy patterns to adapt to newly added ExprWithCleanups node. http://reviews.llvm.org/D21241 Files: include/clang/ASTMatchers/ASTMatchers.h Index: include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -625,6 +625,16 @@ return InnerMatcher.matches(*Node.IgnoreParenImpCasts(), Finder, Builder); } +/// \brief Matches expressions that match InnerMatcher after ExprWithCleanups +/// are stripped off. +AST_MATCHER_P(Expr, ignoringExprWithCleanups, internal::Matcher<Expr>, + InnerMatcher) { + auto E = &Node; + if (auto Cleanups = dyn_cast<ExprWithCleanups>(E)) + E = Cleanups->getSubExpr(); + return InnerMatcher.matches(*E, Finder, Builder); +} + /// \brief Matches types that match InnerMatcher after any parens are stripped. /// /// Given
Index: include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -625,6 +625,16 @@ return InnerMatcher.matches(*Node.IgnoreParenImpCasts(), Finder, Builder); } +/// \brief Matches expressions that match InnerMatcher after ExprWithCleanups +/// are stripped off. +AST_MATCHER_P(Expr, ignoringExprWithCleanups, internal::Matcher<Expr>, + InnerMatcher) { + auto E = &Node; + if (auto Cleanups = dyn_cast<ExprWithCleanups>(E)) + E = Cleanups->getSubExpr(); + return InnerMatcher.matches(*E, Finder, Builder); +} + /// \brief Matches types that match InnerMatcher after any parens are stripped. /// /// Given
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits