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

Ramakrishna Mallireddy ramakrishna.malli at gmail.com
Fri Apr 29 16:08:24 CDT 2016

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*


                                   ImportLoc, ARRFlags) return with

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.



On Fri, Apr 29, 2016 at 9:15 PM, Daniel Dunbar <daniel_dunbar at apple.com>

> 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/db36293f/attachment.html>

More information about the swift-users mailing list