[PATCH] D106394: [clang][pp] adds '#pragma include_instead'

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 28 09:07:07 PDT 2021


cjdb added a comment.

In D106394#2905660 <https://reviews.llvm.org/D106394#2905660>, @dblaikie wrote:

> Just a thought (nothing to hold up this patch/suggest a revert/suggest any immediate action), but:
>
>> The problem with extending this to non-system headers is that you need a way to tell which headers are allowed to include the detail headers and which ones are not.
>
> What if the analysis was done on the entire #include path from the current primary source file - rather than from the immediate include location? Then the requirement could be "This header must be directly or indirectly included from one of the headers listed in include_instead, otherwise there will be a warning" - could that generalize to other use cases/not only system headers?

I think this would mean that something like libc++'s `<__ranges/concepts.h>` couldn't directly include `<__iterator/concepts.h>`? Also, how does this play with `#pragma GCC system_header` detection?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106394



More information about the cfe-commits mailing list