[cfe-dev] Modules TS: binary module interface dependencies
David Blaikie via cfe-dev
cfe-dev at lists.llvm.org
Tue Jun 27 07:31:22 PDT 2017
On Tue, Jun 27, 2017 at 2:53 AM Boris Kolpackov via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> I am trying to understand how Clang's Modules TS will work so that we
> have a general-enough model in the build system.
>
> Consider these two modules and a consumer:
>
> // module core
> export module core;
> export void f (int);
>
> // module extra
> export module extra;
> import core;
> export inline void g (int x) {f (x);}
>
> // consumer
> import extra;
> int main () {g ();}
>
> Currently, when compiling the consumer (with -fmodules-ts), Clang only
> requires the binary module interface (BMI) for extra. In contrast, VC
> and GCC require both extra and core (note: even though core is not
> re-exported from extra).
>
> The Clang's model is definitely more desirable from the build system's
> perspective, especially for distributed compilation. So I wonder if this
> is accidental and will change in the future or if this is something that
> Clang is committed to, so to speak?
>
I believe this functionality is intentional (after deploying pre-TS modules
at Google & finding the number of files necessary without this feature to
be problematic (maybe hitting issues with command line length? Not sure
what the particular constraint was that it was running up against))
CC'd Richard to correct/clarify/etc
>
> Here is a more interesting variant of the extra module that highlights
> some of the issues to consider:
>
> // module extra
> export module extra;
> import core;
> export template <typename T> void g (T x) {f (x);}
>
> Now f() can only be resolved (via ADL) when g() is instantiated.
>
> Thanks,
> Boris
> _______________________________________________
> 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/20170627/a8d47020/attachment.html>
More information about the cfe-dev
mailing list