[PATCH] D121589: [C++20][Modules][Driver][HU 2/N] Add fmodule-header, fmodule-header=

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 02:44:08 PDT 2022


iains added a comment.

In D121589#3381989 <https://reviews.llvm.org/D121589#3381989>, @ChuanqiXu wrote:

> In D121589#3381894 <https://reviews.llvm.org/D121589#3381894>, @iains wrote:
>
>> In D121589#3381343 <https://reviews.llvm.org/D121589#3381343>, @ChuanqiXu wrote:
>>
>>>> It's not practical to recognise a header without any suffix so
>>>
>>> -fmodule-header=system foo isn't going to happen.
>>>
>>> May I ask the reason? It looks not so good with `-fmodule-header=system -xc++-header vector`
>>
>> OK. One should never say "never" ;) , it would be nicer if we could avoid this.
>>
>> ... it would require a policy change in the driver - since we cannot recognise files like 'vector' as headers, they are currently unclaimed (which means that they default to being considered as linker inputs).
>>
>> This is a long-standing (forever, I suspect) situation;
>> Although we could make it so that if we see certain options, all unknown inputs get claimed as source files (or headers) I wonder how much build system code that might break.
>
> If this is the policy, I am OK. For the build systems, due to the dependences, all build systems want to support C++20 modules should do works. So if we are doing our best, I think it might not be bad.

So I had a chance to discuss this briefly with some of the other modules folks, and the consensus there was that changing the behaviour of the driver w.r.t linker inputs would likely cause build system problems, as I suggested above.
One possibility might be to find some shorter way  (than -xc++-header) for the user to say that a file was a header (but IMO that is something for the future and there are interactions with shells to consider etc. - here we are trying to implement the functionality correctly and optimisation can follow later).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121589



More information about the cfe-commits mailing list