Implement new AST matcher hasAnyCapture to match on LambdaExpr captures.
Accepts child matchers cxxThisExpr to match on capture of this and also on varDecl. This is achieved by using the overload macros.
|  Differential  D72414  
Add new AST matcher `hasAnyCapture` Authored by rhiro on Jan 8 2020, 1:45 PM. 
Details 
 Implement new AST matcher hasAnyCapture to match on LambdaExpr captures. Accepts child matchers cxxThisExpr to match on capture of this and also on varDecl. This is achieved by using the overload macros. 
Diff Detail 
 Event TimelineComment Actions Thank you for this patch! You should also register the matcher(s) in Registry.cpp so that they'll work from clang-query. Also, you need to regenerate the documentation by running clang\docs\tools\dump_ast_matchers.py 
 Comment Actions 
 Comment Actions Thanks for the review! I regenerated the docs and switched the this capture case to be an override of hasAnyCapture. 
 
 Comment Actions Fixed the condition for the varDecl case and made the cxxThisExpr more concise. 
 | ||||||||||||||||||||||||||||||||
I would prefer to see this written as: if (Capture.capturesVariable()) { ... } so it's a bit more resilient to other non-var captures like VLA captures.