<div dir="ltr">Richard Smith: Is there a reasonable way to get the ')' of an "if ()" expression in the AST? Is it just a matter of going down and playing games with source locations/lexing to get the token after the end location of the condition expression?<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 28, 2016 at 4:57 PM, Wolfgang Pieb via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">wolfgangp added a comment.<br>
<span class=""><br>
<br>
<br>
> Clang (with patch)<br>
<br>
>  3, 5, 4, 5, 7<br>
<br>
>  9, 11, 10, 11, 14<br>
<br>
><br>
<br>
> So that's somewhat problematic - we shouldn't visit 11 at all. (but we are today, as is GCC... so maybe NBD?)<br>
<br>
<br>
</span>Well, if op&& is overloaded, wouldn't we lose the short-circuit property? If so it makes sense to visit 11.<br></blockquote><div><br></div><div>oh, right... thanks for pointing that out. Sorry I missed it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> I think using the end of the condition is problematic/confusing. I'm not sure why this doesn't show up in the primitive value version, but it seems like it should (& we should end up stepping to the end of the condition (which would be the close paren of the function call, not the close paren of the 'if ()'))<br>
<br>
<br>
</span>There is short-circuit in the primitive value version, so we wouldn't stop there.<br>
<span class=""><br>
> Perhaps we should use the close paren of the 'if ()' but tehre's no source location for that readily available - I guess the way to get there is to navigate to the next token from the end of the condition expression... ?<br>
<br>
<br>
</span>I agree, The close paren of the if() would be better.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<a href="http://reviews.llvm.org/D8822" rel="noreferrer" target="_blank">http://reviews.llvm.org/D8822</a><br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>