[PATCH] D60815: [clangd] Recognize "don't include me directly" pattern, and suppress include insertion.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 17 07:06:42 PDT 2019


ioeric added inline comments.


================
Comment at: clangd/index/SymbolCollector.cpp:631
+
+bool SymbolCollector::isSelfContainedHeader(FileID FID) {
+  // The real computation (which will be memoized).
----------------
sammccall wrote:
> ioeric wrote:
> > sammccall wrote:
> > > this has been moved to a member so it can use the cache and the (non-threadsafe) regex, and its logic has obviously been changed.
> > "self-contained header" doesn't sound accurate anymore. Maybe something like `isIncludable`?
> Let me explain how I think about it, and then I'll change the name if you still don't think it fits.
> 
> What we're detecting here (usually) is that this header can't be included unless a certain symbol/state is defined first from the outside.
> Whether that's for some direct technical reason (e.g. configuration is needed) or to enforce a coding style, the dependency on external preprocessor state means the header isn't self contained. (And the non-self-containedness is the reason we can't include it in arbitrary contexts) 
That sounds good. Thanks for explaining!


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D60815





More information about the cfe-commits mailing list