<div dir="ltr"><div>I would expect it the equalsBoundNode("declType") to either:<br></div><div> - raise an error (assertion failure or exception) or</div><div> - check all nodes bound to "declType", and return true if any of them is equal</div>

<div><br></div><div>Perhaps different variants could be introduced with both behaviors? For example, equalsBoundNode(string) would only work if there is exactly one node bound to the specified name, while equalsAnyBoundNode(string) would look for equality in any node bound to the specified name.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/21 Vane, Edwin <span dir="ltr"><<a href="mailto:edwin.vane@intel.com" target="_blank">edwin.vane@intel.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

We're trying to determine the semantics of the proposed new 'equalsBoundNode()' matcher. Before I present the aforementioned matcher expression let me illustrate what this new matcher does. Given that you've bound a node earlier in a matcher expression with a name "X", equalsBoundNode("X") allows you to refer back to that bound node and test for identity. For example, here's a matcher finding VarDecl's where the type matches the initializer type:<br>


<br>
varDecl(hasType(qualType().bind("type")),<br>
               hasInitializer(ignoringParenImpCasts(hasType(qualType(equalsBoundNode("type"))))))));<br>
<br>
Semantics get more interesting where forEach*() matchers are concerned. So this is where I ask: What would you expect the following matcher to do? How would you expect it to behave?<br>
<br>
    functionDecl(<br>
      forEachDescendant(<br>
        ifStmt(<br>
          forEachDescendant(<br>
            varDecl(hasType(qualType().bind("declType")))<br>
          )<br>
        )<br>
      ),<br>
      has(compoundStmt(has(<br>
        callExpr(<br>
          callee(<br>
            functionDecl(<br>
              returns(qualType(equalsBoundNode("declType")))<br>
            )<br>
          )<br>
        )<br>
      )))<br>
    );<br>
<br>
<br>
--<br>
Edwin Vane<br>
  Software Developer<br>
  Intel of Canada, Inc.<br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>