[cfe-dev] Help me out with this bug

Francisco Lopes francisco.mailing.lists at oblita.com
Sat Mar 1 22:25:53 PST 2014


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
clang::TemplateDeclInstantiator::VisitClassTemplateDecl
SemaTemplateInstantiateDecl.cpp:941

  Inst->setObjectOfFriendDecl();
  // TODO: do we want to track the instantiation progeny of this
  // friend target decl?

later affects

ResultBuilder::isInterestingDecl   SemaCodeComplete.cpp:496

  // Friend declarations and declarations introduced due to friends are
never
  // added as results.
  if (IDNS & (Decl::IDNS_OrdinaryFriend | Decl::IDNS_TagFriend))
    return false;

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.

Regards,
Francisco Lopes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140302/de55cb19/attachment.html>


More information about the cfe-dev mailing list