<div dir="ltr"><div dir="ltr">On Mon, May 25, 2020 at 11:56 PM Stephen Kelly via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 20/12/2019 21:01, Stephen Kelly via cfe-dev wrote:<br>
> <br>
> Hi,<br>
> <br>
> (Apologies if you receive this twice. GMail classified the first one as <br>
> spam)<br>
> <br>
> Aaron Ballman and I met by chance in Belfast and we discussed a way <br>
> forward towards making AST Matchers easier to use, particularly for C++ <br>
> developers who are not familiar with the details of the Clang AST.<br>
> <br>
> For those unaware, I expanded on this in the EuroLLVM conference this <br>
> year, and then expanded on it at ACCU:<br>
> <br>
>   <a href="https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching" rel="noreferrer" target="_blank">https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching</a><br>
> <br>
> One step in the process of getting there is changing the default <br>
> behavior of AST Matchers to ignore invisible nodes while matching using <br>
> the C++ API, and while matching and dumping AST nodes in clang-query.<br>
> <br>
> I think this is the most important change in the entire proposal as it <br>
> sets out the intention of making the AST Matchers easier to use for C++ <br>
> developers who are not already familiar with Clang APIs.<br>
> <br>
> To that end, I've written an AST to motivate the change:<br>
> <br>
> <br>
> <a href="https://docs.google.com/document/d/17Z6gAwwc3HoRXvsy0OdwU0X5MFQEuiGeSu3i6ICOB90" rel="noreferrer" target="_blank">https://docs.google.com/document/d/17Z6gAwwc3HoRXvsy0OdwU0X5MFQEuiGeSu3i6ICOB90</a> <br>
> <br>
> <br>
> We're looking for feedback before pressing forward with the change. I <br>
> already have some patches written to port clang-tidy and unit tests to <br>
> account for the change of default.<br>
<br>
<br>
This change is now in master.<br></blockquote><div> </div><div>Thanks for simplifying the matchers! Unfortunately I missed the discussion on this.<br> <br>Unfortunately this is causing widespread problems in downstream tools that are difficult to track:<br> - this is a prominent API that is used in many places<br> - the semantics have changed subtly but pervasively, so all usage sites need to be audited, but because there was no API syntax change (e.g. build break), it's not trivial to find all the affected locations to audit<br> - the differences between old and new only occur when running against certain code patterns that often aren't covered by tests, therefore each audit is a lot of work<br> - because the default was flipped globally, all usage sites must be dealt with at once<br> - the "revert-to-old-behaviour" is invasive at all usage sites (hurts readability a lot) and apparently has bugs (D80606)<br> <br>In summary: it requires changes in consuming tools that are numerous, hard to find, hard to analyze, must all be done at once, and the changes aren't mechanically reliable.<br>I expect this to bite people building tools against release versions to hit the same problems in a few months.<br> <br>We should consider reverting this and finding a less-silent way to roll out the change (like adding it with different syntax, or having no default for a transition period covering a stable release).</div></div></div>