[cfe-dev] [Modules TS] feedback

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Mon May 15 14:21:09 PDT 2017


On 13 May 2017 at 03:40, Boris Kolpackov <boris at codesynthesis.com> wrote:

> Hi Richard,
>
> Richard Smith <richard at metafoo.co.uk> writes:
>
> > The intent is that the same set of flags would typically be passed to a
> > compilation building the module interface for a particular module as
> would
> > be passed to a compilation building the module interface.
>
> Should the second "module interface" be "module user (importer)"?


No, it should be "module implementation", sorry. That is, you can have
somewhat different flags between module interface and module user, but the
entire module (both interface and implementation) would typically be
expected to be built with a similar set of flags, determined principally by
the module author. That's not required, though, and if a build system wants
to set things up differently, it can.

> That way, the user can decide on a per-module basis how they want the
> > compiler to act (including things like which warnings they want enabled
> > for their module, and perhaps some details of the language it's written
> in).
>
> Interesting. So this implies that the module binary interface (.pcm) is
> a user-side (or per-user) thing, not module-side?
>
> In other words, if I have library libx that implements modx and I have
> two programs, exe1 and exe2, that use/link this module/library, then,
> I may need to generate two modx.pcm versions, one for each exe if they
> are built with different-enough flags (actually, three: +1 for libx's
> module implementation units).
>

If the above are all part of the same build system, building a project with
largely the same configuration throughout, I would expect the same libx.pcm
would be used in all three cases. But yes, if the flags are different
enough (perhaps one compilation is C++1z, another is Objective-C++11, and a
third one is targeting a different architecture), then the .pcm file can't
be reused, so you would need to rebuild it for each sufficiently-different
user. (Although in those cases, you'd often want different object files for
the module implementation, too.)

This makes sense if you start thinking about inline functions, warnings,
> etc. But definitely not how I (and I bet a lot of other people) think
> about it.
>
> I also wonder how this model applies to the standard library? Will each
> project that consumes it as a module have to compile its module interface?


Typically yes (but only once).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170515/acdc348f/attachment.html>


More information about the cfe-dev mailing list