[swift-users] make swift compiler to use the precompiled module files

Daniel Dunbar daniel_dunbar at apple.com
Fri Apr 29 23:05:21 CDT 2016


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 <mailto: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 <mailto: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 <mailto:swift-users at swift.org>
> > https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160429/c46d5061/attachment.html>


More information about the swift-users mailing list