benlangmuir added a comment.

> Can you point me to the source codes where we use rename to replace the file? 
> I am curious on how this all works out.


This is the same as clang's handling of other output files.  See 
{{CompilerInstance::createOutputFile}} and {{clearOutputFiles}}.  When we are 
performing the GenerateModuleAction, the .pcm file will be the output file.

> What I described is a scenario I thought possible that can cause 
> "out-of-date" error:

>  module "B" is out of date and needs to be rebuilt

>  note: imported by module "A"

>  The only invocation of ReadAST that reads a module file and can't handle 
> out-of-date modules, is the path where we just built module "A" and tries to 
> load module "A" (here ModuleLoadCapabilities will be ARR_Missing).


Right, here and in PCH loading (I assume your case doesn't involve a PCH).  I'm 
concerned about adding this loop, because it removes the guarantee of progress. 
 We should never need to build a module more than once in the same compilation. 
 If we have a bug that's causing us to not be able to load a module that we 
just compiled, I think we need to fix the underlying problem, not just retry 
the build.


https://reviews.llvm.org/D22636



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to