[cfe-users] Modules TS: How to get clang++ to automatically parse and precompile the necessary module files

Manuel Bergler via cfe-users cfe-users at lists.llvm.org
Wed Oct 5 07:51:38 PDT 2016


Hi everyone,

following Richard Smith's talk at CppCon this year where he mentioned that
Clangs Module TS implementation,
while still work in progress, can already be used to build stuff, I decided
to try it out.

So I compiled Clang 4.0 from svn, create a module interface file
'myclass.cppm' and a 'main.cpp' to test it.

I've gotten it to build successfully by executing

> clang++ -std=c++1z -fmodules-ts --precompile -o myclass.pcm myclass.cppm
> clang++ -std=c++1z -fmodules-ts -fmodule-file=myclass.pcm -o modules_test main.cpp
>
>
So far so good. But on the Modules FAQ page [1] it says:

> The binary representation of modules is automatically generated by the
> compiler on an as-needed basis.
>

Is this only implemented for Clang's "C++98 style modules" yet or am I
missing a flag I need to pass to clang++
in order for it to precompile my module automatically? Currently neither of

> clang++ -std=c++1z -fmodules-ts main.cpp
>
clang++ -std=c++1z -fmodules-ts myclass.cppm main.cpp
>
work.

Best,
Manuel

[1] http://clang.llvm.org/docs/Modules.html#compilation-model
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20161005/df70ecb1/attachment.html>


More information about the cfe-users mailing list