<div dir="ltr">Hi<br><br>I encounter a weird behavior on AST matchers and I'd like to ear what U think of it.<br>Let get a test file<br><br>void f()<br>{<br>   int a, b, c, d;<br>   a = 1;<br>  b = 2;<br>  c = 3;<br>  d = 4;<br>}<br><br>Then query the decl matcher: <br>functionDecl(hasName("f"),hasBody(hasDescendant(binaryOperator(hasOperatorName("=")).bind("binop"))))<br><br>I got only the first assignmen<div class="gmail_default" style="font-size:small;display:inline">​t (was expecting to get all of them).​</div><div class="gmail_default" style="font-size:small;display:inline">​</div><div class="gmail_default" style="font-size:small;display:inline">​</div><div class="gmail_default" style="font-size:small;display:inline">​</div><div class="gmail_default" style="font-size:small;display:inline">​</div><br>I tried to add the findAll matcher but got an error.<br><br>functionDecl(hasName("f"),hasBody(hasDescendant(findAll(binaryOperator(hasOperatorName("=")).bind("binop")))))<br><br>Here is the clang-query output:<br><br>clang-query> match functionDecl(hasName("f"),hasBody(hasDescendant(binaryOperator(hasOperatorName("=")).bind("binop"))))<br><br>Match #1:<br><br>/tmp/test.c:5:3: note: "binop" binds here<br>  a = 1;<br>  ^~~~~<br>/tmp/test.c:1:1: note: "root" binds here<br>void f()<br>^~~~~~~~<br>1 match.<br>clang-query> match functionDecl(hasName("f"),hasBody(hasDescendant(findAll(binaryOperator(hasOperatorName("=")).bind("binop")))))<br>1:2: Error parsing argument 2 for matcher functionDecl.<br>1:28: Error parsing argument 1 for matcher hasBody.<br>1:36: Error parsing argument 1 for matcher hasDescendant.<br>1:50: Matcher not found: findAll<br>clang-query> <br><br><div class="gmail_default" style="font-size:small">​Thanks for any help​</div><br><div class="gmail_default" style="font-size:small">​Rémi</div>
</div>