[PATCH] D47623: [clangd] Avoid indexing decls associated with friend decls.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 4 04:29:07 PDT 2018


ioeric added a comment.

In https://reviews.llvm.org/D47623#1120547, @ilya-biryukov wrote:

> In https://reviews.llvm.org/D47623#1119426, @ioeric wrote:
>
> > Sorry for the late response Ilya. I was trying to test these cases. So, with the current change, if a real "canonical" declaration comes before the friend decl, then the reference will still be recorded (I've added a test case for this). Would this address your concern?
>
>
> No worries about the late response.
>  I think we should **not** rely on an extra being before the friend declarations, i.e. we should count a reference either way.
>  The compiler does not enforce that and there's definitely lots of code where friend is the first decl. But it's totally up to you if you actually want to support this or not, of course. I do agree that this isn't ever going to be a major issue.


I think it would be pretty hard (or impossible) to get reference counting for friend decls correct for all cases given how friend decls work in C++ (e.g. friend decls and original decls might not even have the same name in AST). It would be nice to be able to handle all cases, but I do feel solving them is out of the scope of this patch.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D47623





More information about the cfe-commits mailing list