dblaikie added a comment.

In D106394#2922972 <https://reviews.llvm.org/D106394#2922972>, @rsmith wrote:

> ... As an alternative, have you considered checking whether any of the 
> headers named in the pragma are in the include stack, and warning if not? 
> That would seem to make this warning applicable to both user headers and 
> system headers in an unsurprising way. We'd presumably need two lists of 
> headers: the external headers that we encourage people to include to get at 
> the implementation detail header, and the internal list of headers that are 
> also allowed to use it but that we shouldn't list in the diagnostic.

Yeah, @cjdb and I discussed this offline last week - a main concern with that 
direction is the maintenance burden that'd add to libc++ when using one of the 
internal implementation headers, having to update the "internal list of 
headers" every time a new include is added. Not impossible, but maybe 
impractical - especially for more common internal headers (like whatever 
provides std::move, maybe needing to be included in nearly every file.

(we speculated that maybe something akin to a modulemap could be used - found 
with a similar search path that would be able to describe once a single set of 
headers (but I guess that only works if all the headers are in a partitioned 
subdirectory - otherwise who gets to own the top-level file that has these 
lists of names - I guess maybe each file could say "I'm part of library foo" 
and then from the file search for foo.headerlist file and use that to describe 
which are the public and private headers to implement the warning) - but no 
doubt that's overkill/not likely feasible)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106394

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

Reply via email to