<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 12, 2014 at 4:54 PM, Nikola Smiljanić <span dir="ltr"><<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Turns out we didn't have correct location and range for class template friend. The same was true for case where friend is not the first token as in Richard's inline example.<br>
<br>
Manuel:<br>
Are my constructor/destructor matchers good?<br>
<br>
Richard:<br>
1. What's the TypeSourceInfo case in FriendDecl::getSourceRange?<br></blockquote><div><br></div><div>This is a C++11 feature:</div><div><br></div><div>struct A;</div><div>struct B {</div><div> friend A; // note, not 'friend struct A;'</div>
<div>};</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2. I couldn't find a way to hit the first call to FriendDecl::Create inside Sema::ActOnTemplatedFriendTag (some kind of explicit specialization case).</blockquote><div><br></div><div>Should be:</div><div><br></div><div>
template<typename> struct C {};</div><div>struct D {</div><div> template<> friend struct C<int>;</div><div>};</div><div><br></div><div>(That's ill-formed, but our error recovery path treats it as if it didn't have the 'template<>'.) If that doesn't hit that codepath, I think it may be unreachable.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I tried issuing a random diagnostic from there hoping it would break something in the test suite but it seems we don't have any coverage for this?<br>
<a href="http://reviews.llvm.org/D3906" target="_blank">http://reviews.llvm.org/D3906</a><br>
<br>
Files:<br>
include/clang/AST/DeclFriend.h<br>
include/clang/Sema/Sema.h<br>
lib/Sema/SemaDecl.cpp<br>
lib/Sema/SemaDeclCXX.cpp<br>
lib/Sema/SemaTemplate.cpp<br>
unittests/AST/SourceLocationTest.cpp<br>
</blockquote></div><br></div></div>