[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:       Dimitar Dobrev <dpldobrev () yahoo ! com>
Date:       2015-05-04 0:47:12
Message-ID: 1447821873.734602.1430700432550.JavaMail.yahoo () mail ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


       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)]

<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, \
Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12px"><div \
id="yui_3_16_0_1_1430650706555_33836"><br><span></span></div><div \
id="yui_3_16_0_1_1430650706555_33289"><span \
id="yui_3_16_0_1_1430650706555_33290">&nbsp;&nbsp;&nbsp; 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.</span></div>  <br><div class="qtdSeparateBR"><br><br></div><div \
style="display: block;" class="yahoo_quoted"> <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;popizdeh@gmail.com&gt; wrote:<br> \
</font> </div>  <br><br> <div class="y_msg_container"><div \
id="yiv6035708039"><div><div dir="ltr">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.</div><div \
class="yiv6035708039gmail_extra"><br clear="none"><div \
class="yiv6035708039gmail_quote">On Mon, May 4, 2015 at 12:49 AM, Dimitar Dobrev \
<span dir="ltr">&lt;<a rel="nofollow" shape="rect" \
ymailto="mailto:dpldobrev@yahoo.com" target="_blank" \
href="mailto:dpldobrev@yahoo.com">dpldobrev@yahoo.com</a>&gt;</span> wrote:<br \
clear="none"><blockquote class="yiv6035708039gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex;"><div \
class="yiv6035708039yqt8530730475" id="yiv6035708039yqt50477"><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>&nbsp;&nbsp;&nbsp; Hi all,</div><div><br \
clear="none"></div><div dir="ltr">&nbsp;&nbsp;&nbsp; I have the following header:<br \
clear="none"><br clear="none"><br clear="none">&nbsp;&nbsp;&nbsp;&nbsp;class \
Class1<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp;{<br \
clear="none">&nbsp;&nbsp;&nbsp;&nbsp;};<br clear="none"><br \
clear="none">&nbsp;&nbsp;&nbsp;&nbsp;class Class2<br \
clear="none">&nbsp;&nbsp;&nbsp;&nbsp;{<br \
clear="none">&nbsp;&nbsp;&nbsp;&nbsp;public:<br clear="none">&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;friend inline const Class1 operator+(const Class1&amp; f1, \
const Class1&amp; f2);<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp;};<br clear="none"><br \
clear="none">&nbsp;&nbsp;&nbsp;&nbsp;inline const Class1 operator+(const Class1&amp; \
f1, const Class1&amp; f2)<br clear="none">&nbsp;&nbsp;&nbsp;&nbsp;{<br \
clear="none">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;return Class1();<br \
clear="none">&nbsp;&nbsp;&nbsp;&nbsp;}<br clear="none"><br clear="none"><br \
clear="none">&nbsp;&nbsp;&nbsp;&nbsp;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.</div><div dir="ltr"><br \
clear="none"></div><div dir="ltr">&nbsp;&nbsp;&nbsp; I think it's a bug so I filed it \
at <a rel="nofollow" shape="rect" target="_blank" \
href="https://llvm.org/bugs/show_bug.cgi?id=23401">https://llvm.org/bugs/show_bug.cgi?id=23401</a> \
. But I may me wrong so I'd appreciate your opinion.</div><span \
class="yiv6035708039HOEnZb"><font color="#888888"></font></span><div dir="ltr"><br \
clear="none"></div><div dir="ltr"><br clear="none"></div><div \
dir="ltr">&nbsp;&nbsp;&nbsp; Dimitar Dobrev</div><div dir="ltr"><br \
clear="none"></div><div>&nbsp;</div></div></div></div><br \
clear="none">_______________________________________________<br clear="none"> cfe-dev \
mailing list<br clear="none"> <a rel="nofollow" shape="rect" \
ymailto="mailto:cfe-dev@cs.uiuc.edu" target="_blank" \
href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br clear="none"> <a \
rel="nofollow" shape="rect" target="_blank" \
href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">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></body></html>



_______________________________________________
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