<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<div class="moz-cite-prefix">On 24/06/2020 21:26, Yitzhak Mandelbaum
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKTLd7wqycd3uMXN2rkCHYr99=jo7JHemLE9jMQQAviJJ-8tgg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">My 2cents: </div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>Thanks for responding about the matcher output from clang-query.<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CAKTLd7wqycd3uMXN2rkCHYr99=jo7JHemLE9jMQQAviJJ-8tgg@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">I mostly agree
with Richard and Sam. My only concern w/ Richard's proposal is
that the hybrid model may be even more confusing to the
beginner, since it may be harder to predict how a given
matcher will match against an AST. The system will be more
forgiving, yet it becomes harder to build a mental model of
how it works. <br>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>In addition to making clang-query output relatable information, I
agree with what you wrote here about creating a mental model.<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CAKTLd7wqycd3uMXN2rkCHYr99=jo7JHemLE9jMQQAviJJ-8tgg@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"> I think we'd
need to be sure we can concisely explain how this mode works,
without having to reference any code/algorithms. For example,
is there a deterministic elaboration from any unadorned
matcher to a matcher with explicit `traverse` annotations?
That would allow us to give some examples that illuminate
what's happening. Otherwise, I'd prefer we just go back to the
original default for the library. I'm fine if
beginner-oriented tools want to start with "IgnoreUnless..."
as their default. It sounds like Stephen is amenable to this
approach as well from his last reply.</div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>I think reversing the change of default is a worse outcome, but I
think it's better than the current state of unhappiness from
people. <br>
</p>
<p>Further development can't happen until this thread is resolved I
think.</p>
<p>However, if the default is changed back, I think there is less
reason to add the matcher output feature to clang-query, because
it will either need to <br>
</p>
<p>* not show ignoring*() matchers in its output<br>
</p>
<p>* show output based on each of (and none of) the ignoring*()
matchers being applied</p>
<p>I think that would be too noisy and I don't think it's a good
thing to require newcomer users to immediately create a mental
model which requires those matchers.<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CAKTLd7wqycd3uMXN2rkCHYr99=jo7JHemLE9jMQQAviJJ-8tgg@mail.gmail.com">
<div dir="ltr">
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">re:
context-sensitive suggestions. </div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Stephen, if you
drop the need to suggest all possible matchers at that point
and only provide (beginner) helpful suggestions, does your
concern go away? </div>
</div>
</blockquote>
<p><br>
</p>
<p>It doesn't change my concern. <br>
</p>
<p>I don't know how you would determine what should be in the output
and what shouldn't. Also, this content is not just for beginners.
I use the feature still.</p>
<p>I don't think this is the thread for details such as your other
question.</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CAKTLd7wqycd3uMXN2rkCHYr99=jo7JHemLE9jMQQAviJJ-8tgg@mail.gmail.com">
<div dir="ltr"><span class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Overall, </span>I'm<span
class="gmail_default"
style="font-family:arial,helvetica,sans-serif"> </span>pessimistic
ab<span class="gmail_default"
style="font-family:arial,helvetica,sans-serif"></span>out
making the current matchers easier for users.</div>
</blockquote>
<p><br>
</p>
<p>I think if AST Matchers are not going to be removed, we should
make them easier for users.</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CAKTLd7wqycd3uMXN2rkCHYr99=jo7JHemLE9jMQQAviJJ-8tgg@mail.gmail.com">
<div dir="ltr"> I think the AST is challenging for beginners and
band aids will not solve that and can often make it worse. If we
want beginner-friendly tooling (and I do!) we need to admit its
cost and then invest in it.<span
style="font-family:arial,helvetica,sans-serif"></span></div>
</blockquote>
<p><br>
</p>
<p>Yes, I have started such tooling, but there is much more that can
be done.<br>
</p>
<p>But, as in this thread, I don't think this is fully a tooling
issue. It's also about discoverability and that means making it
easier for users to create a mental model that doesn't require
them to put ignoringImplicit() everywhere.</p>
<p><br>
</p>
<p>Thanks Yitzhak for your input. I remain interested in
feedback/input from others on the content I quote below.<br>
</p>
<p><br>
</p>
<p>Thanks,</p>
<p>Stephen.<br>
</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CAKTLd7wqycd3uMXN2rkCHYr99=jo7JHemLE9jMQQAviJJ-8tgg@mail.gmail.com">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Jun 22, 2020 at 5:51
PM Stephen Kelly 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">
<div bgcolor="#FFFFFF"><br>
<p>The main reason I'm not supportive of this idea is that I
want to make clang-query tell the user what matchers they
can use with the nodes in the binding list.<br>
</p>
<p>For example, if I write<br>
</p>
<p> returnStmt()</p>
<p>in clang-query it should tell me that I can write <br>
</p>
<p> hasReturnValue(integerLiteral())<br>
</p>
<p>inside the expr():</p>
<p> <a href="http://ce.steveire.com/z/9EF8x0"
target="_blank" moz-do-not-send="true">http://ce.steveire.com/z/9EF8x0</a></p>
<p>That's how I as a newcomer quickly discover
hasReturnValue() and integerLiteral().</p>
<p>You have no idea how overwhelming <br>
</p>
<p> <a
href="http://clang.llvm.org/docs/LibASTMatchersReference.html"
target="_blank" moz-do-not-send="true">http://clang.llvm.org/docs/LibASTMatchersReference.html</a><br>
</p>
<p>is to someone who has zero familiarity with the clang
AST.</p>
<p>But the above link is interactive and it aids *discovery*
which is what my talk was about and which is what I'm
trying to make easier with AST Matchers. The above
suggested clang-query feature (not upstream yet) tells me
at every step which matchers I can use in the context of
what I am trying to achieve.<br>
</p>
<p>However, if all of the implicit nodes should also appear
in that output, and if in<br>
</p>
<p>`returnStmt(hasReturnValue(expr().bind("theReturnVal")))`</p>
<p>the expr() should match the exprWithCleanups(), then I
don't know how to make that feature work. If the expr() is
the exprWithCleanups() then the tool definitely shouldn't
tell the user they can write integerLiteral() there. The
output for implicit nodes would add lots of noise and
would have to be neutral in terms of what it recommends.<br>
</p>
<p>The entire point of what I'm trying to do is not present
the user with exprWithCleanups() and let them achieve
their goals without it. I don't know if that's possible
with the ideas floating around at the moment about making
AST Matchers present all of the implicit nodes.</p>
<p>But, if making IgnoreUnlessSpelledInSource non-default
means that I can continue work toward that goal (and eg
ignore template instantiations and other implicit nodes
which are not skipped yet), then maybe that's a viable way
forward. So, that's my preference now I think.<br>
</p>
<p>That way, people who want expert mode get it by default,
and newcomers (and anyone else who doesn't want to write
ignoringImplicit() everywhere) can relatively easily get
the easier mode, and can use the expert mode when wanting
to match implicit nodes. <br>
</p>
<p>That might be the best compromise.<br>
</p>
<p>Thanks,</p>
<p>Stephen<br>
</p>
<p><br>
</p>
</div>
_______________________________________________<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>