[PATCH] D49840: [AST] Add MatchFinder::matchSubtree

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 27 00:50:30 PDT 2018


On Thu, Jul 26, 2018 at 12:44 PM Gabor Marton via Phabricator <
reviews at reviews.llvm.org> wrote:

> martong added a comment.
>
> > Usually we use match(anyOf(node), hasDescendant(node)). Or did I
> misunderstand what you want?
>
> My understanding is that, the free function template `match` uses
> `MatchFinder::matchAST`, which will start the traverse from the
> TranslationUnitDecl.
> And there is no option to pick a specific node and specify that as the
> root of the traverse. I'd like an option to be able to start the traverse
> from a specific node, if it makes sense.
>

MatchFinder::match allows you to match a node. Wrapping your matcher code
with:
auto m = <my cool matcher>;
ast_matchers::match(anyOf(m, hashDescendant(m)), node, context);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180727/629d18e5/attachment.html>


More information about the cfe-commits mailing list