<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 22, 2015 at 4:55 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">What exactly does -emit-module do here? Is it basically like a PCH build step, but where the passed-in module map drives what clang does?</div></blockquote><div><br></div><div>More-or-less, yes. -emit-module is what we run internally when we implicitly build a module. The input file is the module map, -fmodule-name= specifies which module to build, and the output goes to the module cache if no -o option is explicitly specified.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span class=""><font color="#888888"><div>-- Sean Silva</div></font></span></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 22, 2015 at 3:20 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard-llvm@metafoo.co.uk" target="_blank">richard-llvm@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: rsmith<br>
Date: Mon Jun 22 17:20:47 2015<br>
New Revision: 240350<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D240350-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=RvDApNSI7OzlpcKlM-8iUnx_vSwatvE_KY5_iJ6OJso&s=L4Aeamv1wVmRwuQTvJ9ghysCZGoivjk3bHg1AYyqQ1s&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=240350&view=rev</a><br>
Log:<br>
[modules] When building a module, if there are multiple matches for a header<br>
file in the loaded module maps and one of them is from the current module,<br>
that's the right match.<br>
<br>
Added:<br>
    cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/<br>
    cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/a.h<br>
    cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/b.h<br>
    cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map<br>
    cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/x.h<br>
    cfe/trunk/test/Modules/explicit-build-prefer-self.cpp<br>
Modified:<br>
    cfe/trunk/lib/Lex/ModuleMap.cpp<br>
<br>
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_Lex_ModuleMap.cpp-3Frev-3D240350-26r1-3D240349-26r2-3D240350-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=RvDApNSI7OzlpcKlM-8iUnx_vSwatvE_KY5_iJ6OJso&s=9IuGtcl8-a4ehbjbFqIh62RRTXVAevzFQdXYPVSHLpA&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=240350&r1=240349&r2=240350&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)<br>
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Mon Jun 22 17:20:47 2015<br>
@@ -346,6 +346,9 @@ ModuleMap::KnownHeader ModuleMap::findMo<br>
     ModuleMap::KnownHeader Result;<br>
     // Iterate over all modules that 'File' is part of to find the best fit.<br>
     for (KnownHeader &H : Known->second) {<br>
+      // Prefer a header from the current module over all others.<br>
+      if (H.getModule() == CompilingModule)<br>
+        return MakeResult(H);<br>
       // Cannot use a module if it is unavailable.<br>
       if (!H.getModule()->isAvailable())<br>
         continue;<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/a.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Modules_Inputs_explicit-2Dbuild-2Dprefer-2Dself_a.h-3Frev-3D240350-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=RvDApNSI7OzlpcKlM-8iUnx_vSwatvE_KY5_iJ6OJso&s=0v6mms-WBQs1GHJPnDkKjBZ-o1897gKRvHGuVU1SzAs&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/a.h?rev=240350&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/a.h (added)<br>
+++ cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/a.h Mon Jun 22 17:20:47 2015<br>
@@ -0,0 +1,2 @@<br>
+// a<br>
+#include "x.h"<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/b.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Modules_Inputs_explicit-2Dbuild-2Dprefer-2Dself_b.h-3Frev-3D240350-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=RvDApNSI7OzlpcKlM-8iUnx_vSwatvE_KY5_iJ6OJso&s=kxWWZ1Pu1iLj4rilVqo50Vg5BfmzY_maFzwUTu0TN0o&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/b.h?rev=240350&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/b.h (added)<br>
+++ cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/b.h Mon Jun 22 17:20:47 2015<br>
@@ -0,0 +1,2 @@<br>
+// b<br>
+#include "x.h"<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Modules_Inputs_explicit-2Dbuild-2Dprefer-2Dself_map-3Frev-3D240350-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=RvDApNSI7OzlpcKlM-8iUnx_vSwatvE_KY5_iJ6OJso&s=GhxBJ_hXa9hzfyxF3HlivXOoLzqLQDxPJxn-jSBYMVA&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map?rev=240350&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map (added)<br>
+++ cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map Mon Jun 22 17:20:47 2015<br>
@@ -0,0 +1,2 @@<br>
+module a { header "a.h" header "x.h" }<br>
+module b { header "b.h" header "x.h" }<br>
<br>
Added: cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/x.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Modules_Inputs_explicit-2Dbuild-2Dprefer-2Dself_x.h-3Frev-3D240350-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=RvDApNSI7OzlpcKlM-8iUnx_vSwatvE_KY5_iJ6OJso&s=MiWr7aGtUDF5mRgjq7j7mZf1qM5jugJoxSsgRM8Dhrw&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/x.h?rev=240350&view=auto</a><br>
==============================================================================<br>
    (empty)<br>
<br>
Added: cfe/trunk/test/Modules/explicit-build-prefer-self.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_Modules_explicit-2Dbuild-2Dprefer-2Dself.cpp-3Frev-3D240350-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=RvDApNSI7OzlpcKlM-8iUnx_vSwatvE_KY5_iJ6OJso&s=wLec51zMRzuw4DHEoqmAkEc8-l8YaNQOrIgcSUwhyEU&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/explicit-build-prefer-self.cpp?rev=240350&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Modules/explicit-build-prefer-self.cpp (added)<br>
+++ cfe/trunk/test/Modules/explicit-build-prefer-self.cpp Mon Jun 22 17:20:47 2015<br>
@@ -0,0 +1,3 @@<br>
+// RUN: rm -rf %t<br>
+// RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=a %S/Inputs/explicit-build-prefer-self/map -o a.pcm<br>
+// RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=b %S/Inputs/explicit-build-prefer-self/map -o b.pcm<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>