<div dir="ltr">Hi, it has been more than a year I have reported bug 13699, since no progress<br>has been made I have setup a debugging version of clang, right now I'm digging<br>the sources and have inferred that <br><br>
clang::Decl::setObjectOfFriendDecl DeclBase.h:887 called at<br>clang::TemplateDeclInstantiator::VisitClassTemplateDecl SemaTemplateInstantiateDecl.cpp:941<br><br> Inst->setObjectOfFriendDecl();<br> // TODO: do we want to track the instantiation progeny of this<br>
// friend target decl?<br><br>later affects<br><br>ResultBuilder::isInterestingDecl SemaCodeComplete.cpp:496<br><br> // Friend declarations and declarations introduced due to friends are never<br> // added as results.<br>
if (IDNS & (Decl::IDNS_OrdinaryFriend | Decl::IDNS_TagFriend))<br> return false;<br><br>Given this gist <a href="https://gist.github.com/oblitum/9302588">https://gist.github.com/oblitum/9302588</a>, executing<br>
<br> clang-hacking file.cpp 11 12<br><br>provides completion for the boost::shared_ptr class template but<br><br> clang-hacking file.cpp 12 12<br><br>will not. This happens because IDNS of the class template is changed because of<br>
the parsing of the first declaration coming at line 11, such parsing ends up<br>instantiating the friend class template, and changing its IDNS. After this first<br>change, no more completions for such type happens.<br><br>
On 13699 there're two small patterns that bring this issue up. Also, as such<br>patterns are not very uncommon, it affects for-range loops over libc++<br>containers, boost classes and annoys some programmers.<br><br>This is all on revision 202241.<br>
<br>I'm still not a clang developer (still not), all I know comes from this<br>debugging session, so I think there can be more wise patches than mine now.<br><br>Regards,<br>Francisco Lopes<br></div>