<div dir="ltr"><div dir="ltr">On Mon, Oct 25, 2021 at 7:04 PM chuanqi.xcq <<a href="mailto:yedeng.yd@linux.alibaba.com">yedeng.yd@linux.alibaba.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><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Hi Blaikie,</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">>> 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.</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">---</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Understood. My point is that we could make clang support for C++20 more friendly by adding extra default behavior.</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">And your point is that it may not be true in distributed build system.</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">>> <span style="color:rgb(0,0,0);font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">The specifics of how GCC, Clang, (& maybe other compilers) and various build systems may end up interacting on</span></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><span style="color:rgb(0,0,0);font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">>> the command line and filesystem (module discovery outside the current build for system-installed library depe<span style="color:rgb(0,0,0);font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">ndencies) </span></span></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><span style="color:rgb(0,0,0);font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">>> </span></span>is still being discussed and debated in places like C++'s SG15 tooling working group.</div><div style="clear:both">---</div><div style="clear:both">I have a basic question about the Clang/LLVM policy. I remember that one of the policy of Clang/LLVM's command line system </div><div style="clear:both">is to be compatible <span style="font-size:14px">with GCC. This is basically true so that we could transfer the compiler used in various projects. </span></div><div style="clear:both"><span style="font-size:14px">Is this policy not true now?</span></div></div></blockquote><div><br>I wouldn't state a general policy - though compatibility's certainly been a motivating use case when Clang started out, and to some extent still is today - but it's not always a case of "if GCC did it, Clang must accept patches that match the functionality" - especially new functionality that's in flux, I think there's some room for some nuance.<br><br>- Dave<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><div style="clear:both"><span style="font-size:14px"><br></span></div><div style="clear:both"><span style="font-size:14px">Thanks,</span></div><div style="clear:both"><span style="font-size:14px"><br></span></div><div style="clear:both"><span style="font-size:14px">Chuanqi</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><blockquote style="margin-right:0px;margin-top:0px;margin-bottom:0px"><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">------------------------------------------------------------------</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">From:David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Send Time:2021年10月26日(星期二) 00:36</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">To:chuanqi.xcq <<a href="mailto:yedeng.yd@linux.alibaba.com" target="_blank">yedeng.yd@linux.alibaba.com</a>>; Nathan Sidwell <<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>></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Cc:cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Subject:Re: [cfe-dev] Make command line support for C++20 module uniform with GCC</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div><div>+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 <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">Hi all,</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">   Recently I am playing with C++20 modules and I found that the command line support of GCC</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">is much better than Clang. Here is an example:</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">```C++</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">// 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>}</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">// main.cpp<br>#include <string_view><br>import Hello;<br>int main() {<br>  SayHello("world");<br>  return 0;<br>}</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)">```</span></div><div style="clear:both"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;color:rgb(0,0,0)"><br></span></div><div style="clear:both">To compile the example, in gcc we need:</div><div style="clear:both">```</div><div style="clear:both">g++ -std=c++20 -fmodules-ts <span style="color:rgb(0,0,0);font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">say_hello.cpp </span>main.cpp <br></div><div style="clear:both">```</div><div style="clear:both"><br></div><div style="clear:both">And in clang, we need:</div><div style="clear:both">```</div><div style="clear:both"><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Helvetica;color:rgb(18,20,22)">clang++ -std=c++20 -fmodules-ts -Xclang -emit-module-interface -c say_hello.cpp -o Hello.pcm</p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Helvetica;color:rgb(18,20,22)">clang++ -std=c++20 -fmodules-ts -fprebuilt-module-path=. main.cpp say_hello.cpp</p></div><div style="clear:both">```</div><div style="clear:both"><br></div><div style="clear:both">Yeah, in clang we need to another line to emit module interface explicitly and another option</div><div style="clear:both">to tell the prebuilt-module-path. And in GCC, this happens by default, when GCC find it is compiling</div><div style="clear:both">a c++20 module, it would generate the module interface automatically to the path:</div><div style="clear:both">```</div><div style="clear:both"><div style="color:rgb(0,0,0);font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;text-decoration:none">gcm.cache/filename.gcm</div></div><div style="clear:both">```</div><div style="clear:both">It would create `gcm.cache` in case it doesn't exist. </div><div style="clear:both"><br></div><div style="clear:both">And GCC would search prebuilt module interface in `gcm.cache` automatically.</div><div style="clear:both"><br></div><div style="clear:both">It looks much more friendly to me. The intention of this mail is to ask if you think it is the right direction</div><div style="clear:both">to make the clang's command line support for c++20 module more like GCC. The different I see now includes:</div><div style="clear:both">- Generate prebuilt module interface automatically. (And generate it to a specific directory automatically)</div><div style="clear:both">- Have a default value for <span style="color:rgb(18,20,22);font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">prebuilt module path.</span></div></div><div><br>This sort of interaction is probably not going to be how modules are generally built/supported as far as I understand it - it's opaque to the build system, so may make it more difficult for the build system to know when things need to be rebuilt, and also wouldn't support any kind of distributed build system.<br><br>The specifics of how GCC, Clang, (& maybe other compilers) and various build systems may end up interacting on the command line and filesystem (module discovery outside the current build for system-installed library dependencies) is still being discussed and 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, but I'm not sure we will/should be supporting cross-compiler interface compatibility until we are a bit more sure about what the best thing to standardize no is.<br> </div><div><div style="clear:both"><span style="color:rgb(18,20,22);font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">I am wondering if any one more familiar with the clang's command line and file system would love to </span></div><div style="clear:both"><span style="color:rgb(18,20,22);font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">support this (I am not so familiar with it). Although It may take more time, I would love to support if others are busy.</span></div><div style="clear:both"><span style="color:rgb(18,20,22);font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline"><br></span></div><div style="clear:both"><span style="color:rgb(18,20,22);font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">Thanks,</span></div><div style="clear:both"><span style="color:rgb(18,20,22);font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:0px;text-transform:none;background-color:rgb(255,255,255);text-decoration:none;float:none;display:inline">Chuanqi</span></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" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br></div></div></blockquote><div><br></div></div></blockquote></div></div>