Modules TS: How to get clang++ to automatically parse and precompile the necessary module files

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