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

List:       cfe-dev
Subject:    Re: [cfe-dev] Incorrect location of a friend declaration
From:       Nikola Smiljanic <popizdeh () gmail ! com>
Date:       2015-05-04 0:53:23
Message-ID: CAGq7tnMikY5mSycGdeD4S0fD29O73sf0WdudSFbMrWDXwi0Jwg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Exactly, I've closed the bug.

On Mon, May 4, 2015 at 10:47 AM, Dimitar Dobrev <dpldobrev@yahoo.com> wrote:

>
>     Through testing I found out that Clang considers the entity at line 11
> a function redeclaration so I am able to get the correct line number by
> iterating through redeclarations. I guess it's not a bug after all.
>
>
>
>   On Monday, May 4, 2015 3:36 AM, Nikola Smiljanic <popizdeh@gmail.com>
> wrote:
>
>
> If I understand correctly you think that FunctionDecl at line 8 should
> point to line 11? That doesn't seem right, what you have at line 8 really
> is a function declaration. What you have at line 11 is the definition of
> previously declared function.
>
> On Mon, May 4, 2015 at 12:49 AM, Dimitar Dobrev <dpldobrev@yahoo.com>
> wrote:
>
>
>     Hi all,
>
>     I have the following header:
>
>
>     class Class1
>     {
>     };
>
>     class Class2
>     {
>     public:
>         friend inline const Class1 operator+(const Class1& f1, const
> Class1& f2);
>     };
>
>     inline const Class1 operator+(const Class1& f1, const Class1& f2)
>     {
>         return Class1();
>     }
>
>
>     Decl::getLocation() returns line 8 for the friend - that's correct.
> But it returns 8 for the friend declaration, that is, the function itself,
> too, while the function is actually located at line 11. If the friend is
> deleted, then the correct location is reported.
>
>     I think it's a bug so I filed it at
> https://llvm.org/bugs/show_bug.cgi?id=23401 . But I may me wrong so I'd
> appreciate your opinion.
>
>
>     Dimitar Dobrev
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
>
>
>

[Attachment #5 (text/html)]

<div dir="ltr">Exactly, I&#39;ve closed the bug.</div><div \
class="gmail_extra"><br><div class="gmail_quote">On Mon, May 4, 2015 at 10:47 AM, \
Dimitar Dobrev <span dir="ltr">&lt;<a href="mailto:dpldobrev@yahoo.com" \
target="_blank">dpldobrev@yahoo.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div><div \
style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica \
Neue,Helvetica,Arial,Lucida \
Grande,sans-serif;font-size:12px"><div><br><span></span></div><div><span>       \
Through testing I found out that Clang considers the entity at line 11 a function \
redeclaration so I am able to get the correct line number by iterating through \
redeclarations. I guess it&#39;s not a bug after all.</span></div><div><div \
class="h5">  <br><div><br><br></div><div style="display:block"> <div \
style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida \
Grande,sans-serif;font-size:12px"> <div style="font-family:HelveticaNeue,Helvetica \
Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"> <div dir="ltr"> <font \
face="Arial" size="2"> On Monday, May 4, 2015 3:36 AM, Nikola Smiljanic &lt;<a \
href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>&gt; \
wrote:<br> </font> </div>  <br><br> <div><div><div><div dir="ltr">If I understand \
correctly you think that FunctionDecl at line 8 should point to line 11? That \
doesn&#39;t seem right, what you have at line 8 really is a function declaration. \
What you have at line 11 is the definition of previously declared \
function.</div><div><br clear="none"><div>On Mon, May 4, 2015 at 12:49 AM, Dimitar \
Dobrev <span dir="ltr">&lt;<a rel="nofollow" shape="rect" \
href="mailto:dpldobrev@yahoo.com" target="_blank">dpldobrev@yahoo.com</a>&gt;</span> \
wrote:<br clear="none"><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div><div><div \
style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica \
Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:12px"><div><br \
clear="none"></div><div>       Hi all,</div><div><br clear="none"></div><div \
dir="ltr">       I have the following header:<br clear="none"><br clear="none"><br \
clear="none">        class Class1<br clear="none">        {<br clear="none">        \
};<br clear="none"><br clear="none">        class Class2<br clear="none">        {<br \
clear="none">        public:<br clear="none">               friend inline const \
Class1 operator+(const Class1&amp; f1, const Class1&amp; f2);<br clear="none">        \
};<br clear="none"><br clear="none">        inline const Class1 operator+(const \
Class1&amp; f1, const Class1&amp; f2)<br clear="none">        {<br clear="none">      \
return Class1();<br clear="none">        }<br clear="none"><br clear="none"><br \
clear="none">        Decl::getLocation() returns line 8 for the friend - that&#39;s \
correct. But it returns 8 for the friend declaration, that is, the function itself, \
too, while the function is actually located at line 11. If the friend is deleted, \
then the correct location is reported.</div><div dir="ltr"><br \
clear="none"></div><div dir="ltr">       I think it&#39;s a bug so I filed it at <a \
rel="nofollow" shape="rect" href="https://llvm.org/bugs/show_bug.cgi?id=23401" \
target="_blank">https://llvm.org/bugs/show_bug.cgi?id=23401</a> . But I may me wrong \
so I&#39;d appreciate your opinion.</div><span><font \
color="#888888"></font></span><div dir="ltr"><br clear="none"></div><div \
dir="ltr"><br clear="none"></div><div dir="ltr">       Dimitar Dobrev</div><div \
dir="ltr"><br clear="none"></div><div>  </div></div></div></div><br \
clear="none">_______________________________________________<br clear="none"> cfe-dev \
mailing list<br clear="none"> <a rel="nofollow" shape="rect" \
href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br \
clear="none"> <a rel="nofollow" shape="rect" \
href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" \
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br \
clear="none"> <br clear="none"></blockquote></div><br \
clear="none"></div></div></div><br><br></div>  </div> </div>  \
</div></div></div></div></div></blockquote></div><br></div>



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


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

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