[PATCH] D112491: Add `LambdaCapture`-related matchers.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 2 06:26:00 PDT 2021


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Thanks for the changes, this looks great to me now.



================
Comment at: clang/docs/LibASTMatchersReference.html:8368
+lambdaExpr(hasAnyCapture(lambdaCapture(capturesVar(hasName("x")))),
+capturesVar(hasName("x")) matches `int x` and `x = 1`.
 </pre></td></tr>
----------------
fowles wrote:
> I think this should be "matches `x` and `x = 1`
either that or `... hasName("x") matches ...`

Maybe it's worth explicitly saying in the doc text something like "this can be a separate variable captured by value or reference, or a synthesized variable if the capture has an initializer".

(There may end up being some confusion about the fact that these variables don't appear in AST dumps, but I don't think that's your problem to deal with here)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112491/new/

https://reviews.llvm.org/D112491



More information about the cfe-commits mailing list