[PATCH] D21241: Add an ASTMatcher for ignoring ExprWithCleanups.

Tim Shen via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 10 13:53:35 PDT 2016


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21241.60398.patch
Type: text/x-patch
Size: 773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160610/8acdbffd/attachment.bin>


More information about the cfe-commits mailing list