<div dir="ltr"><div dir="ltr">On Wed, Oct 27, 2021 at 9:00 PM David Blaikie via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Wed, Oct 27, 2021 at 6:50 AM <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div>
<p class="MsoNormal">Let me just throw out there that any interface involved `-Xclang` is not a proper user-facing interface. The -Xclang options aren’t intended for use by end users.</p></div></div></blockquote><div><br>Yeah, it's certainly still in flux/unclear how this should look long-term. I mean Google's been using these -Xclang interfaces for building explicit Clang Modules for years at this point - so probably worth giving a legitimate/official interface for that use case, even if it doesn't answer all the questions about how C++20 modules will be consumed.<br></div></div></div></blockquote><div><br></div><div>Anyone know if Google has published any open source projects that use modules yet? Or even any open source project that uses modules? I'm not aware of any yet.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal">--paulr<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.llvm.org</a>> <b>On Behalf Of
</b>chuanqi.xcq via cfe-dev<br>
<b>Sent:</b> Wednesday, October 27, 2021 2:28 AM<br>
<b>To:</b> Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>>; David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>>; Nathan Sidwell <<a href="mailto:nathanmsidwell@gmail.com" target="_blank">nathanmsidwell@gmail.com</a>><br>
<b>Cc:</b> cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Subject:</b> Re: [cfe-dev] Make command line support for C++20 module uniform with GCC<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">I got it. The key point here is that since clang's module is already used in scale. So we couldn't change it arbitrarily before we get a clear solution.</span></p></div></div></div></div></div></blockquote><div><br></div><div>I think there's probably space to experiment with more things without breaking the interfaces currently in use - but equally not immediately going for GCC compatibility for its own sake either.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt"><div><div><p class="MsoNormal"><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">Thanks,</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">Chuanqi</span><u></u><u></u></p>
</div>
<blockquote style="margin-right:0in">
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">------------------------------------------------------------------</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">From:Nathan Sidwell <<a href="mailto:nathan@acm.org" target="_blank">nathan@acm.org</a>></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">Send Time:2021</span><span style="font-size:10.5pt;font-family:"MS Gothic";color:black">年</span><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">10</span><span style="font-size:10.5pt;font-family:"MS Gothic";color:black">月</span><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">26</span><span style="font-size:10.5pt;font-family:"MS Gothic";color:black">日</span><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">(</span><span style="font-size:10.5pt;font-family:"MS Gothic";color:black">星期二</span><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">)
18:48</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">To:chuanqi.xcq <<a href="mailto:yedeng.yd@linux.alibaba.com" target="_blank">yedeng.yd@linux.alibaba.com</a>>; Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>>; David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">Cc:cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Tahoma,sans-serif;color:black">Subject:Re: [cfe-dev] Make command line support for C++20 module uniform with GCC</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">On 10/25/21 22:04, chuanqi.xcq via cfe-dev wrote:<br>
> Hi Blaikie,<br>
> <br>
>>> This sort of interaction is probably not going to be how modules are generally built/supported<br>
>>> as far as I understand it - it's opaque to the build system, so may make it more difficult for the<br>
>>> build system to know when things need to be rebuilt, and also wouldn't support any kind of distributed<br>
>>> build system.<br>
>>> <br>
>>> The specifics of how GCC, Clang, (& maybe other compilers) and various build systems may end up interacting<br>
>>> on the command line and filesystem (module discovery outside the current build for system-installed library<br>
>>> dependencies) is still being discussed and debated in places like C++'s SG15 tooling working group.<br>
> ---<br>
> Understood. My point is that we could make clang support for C++20 more <br>
> friendly by adding extra default behavior.<br>
> And your point is that it may not be true in distributed build system.<br>
> <br>
>>> The specifics of how GCC, Clang, (& maybe other compilers) and various <br>
> build systems may end up interacting on<br>
>>> the command line and filesystem (module discovery outside the current build for system-installed library dependencies)<br>
>>> is still being discussed and debated in places like C++'s SG15 tooling <br>
> working group.<br>
> ---<br>
> I have a basic question about the Clang/LLVM policy. I remember that one <br>
> of the policy of Clang/LLVM's command line system<br>
> is to be compatible with GCC. This is basically true so that we could <br>
> transfer the compiler used in various projects.<br>
> Is this policy not true now?<br>
<br>
GCC had the advantage of seeing clang's experiments. The history is <br>
different for the two compilers here -- clang developed 'implicit <br>
modules', driven by a large build system. with GCC I was very mindful <br>
that 'hello world' should be simple to drive -- as you have found. <br>
Clang has the tricky job of not breaking its existing interface.<br>
<br>
As David says, what the best way to drive module compilations is no yet <br>
clear.<br>
<br>
nathan<br>
<br>
> <br>
> Thanks,<br>
> <br>
> Chuanqi<br>
> <br>
> <br>
> <br>
> ------------------------------------------------------------------<br>
> From:David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>><br>
> Send Time:2021<span style="font-family:"MS Gothic"">年</span>10<span style="font-family:"MS Gothic"">月</span>26<span style="font-family:"MS Gothic"">日</span>(<span style="font-family:"MS Gothic"">星期二</span>) 00:36<br>
> To:chuanqi.xcq <<a href="mailto:yedeng.yd@linux.alibaba.com" target="_blank">yedeng.yd@linux.alibaba.com</a>>; Nathan Sidwell<br>
> <<a href="mailto:nathan@acm.org" target="_blank">nathan@acm.org</a>>; Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>><br>
> Cc:cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
> Subject:Re: [cfe-dev] Make command line support for C++20 module<br>
> uniform with GCC<br>
> <br>
> +Nathan and Richard as folks with some context here.<br>
> <br>
> On Mon, Oct 25, 2021 at 1:57 AM chuanqi.xcq via cfe-dev<br>
> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>>> wrote:<br>
> Hi all,<br>
> <br>
> Recently I am playing with C++20 modules and I found that the<br>
> command line support of GCC<br>
> is much better than Clang. Here is an example:<br>
> <br>
> ```C++<br>
> // say_hello.cpp<br>
> module;<br>
> #include <iostream><br>
> #include <string_view><br>
> export module Hello;<br>
> export void SayHello<br>
> (std::string_view const &name)<br>
> {<br>
> std::cout << "Hello " << name << "!\n";<br>
> }<br>
> // main.cpp<br>
> #include <string_view><br>
> import Hello;<br>
> int main() {<br>
> SayHello("world");<br>
> return 0;<br>
> }<br>
> ```<br>
> <br>
> To compile the example, in gcc we need:<br>
> ```<br>
> g++ -std=c++20 -fmodules-ts say_hello.cpp main.cpp<br>
> ```<br>
> <br>
> And in clang, we need:<br>
> ```<br>
> <br>
> clang++ -std=c++20 -fmodules-ts -Xclang -emit-module-interface -c<br>
> say_hello.cpp -o Hello.pcm<br>
> <br>
> clang++ -std=c++20 -fmodules-ts -fprebuilt-module-path=. main.cpp<br>
> say_hello.cpp<br>
> <br>
> ```<br>
> <br>
> Yeah, in clang we need to another line to emit module interface<br>
> explicitly and another option<br>
> to tell the prebuilt-module-path. And in GCC, this happens by<br>
> default, when GCC find it is compiling<br>
> a c++20 module, it would generate the module interface automatically<br>
> to the path:<br>
> ```<br>
> gcm.cache/filename.gcm<br>
> ```<br>
> It would create `gcm.cache` in case it doesn't exist.<br>
> <br>
> And GCC would search prebuilt module interface in `gcm.cache`<br>
> automatically.<br>
> <br>
> It looks much more friendly to me. The intention of this mail is to<br>
> ask if you think it is the right direction<br>
> to make the clang's command line support for c++20 module more like<br>
> GCC. The different I see now includes:<br>
> - Generate prebuilt module interface automatically. (And generate it<br>
> to a specific directory automatically)<br>
> - Have a default value for prebuilt module path.<br>
> <br>
> This sort of interaction is probably not going to be how modules are<br>
> generally built/supported as far as I understand it - it's opaque to<br>
> the build system, so may make it more difficult for the build system<br>
> to know when things need to be rebuilt, and also wouldn't support<br>
> any kind of distributed build system.<br>
> <br>
> The specifics of how GCC, Clang, (& maybe other compilers) and<br>
> various build systems may end up interacting on the command line and<br>
> filesystem (module discovery outside the current build for<br>
> system-installed library dependencies) is still being discussed and<br>
> debated in places like C++'s SG15 tooling working group.<br>
> <br>
> That doesn't mean we can't experiment further with things like this,<br>
> but I'm not sure we will/should be supporting cross-compiler<br>
> interface compatibility until we are a bit more sure about what the<br>
> best thing to standardize no is.<br>
> I am wondering if any one more familiar with the clang's command<br>
> line and file system would love to<br>
> support this (I am not so familiar with it). Although It may take<br>
> more time, I would love to support if others are busy.<br>
> <br>
> Thanks,<br>
> Chuanqi<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a> <mailto:<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
> <a href="https://urldefense.com/v3/__https:/lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev__;!!JmoZiZGBv3RvKRSx!uljSy7xXR8IA-mBJrdxW-dpf-pOxmqiFrjUb1s50CZEGX-U311wC0tWXT2-YetWnMQ$" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
> <<a href="https://urldefense.com/v3/__https:/lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev*3E__;JQ!!JmoZiZGBv3RvKRSx!uljSy7xXR8IA-mBJrdxW-dpf-pOxmqiFrjUb1s50CZEGX-U311wC0tWXT283UKuIOw$" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev></a><br>
> <br>
> <br>
> <br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
> <a href="https://urldefense.com/v3/__https:/lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev__;!!JmoZiZGBv3RvKRSx!uljSy7xXR8IA-mBJrdxW-dpf-pOxmqiFrjUb1s50CZEGX-U311wC0tWXT2-YetWnMQ$" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
> <br>
<br>
<br>
-- <br>
Nathan Sidwell<u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>