[PATCH] D97713: [ASTMatchers] Add documentation for convenience matchers

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 1 11:32:26 PST 2021


steveire created this revision.
steveire added reviewers: aaron.ballman, njames93.
steveire requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97713

Files:
  clang/docs/LibASTMatchersReference.html


Index: clang/docs/LibASTMatchersReference.html
===================================================================
--- clang/docs/LibASTMatchersReference.html
+++ clang/docs/LibASTMatchersReference.html
@@ -542,6 +542,24 @@
 </tr>
 </table>
 
+<!-- ======================================================================= -->
+<h2 id="convenience-matchers">Convenience Matchers</h2>
+<!-- ======================================================================= -->
+
+<p>Several matchers are only for convenience, in that they allow matching of
+nodes which can be done in other, more verbose ways.</p>
+
+<dl>
+  <dt><tt>optionally(...)</tt></dt>
+  <dd>Equivalent to <tt>anyOf(..., anything())</tt>.</dd>
+  <dt><tt>mapAnyOf(...).with(...)</tt></dt>
+  <dd>A builder type for convenience matchers.  Allows mapping matchers into specified node matchers without repetition. This makes <tt>mapAnyOf(ifStmt, forStmt).with(hasCondition(expr()))</tt> an equivalent to <tt>anyOf(ifStmt(hasCondition(expr())), forStmt(hasCondition(expr())))</tt>.</dd>
+  <dt><tt>binaryOperation(...)</tt></dt>
+  <dd>Convenience for <tt>mapAnyOf(binaryOperator(...), cxxOperatorCallExpr(...), cxxRewrittenBinaryOperator(...))</tt>.</dd>
+  <dt><tt>invocation(...)</tt></dt>
+  <dd>Convenience for <tt>mapAnyOf(callExpr(...), cxxConstructorExpr(...))</tt>.  Primarily useful for matching arguments to either kind of node.</dd>
+</dl>
+
 <!-- ======================================================================= -->
 <h2 id="decl-matchers">Node Matchers</h2>
 <!-- ======================================================================= -->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97713.327213.patch
Type: text/x-patch
Size: 1619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210301/72297348/attachment-0001.bin>


More information about the cfe-commits mailing list