sammccall added inline comments.

================
Comment at: clang-tools-extra/clangd/Headers.h:167
 
+  void recordNonSelfContained(HeaderID ID) { NonSelfContained.insert(ID); }
+
----------------
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)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114370

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to