[cfe-dev] A Question Regarding hasLHS() and hasRHS() Matchers
Farzad Sadeghi via cfe-dev
cfe-dev at lists.llvm.org
Sat Nov 26 04:04:25 PST 2016
according to the AST Matcher reference, hasRHS and hasLHS should match
the right-hand-side and left-hand-side of a binary operator.
first off, the examples in the reference dont work(anymore?) since
hasLHS() and hasRHS require an argument.
anyways here are the matchers i used in clang-query:
binaryOperator(hasLHS(anything()))
binaryOperator(hasRHS(anything()))
here are the results:
/home/bloodstalker/devi/hell4/test.c:8:6: note: "root" binds here
if (a || b)
^~~~~~
1 match.
they both return the same thing because the root is the same but
hasLHS() and hasRHS() and anything() don't support id-binding.
my question is, how can i match the left--hand-side or right-hand-side
of a BinaryOperator then?
--
Farzad Sadeghi
More information about the cfe-dev
mailing list