I found the the reason behind the odd behaviour, It's actually normal in my case as my *hsOpts*.*ResourceDir* path keeps on changing on every run during Debug build/run process under Xcode.
*hsOpts*.*ResourceDir *path refers to a bundle inside my app. This is the reason why I observe normal as odd behaviour. It behaves normally, if I run the app directly on the simulator/device irrespective of build configuration[*Debug*/*Release*]. Thanks Daniel for point to the commandline swiftc. I was able to find this only by running swiftc with lldb & my app in Xcode simultaneously, and keeping a Breakpoint at *Clang*::*CompilerInvocation*::*getModuleHash*() method. cheers RK On Sat, Apr 30, 2016 at 3:02 PM, Ramakrishna Mallireddy < ramakrishna.ma...@gmail.com> wrote: > 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_dun...@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.ma...@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_dun...@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@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@swift.org >>> > https://lists.swift.org/mailman/listinfo/swift-users >>> >>> >> >> >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users