[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    Re: [PATCH] Fix source range of destructor name
From:       Richard Smith <metafoo () gmail ! com>
Date:       2014-01-22 0:35:39
Message-ID: -6798167422057077741 () gmail297201516
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Mon Jan 20 2014 at 7:55:19 AM, Olivier Goffart <ogoffart@kde.org> wrote:

> On Thursday 16 January 2014 16:25:58 Richard Smith wrote:
> > Both patches LGTM, thanks!
>
> Could you please commit them as I do not have SVN access.
>

Committed as r199778 and 199779, thanks!


> --
> Thanks.
>
> >
> > On Thu, Jan 16, 2014 at 4:13 AM, Olivier Goffart <ogoffart@kde.org>
> wrote:
> > > Hi,
> > >
> > > Thanks for the feed back.
> > > I've now split the patch into two.  The first one fix the printing of
> the
> > > tag
> > > name, when printing DeclarationName.
> > > There was one more way to print declaration name, and i think they
> should
> > > follow the same pattern.
> > > And the second patch fix the issue that the destructor did not have an
> > > attached
> > > type location. With a test this time.
> > >
> > > --
> > > Olivier
> > >
> > > On Thursday 16 January 2014 00:00:49 Richard Smith wrote:
> > > > On Wed Jan 15 2014 at 2:29:52 PM, Olivier Goffart <ogoffart@kde.org>
> > >
> > > wrote:
> > > > > On Wednesday 15 January 2014 13:50:49 Richard Smith wrote:
> > > > > > On Wed, Jan 15, 2014 at 1:25 PM, Olivier Goffart <
> ogoffart@kde.org>
> > > > >
> > > > > wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > This fixes http://llvm.org/bugs/show_bug.cgi?id=15125
> > > > > > > The problem is that destructor->getNameInfo().getSourceRange()
> > > > > > > only
> > > > > > > contains
> > > > > > > the '~' and not the class name after it.
> > > > > > >
> > > > > > > This is why for example the destructor name is not highlighted
> in
> > >
> > > my
> > >
> > > > > code
> > > > >
> > > > > > > browser, only the '~' has a tooltip.
> > > > > > >
> > > > > > > http://code.woboq.org/userspace/llvm/tools/clang/
> > > > >
> > > > > include/clang/AST/Declara
> > > > >
> > > > > > > tionName.h.html#_ZN5clang20Declarationisn'tNameTableD1Ev<
> > >
> > > http://code.
> > >
> > > > > woboq
> > > > >
> > > > > > > .org/userspace/llvm/tools/clang/include/clang/AST/
> > > > >
> > > > > DeclarationName.h.html#_
> > > > >
> > > > > > > ZN5clang20DeclarationNameTableD1Ev>
> > > > > >
> > > > > > +            return CreateParsedType(MemberOfType,
> > > > > > +                    Context.getTrivialTypeSourceInfo(
> MemberOfType,
> > > > > > NameLoc));
> > > > > >
> > > > > >              return ParsedType::make(MemberOfType);
> > > > > >
> > > > > > Please delete the unreachable 'return' statement here.
> > > > >
> > > > > This is obviously a left over.
> > > > >
> > > > > > There are 3 other 'return ParsedType::make(...);' calls in this
> > > > > > function,
> > > > > > and they all seem to have the same issue; do these need changes
> too?
> > > > >
> > > > > Right, I'll change them too.
> > > > >
> > > > > > Also, you aren't including the location information from the
> > > > >
> > > > > CXXScopeSpec in
> > > > >
> > > > > > the produced TypeSourceInfo, so this still doesn't look exactly
> > > > > > right
> > > > >
> > > > > (for
> > > > >
> > > > > > p->X::Y::~Y(), you probably won't be able to provide an
> appropriate
> > > > >
> > > > > tooltip
> > > > >
> > > > > > for the 'X', even with this fix, for instance).
> > > > >
> > > > > I fail to understand this.
> > > > >
> > > > > only  ~Y  here is the name of the destructor.
> > > > > If I am not mistaken, X::Y:: is the qualifier (as traversed with
> > > > > destructor-
> > > > >
> > > > > >getQualifierLoc())    and should not be part of the function name
> > >
> > > itself.
> > >
> > > > Sorry, yes, you're absolutely right.
> > > >
> > > > > > The changes to DeclarationName.cpp and to DeclPrinterTest.cpp
> look
> > > > > > unrelated to this fix (right?), and the fix itself seems to be
> > >
> > > missing a
> > >
> > > > > > test.
> > > > >
> > > > > They are related because now that  the destructor has a full type
> > > > > information,
> > > > >
> > > > >  '~class Foo'  is written instead of '~Foo'  and other tests were
> > >
> > > failing
> > >
> > > > > without that change.
> > > >
> > > > OK, it's a shame that we need to do this, but this looks fine. It'd
> be a
> > > > little nicer to set LangOpts.CPlusPlus rather than setting
> > > > SuppressTagKeywords.
> > > >
> > > > (I wonder if we can remove the printing of the tag keyword from
> > > > TypePrinter::printTag -- it should be wrapped in an ElaboratedType if
> > > > that's necessary, and the tag keyword would get printed there.)
>
>

[Attachment #5 (text/html)]

<div>On Mon Jan 20 2014 at 7:55:19 AM, Olivier Goffart &lt;<a \
href="mailto:ogoffart@kde.org">ogoffart@kde.org</a>&gt; wrote:</div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> On Thursday 16 January 2014 16:25:58 Richard Smith \
wrote:<br> &gt; Both patches LGTM, thanks!<br>
<br>
Could you please commit them as I do not have SVN \
access.<br></blockquote><div><br></div><div>Committed as r199778 and 199779, \
thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">

--<br>
Thanks.<br>
<br>
&gt;<br>
&gt; On Thu, Jan 16, 2014 at 4:13 AM, Olivier Goffart &lt;<a \
href="mailto:ogoffart@kde.org" target="_blank">ogoffart@kde.org</a>&gt; wrote:<br> \
&gt; &gt; Hi,<br> &gt; &gt;<br>
&gt; &gt; Thanks for the feed back.<br>
&gt; &gt; I&#39;ve now split the patch into two.  The first one fix the printing of \
the<br> &gt; &gt; tag<br>
&gt; &gt; name, when printing DeclarationName.<br>
&gt; &gt; There was one more way to print declaration name, and i think they \
should<br> &gt; &gt; follow the same pattern.<br>
&gt; &gt; And the second patch fix the issue that the destructor did not have an<br>
&gt; &gt; attached<br>
&gt; &gt; type location. With a test this time.<br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt; Olivier<br>
&gt; &gt;<br>
&gt; &gt; On Thursday 16 January 2014 00:00:49 Richard Smith wrote:<br>
&gt; &gt; &gt; On Wed Jan 15 2014 at 2:29:52 PM, Olivier Goffart &lt;<a \
href="mailto:ogoffart@kde.org" target="_blank">ogoffart@kde.org</a>&gt;<br> &gt; \
&gt;<br> &gt; &gt; wrote:<br>
&gt; &gt; &gt; &gt; On Wednesday 15 January 2014 13:50:49 Richard Smith wrote:<br>
&gt; &gt; &gt; &gt; &gt; On Wed, Jan 15, 2014 at 1:25 PM, Olivier Goffart &lt;<a \
href="mailto:ogoffart@kde.org" target="_blank">ogoffart@kde.org</a>&gt;<br> &gt; &gt; \
&gt; &gt;<br> &gt; &gt; &gt; &gt; wrote:<br>
&gt; &gt; &gt; &gt; &gt; &gt; Hi,<br>
&gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; This fixes <a \
href="http://llvm.org/bugs/show_bug.cgi?id=15125" \
target="_blank">http://llvm.org/bugs/show_bug.<u></u>cgi?id=15125</a><br> &gt; &gt; \
&gt; &gt; &gt; &gt; The problem is that \
destructor-&gt;getNameInfo().<u></u>getSourceRange()<br> &gt; &gt; &gt; &gt; &gt; \
&gt; only<br> &gt; &gt; &gt; &gt; &gt; &gt; contains<br>
&gt; &gt; &gt; &gt; &gt; &gt; the &#39;~&#39; and not the class name after it.<br>
&gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; This is why for example the destructor name is not \
highlighted in<br> &gt; &gt;<br>
&gt; &gt; my<br>
&gt; &gt;<br>
&gt; &gt; &gt; &gt; code<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; browser, only the &#39;~&#39; has a tooltip.<br>
&gt; &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; <a \
href="http://code.woboq.org/userspace/llvm/tools/clang/" \
target="_blank">http://code.woboq.org/<u></u>userspace/llvm/tools/clang/</a><br> &gt; \
&gt; &gt; &gt;<br> &gt; &gt; &gt; &gt; include/clang/AST/Declara<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; \
tionName.h.html#_<u></u>ZN5clang20Declarationisn&#39;<u></u>tNameTableD1Ev&lt;<br> \
&gt; &gt;<br> &gt; &gt; <a href="http://code" target="_blank">http://code</a>.<br>
&gt; &gt;<br>
&gt; &gt; &gt; &gt; woboq<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; \
.org/userspace/llvm/tools/<u></u>clang/include/clang/AST/<br> &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; DeclarationName.h.html#_<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; &gt; ZN5clang20DeclarationNameTable<u></u>D1Ev&gt;<br>
&gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; +            return CreateParsedType(MemberOfType,<br>
&gt; &gt; &gt; &gt; &gt; +                    \
Context.<u></u>getTrivialTypeSourceInfo(<u></u>MemberOfType,<br> &gt; &gt; &gt; &gt; \
&gt; NameLoc));<br> &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;              return \
ParsedType::make(MemberOfType)<u></u>;<br> &gt; &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Please delete the unreachable &#39;return&#39; statement \
here.<br> &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; This is obviously a left over.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; There are 3 other &#39;return ParsedType::make(...);&#39; \
calls in this<br> &gt; &gt; &gt; &gt; &gt; function,<br>
&gt; &gt; &gt; &gt; &gt; and they all seem to have the same issue; do these need \
changes too?<br> &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Right, I&#39;ll change them too.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; Also, you aren&#39;t including the location information from \
the<br> &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; CXXScopeSpec in<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; the produced TypeSourceInfo, so this still doesn&#39;t look \
exactly<br> &gt; &gt; &gt; &gt; &gt; right<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; (for<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; p-&gt;X::Y::~Y(), you probably won&#39;t be able to provide \
an appropriate<br> &gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; tooltip<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; for the &#39;X&#39;, even with this fix, for instance).<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; I fail to understand this.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; only  ~Y  here is the name of the destructor.<br>
&gt; &gt; &gt; &gt; If I am not mistaken, X::Y:: is the qualifier (as traversed \
with<br> &gt; &gt; &gt; &gt; destructor-<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt;getQualifierLoc())    and should not be part of the function \
name<br> &gt; &gt;<br>
&gt; &gt; itself.<br>
&gt; &gt;<br>
&gt; &gt; &gt; Sorry, yes, you&#39;re absolutely right.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; The changes to DeclarationName.cpp and to \
DeclPrinterTest.cpp look<br> &gt; &gt; &gt; &gt; &gt; unrelated to this fix (right?), \
and the fix itself seems to be<br> &gt; &gt;<br>
&gt; &gt; missing a<br>
&gt; &gt;<br>
&gt; &gt; &gt; &gt; &gt; test.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; They are related because now that  the destructor has a full \
type<br> &gt; &gt; &gt; &gt; information,<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;  &#39;~class Foo&#39;  is written instead of &#39;~Foo&#39;  and \
other tests were<br> &gt; &gt;<br>
&gt; &gt; failing<br>
&gt; &gt;<br>
&gt; &gt; &gt; &gt; without that change.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; OK, it&#39;s a shame that we need to do this, but this looks fine. \
It&#39;d be a<br> &gt; &gt; &gt; little nicer to set LangOpts.CPlusPlus rather than \
setting<br> &gt; &gt; &gt; SuppressTagKeywords.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; (I wonder if we can remove the printing of the tag keyword from<br>
&gt; &gt; &gt; TypePrinter::printTag -- it should be wrapped in an ElaboratedType \
if<br> &gt; &gt; &gt; that&#39;s necessary, and the tag keyword would get printed \
there.)<br> <br>
</blockquote>



_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic