[PATCH] D22773: Modules: add command line option fmodules-disable-diagnostic-validation to disable validation of the diagnostic options when loading the module

Manman Ren via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 25 15:12:53 PDT 2016


manmanren added a comment.

In https://reviews.llvm.org/D22773#495403, @benlangmuir wrote:

> We need to add this option to the module hash (see getModuleHash - we already add a bunch of other HSOpts there).  Otherwise the pcm could still be rewritten by a compilation that doesn't use a PCH, and then it would be out of date because of the timestamp instead of the diagnostic options.


I was thinking that for a project using PCH+Module, all clang invocations will be using -fmodules-disable-diagnostic-validation, so if only the diagnostic options change, they will hash to the same pcm file but the compiler will not regenerate and overwrite the existing pcm file. So when we load the pch, the time stamp etc will match and the compiler will not throw out-of-date error.

We can definitely hash the option HSOpts.ModulesValidateDiagnosticOptions in getModuleHash. But I don't quite get the reason you give here :)
the pcm could still be rewritten by a compilation that doesn't use a PCH, and then it would be out of date because of the timestamp instead of the diagnostic options

"a compilation that doesn't use a PCH", is that a different project? And we have two projects building in parallel? Just to make sure I understand.

Thanks!
Manman


https://reviews.llvm.org/D22773





More information about the cfe-commits mailing list