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