<div dir="ltr">







<p>No, it doesn&#39;t happen. The same flags works fine with swiftc when using from command line. </p><p>swiftc xcode project generated from Ninja have the same issue as I have i.e hash value is different for each run.</p><p>LLVMTest.app is my application that is linked with swift-clang, swift-llvm &amp; swift-2.2.release libraries.</p><p>Following are the commandline arguments that I am using.</p><p><span>const</span><span> </span><span>char</span><span> *argv[] = {sourceFilePath, </span><span>&quot;-target&quot;</span><span>, </span><span>&quot;arm64-apple-ios8.0&quot;</span><span>, </span><span>&quot;-module-cache-path&quot;</span><span>, [moduleCache </span><span>cStringUsingEncoding</span><span>:</span><span>NSUTF8StringEncoding</span><span>], </span><span>&quot;-sdk&quot;</span><span>, sdkpath, </span><span>&quot;-emit-ir&quot;</span><span>, </span><span>&quot;-parse-as-library&quot;</span><span>, </span><span>&quot;-Onone&quot;</span><span>, </span><span>&quot;-o&quot;</span><span>, [destFilePath </span><span>cStringUsingEncoding</span><span>:</span><span>NSUTF8StringEncoding</span><span>]};</span><br></p>
<p><span>The swift front-end entry call.</span></p><p><span>frontend_main</span><span>(</span><span>llvm</span><span>::</span><span>ArrayRef</span><span>&lt;</span><span>const</span><span> </span><span>char</span><span> *&gt;(argv, </span><span>13</span><span>), </span><span>&quot;LLVMTest&quot;</span><span>, (</span><span>void</span><span> *)(</span><span>intptr_t</span><span>)</span><span>&quot;&quot;</span><span>);</span></p></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 30, 2016 at 9:35 AM, Daniel Dunbar <span dir="ltr">&lt;<a href="mailto:daniel_dunbar@apple.com" target="_blank">daniel_dunbar@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">If the hash value of the module is different then most likely something else is going on -- are you passing any special flags or defines as part of the compiler command? If you run the same command from swiftc on the command line do you see the same behavior?<span class="HOEnZb"><font color="#888888"><div><br></div><div> - Daniel</div></font></span><div><div class="h5"><div><div><div><br><blockquote type="cite"><div>On Apr 29, 2016, at 2:08 PM, Ramakrishna Mallireddy &lt;<a href="mailto:ramakrishna.malli@gmail.com" target="_blank">ramakrishna.malli@gmail.com</a>&gt; wrote:</div><br><div><div dir="ltr">Every-time I run swift frontend the clang creates a new cachedir with modulecache path hash(on every run the hash value is different for the same input string) as the name of the dir and generates default cocoa framework pcm files inside it.<div><br></div><div>I am using the swift front-end c++ api&#39;s to compile a simple swift file.</div><div>If I set the -fdisable-module-hash, then pcm files are generated without the hash as required under the ModuleCache Dir.</div><div>so problem is solved as clang now see the existing pcm files, but now I hit the next hurdle.</div><div><br></div><div>Now the pcm files are there in the cache, when I run the frontend again, I assume clang will load the AST from the pcm files but clang <b>ReadAST </b>returns with<b> </b><b>ASTReader::OutOfDate </b>and as usual it calls<b> </b><b>compileAndLoadModule </b>which I want to avoid in the first place<b>.</b></div><div><br></div><div><span>Call to <b>CLang</b>::</span><b>CompilerInstance</b>::<span><b>ModuleManager</b></span><span>-&gt;</span><span><b>ReadAST</b></span><span>(ModuleFileName,</span></div>







<div><p><span>                                   </span><span>serialization</span><span>::</span><span>MK_ImplicitModule</span><span>,</span></p><p><span>                                   ImportLoc, ARRFlags) </span><span>return with </span><b>ASTReader::OutOfDate</b></p><p><span>as </span><span><b>ReadASTCore</b>(FileName, Type, ImportLoc, </span><span> </span><span>/*ImportedBy=*/</span><span>nullptr</span><span>, Loaded, </span><span>0</span><span>, </span><span>0</span><span>, </span><span>0</span><span>, </span>ClientLoadCapabilities) returns with <b>OutOfDate.</b></p><p>These files are generated just few minutes ago, how can it be OutOfDate I don&#39;t have any idea.</p><p>File<b> modules.timestamp</b> under the ModuleCache Dir is 0 bytes.</p><p>Thanks</p><p>Ramakrishna</p>































</div>







</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 29, 2016 at 9:15 PM, Daniel Dunbar <span dir="ltr">&lt;<a href="mailto:daniel_dunbar@apple.com" target="_blank">daniel_dunbar@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Clang will cache these automatically, can you give more details on exactly what you are seeing?<br>
<br>
 - Daniel<br>
<div><div><br>
&gt; On Apr 28, 2016, at 10:50 PM, Ramakrishna Mallireddy via swift-users &lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I have these precompiled module files generated every-time I run the swift compiler.<br>
&gt;<br>
&gt; _Builtin_stddef_max_align_t-1LMTETLX3WNFT.pcm<br>
&gt; CFNetwork-1UTIO6DPB9R5P.pcm<br>
&gt; CoreFoundation-CF8BGN41VJ11.pcm<br>
&gt; CoreGraphics-3SDFP08OX46EF.pcm<br>
&gt; CoreImage-3SDFP08OX46EF.pcm<br>
&gt; Darwin-4F8STAM1KXDF.pcm<br>
&gt; Foundation-2LQ7EQYFLQOP.pcm<br>
&gt; ...etc<br>
&gt;<br>
&gt; How can I make the swift compiler to use these cache rather than compiling the libraries again.<br>
&gt;<br>
&gt; Thanks<br>
&gt; Ramakrishna<br>
</div></div>&gt; _______________________________________________<br>
&gt; swift-users mailing list<br>
&gt; <a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
<br>
</blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></div></div></blockquote></div><br></div>