[cfe-dev] [Modules TS] feedback

Boris Kolpackov via cfe-dev cfe-dev at lists.llvm.org
Wed May 10 05:01:38 PDT 2017


Hi,

I am working on C++ modules support in the build2 build system[1]. As
part of that I have tested latest Clang (r302560 from apt.llvm.org to
be more precise) with a barely-realistic example (module interface
unit, module implementation unit, and an importing test; compilation
command lines are in 'cmd'):

http://codesynthesis.com/~boris/tmp/libhello-clang.tar.gz

Here are some notes/issues:

1. When compiling the module implementation unit, -fprebuilt-module-path
   does not work. Instead one has to use -fmodule-file.

   The failure mode is also interesting: there is no diagnostics about
   the module not being found but rather about undeclared module entities.

2. I believe you are aware of this: if a non-inline function is defined
   in a module interface unit, things end up badly (duplicate symbols).

   If the plan is to also generate an object file as part of module
   interface compilation (the way both VC and GCC currently do it),
   then consider supporting separate compilation mode for these two.
   The reason is this: the .pcm file has to be generated before any
   (a) module importing or (b) module implementation units can be
   compiled. So waiting for the .o file to be produced will hinder
   parallelism.

3. When compiling a test that imports a module using -fprebuilt-module-path
   a bogus warning is issued:

   clang: warning: argument unused during compilation: '-fprebuilt-module-path=.' [-Wunused-command-line-argument]

[1] https://build2.org

Thanks,
Boris



More information about the cfe-dev mailing list