<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 7, 2014 at 11:51 AM, Дмитрий Борисенков <span dir="ltr"><<a href="mailto:stackoverflow@xakep.ru" target="_blank">stackoverflow@xakep.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hello Manuel,<br><br>I've implemented RecursiveASTVisitor with the following VisitXXX method:<br>
<br><div>   bool VisitFriendDecl(FriendDecl *Declaration) {</div><div>      FullSourceLoc FullLocation = Context->getFullLoc(Declaration->getLocation());</div>
<div>      if (FullLocation.isValid()){</div><div>        llvm::outs() << "Found friend declaration at "</div><div>                     << FullLocation.getSpellingLineNumber() << ":"</div>

<div>                     << FullLocation.getSpellingColumnNumber() << "\n";</div><div>      }</div><div>      return true;</div><div>    }</div><div><br></div>Then I run a tool which contains my visitor on the following (incorrect) code<br>

<br><div><div>  1 template<typename T></div><div>  2 class F{};</div><div>  3 class F1{};</div><div>  4 void f(){};</div><div>  5 </div><div>  6 class classX</div><div>  7 {</div><div>  8   friend class classXfriend;</div>

<div>  9   friend class F<int>;</div><div> 10   friend class F1;</div><div> 11   friend void f();</div><div> 12 };</div></div><div><br></div><div>Tool displayed the following:<br></div><div><div><br></div><div>Found friend declaration at 8:3</div>

<div>Found friend declaration at 9:3</div><div>Found friend declaration at 10:3</div><div>Found friend declaration at 11:15</div></div><div><br></div><div>As you can see getLocation() refers to a friend keyword token in the case of a friend type declaration. Tool works with compilable code in the same way.<br>
</div></div></blockquote><div><br></div><div>After a short conversation with Richard Smith, we think this is a bug. Filed <a href="http://llvm.org/bugs/show_bug.cgi?id=19352">http://llvm.org/bugs/show_bug.cgi?id=19352</a>. Patches welcome :o)</div>
<div><br></div><div>Cheers,</div><div>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>
<br>--<br>Kind regards, Dmitry</div><div><br></div></div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Fri, Apr 4, 2014 at 9:50 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div>On Thu, Apr 3, 2014 at 11:41 AM, Дмитрий Борисенков <span dir="ltr"><<a href="mailto:stackoverflow@xakep.ru" target="_blank">stackoverflow@xakep.ru</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hello,<br><br>I'm trying to get a source location for a type name identifier in FriendDecl, but getLocation() method returns source location of keyword 'friend'. Such behavior confused me a bit, because usually getLocation() returns an identifier location. I've released I can get location which I need through DeclSpec::getTypeSpecTypeNameLoc(). But could you explain me why getLocation() behavior differs from expected one (at least expected by me) in this case?</div>


</blockquote><div><br></div></div><div>From the code this shouldn't be the case. Unless you're calling getFriendLoc() instead of getLocation().</div><div><br></div><div>Cheers,</div><div>/Manuel</div><div> </div>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>
<div dir="ltr"><span><font color="#888888"><br clear="all">
<div><br></div>-- <br>Kind regards, Dmitry Borisenkov</font></span></div>
<br></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">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></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span class=""><font color="#888888">-- <br>С уважением, Борисенков Дмитрий
</font></span></div>
</blockquote></div><br></div></div>