[cfe-dev] Modules TS Work

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 8 08:55:19 PDT 2018

On Sun, Oct 7, 2018 at 10:23 PM Matt Asplund <mwasplund at gmail.com> wrote:

> I also feel that the precompiled header file format as it is today is not
> the best fit for the module-ts interface definition.

What particular problems/mismatches do you see/find in this?

> Would it not be more straightforward to have the compilation of an
> interface module generate a simplified form of this file that only contains
> the types and declarations that were exported

By simplified form you mean a valid C++ file, but stripped of all the
non-exported features?

That wouldn't achieve the performance goals/desires of Clang's modules
(either Clang Modules, or ModulesTS modules) support - compiler
performance. The idea is to avoid having to re-parse the source for every
use. The bitcode/pcm/pch format is intended to be efficient to query/lazy
load (it contains name lookup tables, structures that can be mapped in from
disk and read only when needed, etc).

> along with an object file? It feels cumbersome at best to generate this
> entire file and then turn around and spit out the object file in a second
> call.

It's possible to support .pcm+.o file generation at the same time - and I
imagine Clang will support that eventually depending on what sort of build
system preferences evolve, and how things align between Clang and GCC
ModulesTS support.

But that said, there's good reason/benefits to doing this as two separate
steps - it improves build parallelism, allowing builds that use a module to
begin before code generation for that module begins (or in parallel with
it). Rather than having to wait until the object file generation is
completed before downstream modules or other source files can begin

> On a side note, would anyone be opposed to lifting the requirement that a
> interface module translation unit using the cppm extension? The spec simply
> says a translation unit will be treated as a module unit if it contains a
> module declaration and clang seems to already allow this for implementation
> modules.

Possible, sure - though personally I sort of hope this is an opportunity to
reduce the proliferation of different C++ file extensions & just
standardize on one.

- Dave

> On Sun, Oct 7, 2018 at 6:19 PM Matt Asplund <mwasplund at gmail.com> wrote:
>> I have not had a chance to pull down and build the branch of gcc that has
>> the modules-ts implementation yet. From reading the spec I did not think
>> that macro definitions within a single translation unit would be affected
>> by it being a module unit at all, much less a previously defined macro in
>> the module interface unit. I was testing some with MSVC (until I hit a not
>> implemented error) and they seem to allow this scenario.
>> -Matt
>> On Sun, Oct 7, 2018 at 5:55 PM David Blaikie <dblaikie at gmail.com> wrote:
>>> On Sat, Oct 6, 2018 at 5:46 PM Matt Asplund via cfe-dev <
>>> cfe-dev at lists.llvm.org> wrote:
>>>> I have been finding a few bugs in the modules-ts implementation and
>>>> wanted to know if this is still being actively work on
>>> Certainly being actively worked on - mostly/entirely by Richard Smith
>>> (cc'd) & I think he's prioritizing some of the nastier edge cases as they
>>> come up in the standardization process, so "practical" bugs (once where the
>>> desired behavior is clear enough & it isn't likely to significantly impact
>>> the design/implementation in a significant way) might be a bit lower
>>> priority.
>>>> or if I should be sending out my own patches.
>>> Generally welcome, I should think! :)
>>>> I am also finding it hard to track what work is being done with clang
>>>> modules and what work pertains to ModulesTS (Most notably there is only one
>>>> bucket for bug reporting under modules).
>>> Fair - though they're pretty related - not sure it's worth having a
>>> separate bucket. But not a big deal either way.
>>>> The issue I am stuck on right now is this:
>>>> *Bug 39206* <https://bugs.llvm.org/show_bug.cgi?id=39206> - [Modules
>>>> TS] Macro defined in module interface cannot be set in implementation
>>> Thanks for filing! :) (what does GCC do, I wonder? Not sure if the
>>> support over there is near enough to support things)
>>>> -Matt
>>>> On Fri, Oct 5, 2018 at 4:32 PM André Jansen Medeiros Villar via cfe-dev
>>>> <cfe-dev at lists.llvm.org> wrote:
>>>>> CC Boris Kolpackov who has the only implamentation of Modules on a
>>>>> build system that i know of.
>>>>> Em qui, 4 de out de 2018 às 15:04, David Blaikie via cfe-dev <
>>>>> cfe-dev at lists.llvm.org> escreveu:
>>>>>> On Sun, Sep 30, 2018 at 2:32 AM Whisperity via cfe-dev <
>>>>>> cfe-dev at lists.llvm.org> wrote:
>>>>>>> I am just trying to improve CMake a bit to better explain directives
>>>>>>> for codes that use and depend on modules, instead of using nasty
>>>>>>> shadow targets and hacks. We also need to improve CMake so it knows
>>>>>>> dependencies: I ran into the issue that once I build the module PCM
>>>>>>> there is no check (neither from CMake's, nor Clang's side) whether
>>>>>>> the
>>>>>>> source file for that module was changed. Sometimes it keeps the PCM
>>>>>>> implementation ignoring the original one, sometimes just runs Clang
>>>>>>> into a nasty stack trace.
>>>>>> I'm super interested in CMake support for modules (both Clang's
>>>>>> back-compat modules (with modulemaps) and C++ standard modules) - I'll be
>>>>>> talking at the developer meeting about some of the issues around Modules TS
>>>>>> build system impact (following on from the talk I gave last year on modular
>>>>>> code generation) & honestly would love to have a CMake prototype/demo (for
>>>>>> clang back-compat modules and/or modules TS modules), with the intent to
>>>>>> get something usable for self-hosting one form of explicit modules or
>>>>>> another (modular code generation, etc) with the LLVM build, but not sure I
>>>>>> really have the CMake skills to pull that off in time.
>>>>>> - Dave
>>>>>>> ; Whisperity.
>>>>>>> Matt Asplund (mwasplund) via cfe-dev <cfe-dev at lists.llvm.org> ezt
>>>>>>> írta
>>>>>>> (időpont: 2018. szept. 29., Szo, 17:15):
>>>>>>> >
>>>>>>> >
>>>>>>> > Hello,
>>>>>>> >
>>>>>>> > I am curious if there is any active work being done on the Modules
>>>>>>> TS implementation. I would like to help fill in the gaps that I am finding
>>>>>>> while playing around with it and wanted to make sure I wasn’t duplicating
>>>>>>> work.
>>>>>>> >
>>>>>>> > -Matt
>>>>>>> > _______________________________________________
>>>>>>> > cfe-dev mailing list
>>>>>>> > cfe-dev at lists.llvm.org
>>>>>>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>>> _______________________________________________
>>>>>>> cfe-dev mailing list
>>>>>>> cfe-dev at lists.llvm.org
>>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>> _______________________________________________
>>>>>> cfe-dev mailing list
>>>>>> cfe-dev at lists.llvm.org
>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>> _______________________________________________
>>>>> cfe-dev mailing list
>>>>> cfe-dev at lists.llvm.org
>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>> _______________________________________________
>>>> cfe-dev mailing list
>>>> cfe-dev at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181008/24cd9e59/attachment.html>

More information about the cfe-dev mailing list