[swift-users] make swift compiler to use the precompiled module files
Ramakrishna Mallireddy
ramakrishna.malli at gmail.com
Sat Apr 30 04:32:42 CDT 2016
No, it doesn't happen. The same flags works fine with swiftc when using
from command line.
swiftc xcode project generated from Ninja have the same issue as I have i.e
hash value is different for each run.
LLVMTest.app is my application that is linked with swift-clang, swift-llvm
& swift-2.2.release libraries.
Following are the commandline arguments that I am using.
const char *argv[] = {sourceFilePath, "-target", "arm64-apple-ios8.0",
"-module-cache-path", [moduleCache cStringUsingEncoding:NSUTF8StringEncoding],
"-sdk", sdkpath, "-emit-ir", "-parse-as-library", "-Onone", "-o",
[destFilePath cStringUsingEncoding:NSUTF8StringEncoding]};
The swift front-end entry call.
frontend_main(llvm::ArrayRef<const char *>(argv, 13), "LLVMTest", (void *)(
intptr_t)"");
On Sat, Apr 30, 2016 at 9:35 AM, Daniel Dunbar <daniel_dunbar at apple.com>
wrote:
> 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?
>
> - Daniel
>
> On Apr 29, 2016, at 2:08 PM, Ramakrishna Mallireddy <
> ramakrishna.malli at gmail.com> wrote:
>
> 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.
>
> I am using the swift front-end c++ api's to compile a simple swift file.
> If I set the -fdisable-module-hash, then pcm files are generated without
> the hash as required under the ModuleCache Dir.
> so problem is solved as clang now see the existing pcm files, but now I
> hit the next hurdle.
>
> 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 *ReadAST *returns
> with *ASTReader::OutOfDate *and as usual it calls *compileAndLoadModule *which
> I want to avoid in the first place*.*
>
> Call to *CLang*::*CompilerInstance*::*ModuleManager*->*ReadAST*
> (ModuleFileName,
>
> serialization::MK_ImplicitModule,
>
> ImportLoc, ARRFlags) return with
> *ASTReader::OutOfDate*
>
> as *ReadASTCore*(FileName, Type, ImportLoc, /*ImportedBy=*/nullptr,
> Loaded, 0, 0, 0, ClientLoadCapabilities) returns with *OutOfDate.*
>
> These files are generated just few minutes ago, how can it be OutOfDate I
> don't have any idea.
>
> File* modules.timestamp* under the ModuleCache Dir is 0 bytes.
>
> Thanks
>
> Ramakrishna
>
> On Fri, Apr 29, 2016 at 9:15 PM, Daniel Dunbar <daniel_dunbar at apple.com>
> wrote:
>
>> Clang will cache these automatically, can you give more details on
>> exactly what you are seeing?
>>
>> - Daniel
>>
>> > On Apr 28, 2016, at 10:50 PM, Ramakrishna Mallireddy via swift-users <
>> swift-users at swift.org> wrote:
>> >
>> > I have these precompiled module files generated every-time I run the
>> swift compiler.
>> >
>> > _Builtin_stddef_max_align_t-1LMTETLX3WNFT.pcm
>> > CFNetwork-1UTIO6DPB9R5P.pcm
>> > CoreFoundation-CF8BGN41VJ11.pcm
>> > CoreGraphics-3SDFP08OX46EF.pcm
>> > CoreImage-3SDFP08OX46EF.pcm
>> > Darwin-4F8STAM1KXDF.pcm
>> > Foundation-2LQ7EQYFLQOP.pcm
>> > ...etc
>> >
>> > How can I make the swift compiler to use these cache rather than
>> compiling the libraries again.
>> >
>> > Thanks
>> > Ramakrishna
>> > _______________________________________________
>> > swift-users mailing list
>> > swift-users at swift.org
>> > https://lists.swift.org/mailman/listinfo/swift-users
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160430/80db76e9/attachment.html>
More information about the swift-users
mailing list