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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 3 11:55:02 PDT 2021


rsmith added a comment.

In D106394#2923007 <https://reviews.llvm.org/D106394#2923007>, @cjdb wrote:

> 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.
>
> Wouldn't this suggestion mean that the following would be allowed?
>
>   #include <utility>
>   #include <__utility/move.h>
>
> If not, then I'm probably misunderstanding your alternative design.

No: when we process the second `#include`, `<utility>` is not on the `#include` stack. (It's not the includer of the current file, nor the includer of that file, ...).


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