[PATCH] D114370: [clangd] Record information about non self-contained headers in IncludeStructure

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 26 05:12:17 PST 2021


kbobyrev added inline comments.


================
Comment at: clang-tools-extra/clangd/Headers.h:167
 
+  void recordNonSelfContained(HeaderID ID) { NonSelfContained.insert(ID); }
+
----------------
sammccall wrote:
> kbobyrev wrote:
> > sammccall wrote:
> > > could consider `friend class RecordHeaders`, either is ugly, up to you
> > That was the original problem I had the public field in the previous iteration: `RecordHeaders` is defined in anonymous namespace, so IIUC I can not friend it from here unless I make it a subclass or somehow visible from here, otherwise it wouldn't work, would it? Is there any clean way to do the `friend` here?
> No, you need to move it out of the anonymous namespace. Which is part of the ugliness, though not harmful in practice.
> 
> (If you're worried about namespace pollution you can make it a nested class of IncludeStructure. You have to forward declare it in the header. In that case you don't have to friend it)
I see, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114370/new/

https://reviews.llvm.org/D114370



More information about the cfe-commits mailing list