[cfe-dev] Modules TS: binary module interface dependencies

Boris Kolpackov via cfe-dev cfe-dev at lists.llvm.org
Fri Jun 30 23:10:48 PDT 2017


Richard Smith <richard at metafoo.co.uk> writes:

> > -fmodule-blah=<name>=<file> | -fmodule-blah-blah=<file>
> >
> > Here is what I came up with:
> >
> > (1) -fmodule=      | -fmodule-map=
> > (2) -fmodule-map=  | -fmodule-map-file=
> > (3) -fmodule-loc=  | -fmodule-loc-file=
> > (4) -fmodmap=      | -fmodmap-file=
> >
> > 1. While nice and short, the use of -fmodule might be too close to
> >    -fmodules. On the other hand, these options will normally be used
> >    by build systems (the user will just use -fmodule-file) so probably
> >    not a major issue.
> >
> > 2. These are nice except -fmodule-map-file is already used. One way
> >    to resolve this would be to "overload" -fmodule-map-file to mean
> >    something different in the -fmodules-ts mode. Though I suspect its
> >    current meaning could be useful even in -fmodules-ts.
> >
> > 3. This is an attempt at using something other than 'map'. It has a
> >    nice property of suggesting that specifying these options doesn't
> >    actually cause the modules to be loaded.
> >
> > 4. Another play on the 'map' theme. I think it will be hard to sell
> >    to the GCC folks since they don't have the -fmodule-map-file issue.
> >
>
> -fmodule= is a little too nonspecific for my tastes; I'd expect this to do
> what clang's -fmodule-name= does (that is, specify the name of the current
> module) before I'd expect it to specify an external module file's path.

On the other hand, -fmodule=<name>=<file> describes the module completely
(name and .pcm) while -fmodule-name and -fmodule-file are sub-components
(thought in slightly different contexts). But I agree, -fmodule is probably
too terse.


> How about something like -fmodule-file-<name>=path?

Is this really -fmodule-file-<name> (as in -fmodule-file-foo.core=core.pcm)
or was it supposed to be '=' (as in -fmodule-file=[<name>=]<file>)?

I think the former is too unconventional and will be hard to support
in most option parsers (I know for sure GCC will be a pain).

I like the latter, that is, "extend" -fmodule-file with optional module
name. The semantics, as I understand it, will be a bit different though:
-fmodule-file=<file> will cause the module to be loaded while
-fmodule-file=<name>=<file> only makes the location of the module known.
But I don't think the difference will be observable by the end user (i.e.,
loading a module that is not imported does not change anything)?

If we go with -fmodule-file=[<name>=]<file> then the second options will
naturally be -fmodule-file-map=<file>. I like it.

Boris



More information about the cfe-dev mailing list