[Tooling] [Ext] Modules and tooling: Resolving module import declarations
Nathan Sidwell
nathan at acm.org
Sun Sep 2 16:01:31 CEST 2018
On 09/02/2018 12:07 AM, Tom Honermann wrote:
> Gcc
> $ gcc -Ifoo/include t.cpp -lfoo -o t
> $ gcc -fmodules-ts -c Ifoo/include foo.cpp # generates foo.nms (and
> unused foo.o)
[missed '-' on the I option there, but that's obvious]
foo.o is not unused in general, it contains things like the definitions
of exported or module-linkage non-inline functions & variables.
Remember, a module interface can contain implementation:
export module foo;
export int frob (int i) { return i; }
// my current favourite:
export auto widget () { return []{}{}; } // look, not inline!
Richard & I have discussed the possibility of placing things that
currently have to be comdat there. For instance,
*) vtables etc of class definitions lacking a key function
*) out-of-line bodies of inline functions
*) debug data
IIUC clang treats the module BMI as an additional stage of compilation:
x.cpp->x.pcm->x.o
which must be compiled down to an object for correctness.
nathan
--
Nathan Sidwell
More information about the Tooling
mailing list