<div dir="ltr"><div><span style="font-family:arial,sans-serif;font-size:13px">Changing getLocStart to getLocEnd would indeed fix the first issue, are you OK with this Richard?</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><font face="arial, sans-serif">As for the second example, this type of declaration appears unsupported (not sure what this exactly means), but I wouldn't be surprised if ast is incomplete because of this. Namely NumTPLists is 0 when FriendDecl is coming from the instantiation. This is from getSourceRange:</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif"> else if (TypeSourceInfo *TInfo = getFriendType()) {</font></div><div><font face="arial, sans-serif"> SourceLocation StartL = (NumTPLists == 0)</font></div>
<div><font face="arial, sans-serif"> ? getFriendLoc()</font></div><div><font face="arial, sans-serif"> : getTPLists()[0]->getTemplateLoc();</font></div><div><font face="arial, sans-serif"> return SourceRange(StartL, TInfo->getTypeLoc().getEndLoc()) </font></div>
<span style="font-family:arial,sans-serif;font-size:13px"><div>
<br></div></span><div class="gmail_extra"><div class="gmail_quote">On Sat, Aug 30, 2014 at 4:43 PM, Abramo Bagnara <span dir="ltr"><<a href="mailto:abramo.bagnara@bugseng.com" title="[GMCP] Compose a new mail to abramo.bagnara@bugseng.com" rel="noreferrer" target="_blank" onclick="window.open('https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&to=abramo.bagnara@bugseng.com', null, 'left=320,top=222,width=640,height=580,');return false">abramo.bagnara@bugseng.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">Il 30/08/2014 03:02, Nikola Smiljanic ha scritto:<br>
<div>> > This seems wrong to me.<br>
> ><br>
> > Did you mean to write getLocEnd() instead? (Under the assumption that<br>
> > identifier should comes last in class type)<br>
><br>
><br>
> This was done so that 'friend struct A' and 'friend A' (C++11) have<br>
> different location since former is also a forward declaration. Does that<br>
> make sense or have I misunderstood your question?<br>
<br>
</div>AFAIK this is not correct: getLocation() should always return the<br>
location of identifier token.<br>
<div><br>
><br>
> It is useful to know that currently for:<br>
><br>
> template <class U> class C {<br>
> template<class T> friend struct A<T>::B;<br>
> };<br>
><br>
><br>
> Not really sure what A is supposed to be here but this code is<br>
> ill-formed: explicit specialization of non-template struct 'A'<br>
<br>
</div>This was only the part containing shown location, full code is<br>
<br>
template <class T> struct A<br>
{<br>
struct B { };<br>
<div>};<br>
<br>
template <class U> class C {<br>
template <class T> friend struct A<T>::B;<br>
};<br>
<br>
<br>
</div><div><div>--<br>
Abramo Bagnara<br>
<br>
BUGSENG srl - <a href="http://bugseng.com" target="_blank">http://bugseng.com</a><br>
mailto:<a href="mailto:abramo.bagnara@bugseng.com" title="[GMCP] Compose a new mail to abramo.bagnara@bugseng.com" rel="noreferrer" target="_blank" onclick="window.open('https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&to=abramo.bagnara@bugseng.com', null, 'left=320,top=222,width=640,height=580,');return false">abramo.bagnara@bugseng.com</a><br>
</div></div></blockquote></div><br></div></div>