<p dir="ltr">Use hasDescendant. Also, just use the free standing match function.<br>
</p>
<br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 29, 2016, 6:27 PM David Come via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That's what I tried but it didn't work. If S is function's body, it will<br>
not run the matcher on child nodes.<br>
<br>
I assumed it would run the matcher on the node only and doesn't do the<br>
traversal to match S'child nodes.<br>
<br>
<br>
On 29/08/2016 17:20, Aleksei Sidorin via cfe-dev wrote:<br>
> Hello David,<br>
><br>
> You can use MatchFinder::match<...>() method.<br>
> Example:<br>
><br>
> void matchStmt(const Stmt *S, ASTContext &Ctx) {<br>
>   MatchFinder Finder;<br>
>   Finder.addMatcher(someMatcher, &Callback);<br>
>   Finder.match<Stmt>(*S, Ctx);<br>
> }<br>
><br>
>><br>
>> Hi,<br>
>><br>
>> I would like to run some dynamic matchers on a single function body or I<br>
>> can either run it the full AST (MatchFinder::matchAST) or on a single<br>
>> node (MatchFinder::match).<br>
>><br>
>><br>
>> What is the best way to achieve what I want ? Do you think it is worth I<br>
>> change clang's code and submit a patch ?<br>
>><br>
>><br>
>> Thanks,<br>
>><br>
>> David.<br>
>><br>
>><br>
><br>
><br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>