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, + InnerMatcher) { + auto E = &Node; + if (auto Cleanups = dyn_cast(E)) + E = Cleanups->getSubExpr(); + return InnerMatcher.matches(*E, Finder, Builder); +} + /// \brief Matches types that match InnerMatcher after any parens are stripped. /// /// Given