[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:36:09
Message-ID: CAGq7tnMVSgMg2Qv1ZxJCTHgBpYYrsBXYnuSAnUAjSvUexAUa9w () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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">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 class="gmail_extra"><br><div class="gmail_quote">On Mon, \
May 4, 2015 at 12:49 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></div><div>    \
Hi all,</div><div><br></div><div dir="ltr">       I have the following \
header:<br><br><br>        class Class1<br>        {<br>        };<br><br>        \
class Class2<br>        {<br>        public:<br>               friend inline const \
Class1 operator+(const Class1&amp; f1, const Class1&amp; f2);<br>        };<br><br>   \
inline const Class1 operator+(const Class1&amp; f1, const Class1&amp; f2)<br>        \
{<br>               return Class1();<br>        }<br><br><br>        \
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></div><div dir="ltr">       I think \
it&#39;s a bug so I filed it at <a 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 class="HOEnZb"><font \
color="#888888"><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">     \
Dimitar Dobrev</div><div dir="ltr"><br></div><div>  \
</div></font></span></div></div><br>_______________________________________________<br>
 cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" \
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br> \
<br></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