<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<p>Matchers are orthogonal to Syntax Trees as laid out in that
document:</p>
<p>```</p>
<h2 dir="ltr"
style="line-height:1.38;margin-top:18pt;margin-bottom:6pt;"
id="docs-internal-guid-49b8bbb9-7fff-4eec-fb63-d0da4a3af2a8"><span style="font-size:16pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Will we end up needing to reinvent matchers for this representation? </span></h2>
<p dir="ltr"
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">**We want to avoid this.**
</span></p>
<p dir="ltr"
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">Matchers are a complicated beast and having a separate set of those for syntax trees would be unfortunate. Moreover, syntax trees lack the semantic information that the users of AST matchers often rely on. If one wants to take advantage of the concept of matchers and syntax trees, they have options to do so based on existing implementation of ASTMatchers, e.g. they could:</span></p>
<ol style="margin-top:0;margin-bottom:0;">
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">use ASTMatchers to find interesting Clang AST nodes,</span></p></li>
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">find their syntax tree counterparts,</span></p></li>
<li dir="ltr" style="list-style-type:decimal;font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;" role="presentation"><span style="font-size:11pt;font-family:Arial;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">apply transformations to syntax trees.</span></p></li>
</ol>
<p>```<br>
</p>
<p><br>
</p>
<p>Thanks,</p>
<p>Stephen.<br>
</p>
<div class="moz-cite-prefix">On 20/12/2019 22:02, Gábor Horváth
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFYOzqZY3zusurDKYH5kVi_CmkKbGPT_-sBw6BYr6QfxC5FBeQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi!
<div><br>
</div>
<div>I like the idea of making writing tools/prototypes easier.
But if the goal is to get rid of invisible nodes when matching
I wonder if this would somewhat overlap with syntax trees [1].
Adding Dmitri and Ilya in case they have an opinion on that.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Gabor</div>
<div><br>
</div>
<div>[1]: <a
href="https://docs.google.com/document/d/161XftOcF-ut1pGQr5ci9kXd_y0jRQl3y9sVyvuEkLDc/edit#heading=h.cwnlr9q7jmlp"
moz-do-not-send="true">https://docs.google.com/document/d/161XftOcF-ut1pGQr5ci9kXd_y0jRQl3y9sVyvuEkLDc/edit#heading=h.cwnlr9q7jmlp</a></div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Dec 20, 2019 at 1:06
PM Aaron Ballman via cfe-dev <<a
href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On
Fri, Dec 20, 2019 at 4:01 PM Stephen Kelly via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank"
moz-do-not-send="true">cfe-dev@lists.llvm.org</a>> wrote:<br>
><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" moz-do-not-send="true">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" moz-do-not-send="true">https://docs.google.com/document/d/17Z6gAwwc3HoRXvsy0OdwU0X5MFQEuiGeSu3i6ICOB90</a><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>
I'm generally in favor of this path forward. I think this is
the<br>
correct default and allows a more gentle introduction to AST
matchers<br>
for people new to the project (which helps with introducing
new<br>
clang-tidy checks) while still allowing people who need to get
into<br>
the nitty gritty details of the AST to do so as needed. Thank
you for<br>
the efforts!<br>
<br>
CCing Manual, Alex, and Sam because they do a lot of work on
the<br>
matcher interfaces as well.<br>
<br>
~Aaron<br>
<br>
><br>
> Thanks,<br>
><br>
> Stephen.<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank"
moz-do-not-send="true">cfe-dev@lists.llvm.org</a><br>
> <a
href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank"
moz-do-not-send="true">cfe-dev@lists.llvm.org</a><br>
<a
href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote>
</div>
</blockquote>
</body>
</html>