<div dir="ltr">Use expr() instead of anything(). expr() supports binding.</div><br><div class="gmail_quote"><div dir="ltr">On Sat, Nov 26, 2016 at 1:04 PM Farzad Sadeghi 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">according to the AST Matcher reference, hasRHS and hasLHS should match<br class="gmail_msg">
the right-hand-side and left-hand-side of a binary operator.<br class="gmail_msg">
first off, the examples in the reference dont work(anymore?) since<br class="gmail_msg">
hasLHS() and hasRHS require an argument.<br class="gmail_msg">
anyways here are the matchers i used in clang-query:<br class="gmail_msg">
binaryOperator(hasLHS(anything()))<br class="gmail_msg">
binaryOperator(hasRHS(anything()))<br class="gmail_msg">
here are the results:<br class="gmail_msg">
/home/bloodstalker/devi/hell4/test.c:8:6: note: "root" binds here<br class="gmail_msg">
        if (a || b)<br class="gmail_msg">
            ^~~~~~<br class="gmail_msg">
1 match.<br class="gmail_msg">
they both return the same thing because the root is the same but<br class="gmail_msg">
hasLHS() and hasRHS() and anything() don't support id-binding.<br class="gmail_msg">
my question is, how can i match the left--hand-side or right-hand-side<br class="gmail_msg">
of a BinaryOperator then?<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
Farzad Sadeghi<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
cfe-dev mailing list<br class="gmail_msg">
<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="gmail_msg">
</blockquote></div>