[PATCH] D125773: [Driver] Do not auto-enable header modules with -std=c++20

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 08:16:36 PDT 2022


ilya-biryukov planned changes to this revision.
ilya-biryukov marked 2 inline comments as done.
ilya-biryukov added a comment.

Richard, thanks for course correcting. I was under impression that header modules are not in the standard, my mistake.

It looks like this particular change actually breaks standard compatibility as we also use the same parsing action and don't build a module separately on `import`.

  [module.import]p5
  A module-import-declaration that specifies a header-name H imports a synthesized header unit, which is a
  translation unit formed by applying phases 1 to 7 of translation (5.2) to the source file or header nominated
  by H, which shall not contain a module-declaration.

We are definitely allowed to use the same parsing action for `#include` .

  [cpp.include]p7
  If the header identified by the header-name denotes an importable header (10.3), it is implementation-defined
  whether the #include preprocessing directive is instead replaced by an import directive (15.5) of the
  form

So the proposal is that `-fheader-modules=parse` would parse `#include` of header unit in the same TU, and import `.pcm` on `import`, right?

To take a step back, the original problem was to allow running layering checks without requiring `.pcm` files even in `-std=c++20`.
Are there alternatives I might be missing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125773



More information about the cfe-commits mailing list