[PATCH] D121098: [C++20][Modules][HU 4/5] Handle pre-processed header units.

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 14:14:34 PDT 2022


iains added a comment.

In D121098#3378375 <https://reviews.llvm.org/D121098#3378375>, @ChuanqiXu wrote:

> It lacks tests. This is not NFC, right?

Right, (there are tests with the next patch which introduces the mechanism for producing the pre-processed output) 
but, I will find a suitable one for this...

> ---
>
> I am a little bit confused for the intuition. Couldn't we just import the pre-processed header? What's the problem? Could you elaborate on this?

We cannot import a pre-processed file; the preprocessed file is still source code, not a CMI.

In addition, the pre-processor output for a header unit requires further pre-processing on read.
This is because a header unit actually preserves some of the pre-processor information [macro definitions] (which would normally be discarded after phase 4).

Header units are identifiable by a name (in common with GCC, we make the name == the path by which the header is specified) -- that name is intentionally not a  legal named module name (neither is it, in general, a legal identifier).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121098



More information about the cfe-commits mailing list