<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 2 June 2017 at 00:36, Boris Kolpackov via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi David,<br>
<span class=""><br>
David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> writes:<br>
<br>
> So could you outline (show a small/complete example with source, commands,<br>
> etc) what you're trying to do?<br>
<br>
</span>In build2 (build system I am working on) we have the ability to specify<br>
that a source file is preprocessed to a certain degree. This is used to<br>
speed things up. While currently having translation units that no longer<br>
require preprocessing is not very common, with modules (and modularized<br>
standard library) this situation will become a lot more plausible. So we<br>
want to be ready.<br>
<br>
If the user says that certain TUs are fully preprocessed, then build2<br>
passes this information on to the compiler via the -x option. So for C<br>
we say the source is '-x cpp-output' and for C++ -- '-x c++-cpp-output'.<br>
<br>
Now in Clang module interface units have to be compiled as '-x c++-module',<br>
not '-x c++'. So we also need '-x c++-module-cpp-output'.<br></blockquote><div><br></div><div>What difference are you expecting the -cpp-output to make to the compilation? For Clang, it does almost exactly nothing, except that we'll consider the name from the GNU linemarker directive on the first line of the file (if any) to be its "real" name.</div><div><br></div><div>We currently do not support a user-specified -cpp-output file type for any of the formats which we support precompiling (*-header, *-module). We certainly could if there's a good reason.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
BTW, it is not clear why c++-module is needed (and it is needed -- I tried<br>
to compile as just c++ and things didn't go well). Perhaps now that Clang<br>
use the 'export module M;' syntax c++-module is no longer necessary?</blockquote><div><br></div><div>It's necessary because (a) it instructs clang to build a different tool pipeline, with a precompile stage rather than a stage that generates an object file, and (b) under the Modules TS, the "module X;" directive has different semantics in a module interface unit versus in a module implementation unit -- in the latter case, it acts as a souped up form of module import in addition to entering the semantic context of the module.</div><div><br></div><div>It's possible that (b) will change prior to the publication of the TS, but we'd still need to know whether we're entering a module interface unit for (a).</div></div></div></div>