<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">This is a proposal to allow searching for "implicit modules" in the prebuilt module cache paths.</div><div class=""><br class=""></div><div class=""><a href="https://reviews.llvm.org/D68997" class="">https://reviews.llvm.org/D68997</a></div><div class=""><br class=""></div><div class=""><p style="margin: 0px 0px 12px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">The current command-line options for prebuilt modules do not allow to easily<br style="margin-top: 0px;" class="">maintain and use multiple versions of modules. Both the producer and users of<br class="">prebuilt modules are required to know the relationships between compilation<br class="">options and module file paths. Using a particular version of a prebuilt module<br class="">requires passing a particular option on the command line (e.g.<br class=""><tt class="remarkup-monospaced" style="background-color: rgba(71, 87, 120, 0.0980392); padding: 1px 4px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap;">-fmodule-file=[<name>=]<file></tt> or <tt class="remarkup-monospaced" style="background-color: rgba(71, 87, 120, 0.0980392); padding: 1px 4px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap;">-fprebuilt-module-path=<directory></tt>).</p><p style="margin: 0px 0px 12px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">However the compiler already knows how to distinguish and automatically locate<br style="margin-top: 0px;" class="">implicit modules. Hence this proposal to introduce the<br class=""><tt class="remarkup-monospaced" style="background-color: rgba(71, 87, 120, 0.0980392); padding: 1px 4px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap;">-fprebuilt-implicit-modules</tt> option. When set, it enables searching for<br class="">implicit modules in the prebuilt module paths (specified via<br class=""><tt class="remarkup-monospaced" style="background-color: rgba(71, 87, 120, 0.0980392); padding: 1px 4px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap;">-fprebuilt-module-path</tt>). To not modify existing behavior, this search takes<br class="">place after the standard search for prebuilt modules. If not</p><p style="margin: 0px 0px 12px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">Here is a workflow illustrating how both the producer and consumer of prebuilt<br style="margin-top: 0px;" class="">modules would need to know what versions of prebuilt modules are available and<br class="">where they are located.</p><div class="remarkup-code-block" data-code-lang="text" data-sigil="remarkup-code-block" style="margin: 12px 0px; padding: 0px; border: 0px; white-space: pre; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;"><pre class="remarkup-code" style="margin-top: 0px; margin-bottom: 0px; padding: 12px; border: 0px; background-color: rgba(71, 87, 120, 0.0784314); overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap; font-stretch: normal; font-size: 11px; line-height: 15px; font-family: Menlo, Consolas, Monaco, monospace;">clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules_v1 <config 1 options>
clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules_v2 <config 2 options>
clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules_v3 <config 3 options>
clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap -fprebuilt-module-path=prebuilt_modules_v1 <config 1 options>
clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap <non-prebuilt config options></pre></div><p style="margin: 0px 0px 12px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">With prebuilt implicit modules, the producer can generate prebuilt modules as<br style="margin-top: 0px;" class="">usual, all in the same output directory. The same mechanisms as for implicit<br class="">modules take care of incorporating hashes in the path to distinguish between<br class="">module versions.</p><p style="margin: 0px 0px 12px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">Note that we do not specify the output module filename, so <tt class="remarkup-monospaced" style="background-color: rgba(71, 87, 120, 0.0980392); padding: 1px 4px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap; margin-top: 0px;">-o</tt> implicit modules are generated in the cache path <tt class="remarkup-monospaced" style="background-color: rgba(71, 87, 120, 0.0980392); padding: 1px 4px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap;">prebuilt_modules</tt>.</p><div class="remarkup-code-block" data-code-lang="text" data-sigil="remarkup-code-block" style="margin: 12px 0px; padding: 0px; border: 0px; white-space: pre; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;"><pre class="remarkup-code" style="margin-top: 0px; margin-bottom: 0px; padding: 12px; border: 0px; background-color: rgba(71, 87, 120, 0.0784314); overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap; font-stretch: normal; font-size: 11px; line-height: 15px; font-family: Menlo, Consolas, Monaco, monospace;">clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules <config 1 options>
clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules <config 2 options>
clang -cc1 -x c modulemap -fmodules -emit-module -fmodule-name=foo -fmodules-cache-path=prebuilt_modules <config 3 options></pre></div><p style="margin: 0px 0px 12px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">The user can now simply enable prebuilt implicit modules and point to the<br style="margin-top: 0px;" class="">prebuilt modules cache. No need to "parse" command-line options to decide<br class="">what prebuilt modules (paths) to use.</p><div class="remarkup-code-block" data-code-lang="text" data-sigil="remarkup-code-block" style="margin: 12px 0px; padding: 0px; border: 0px; white-space: pre; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;"><pre class="remarkup-code" style="margin-top: 0px; margin-bottom: 0px; padding: 12px; border: 0px; background-color: rgba(71, 87, 120, 0.0784314); overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; white-space: pre-wrap; font-stretch: normal; font-size: 11px; line-height: 15px; font-family: Menlo, Consolas, Monaco, monospace;">clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap -fprebuilt-module-path=prebuilt_modules -fprebuilt-implicit-modules <config 1 options>
clang -cc1 -x c use.c -fmodules fmodule-map-file=modulemap -fprebuilt-module-path=prebuilt_modules -fprebuilt-implicit-modules <non-prebuilt config options></pre></div><div style="margin: 0px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">This is for example particularly useful in a use-case where compilation is<br style="margin-top: 0px;" class="">expensive, and the configurations expected to be used are predictable, but not<br class="">controlled by the producer of prebuilt modules. Modules for the set of<br class="">predictable configurations can be prebuilt, and using them does not require<br class="">"parsing" the configuration (command-line options).</div></div><div style="margin: 0px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class=""><br class=""></div><div style="margin: 0px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">Regards,</div><div style="margin: 0px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class=""><br class=""></div><div style="margin: 0px; padding: 0px; border: 0px; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: "Segoe UI", "Segoe UI Emoji", "Segoe UI Symbol", Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px;" class="">Alexandre</div></body></html>