[clang] [clang][Modules] Adding Specific Diagnostics when a Finalized PCM is Out-of-date due to Input File Changes (PR #209857)

Qiongsi Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 15 13:56:55 PDT 2026


qiongsiwu wrote:

> If this error case should never happen to module files unless of a compiler logic error, can we add a note that makes that more obvious?
> 
> Maybe something like `note: internal compiler error when validating module file, clear cache <path to module cache>`.
> 
> This is what the swift compiler reports for a class of serialization errors.
> 
> ```
> error: failed to verify module interface of '...' due to the errors above; the textual interface may be broken by project issues or a compiler bug
> ```

I think this error could happen without a compiler bug. If there are concurrent modifications of the input headers while the modules are getting build, I think this error will be triggered. I don't think clearing the module cache can reliably fix such races. I think for this particular case, this diagnostic is good enough, as it spells out the exact header that is modified to debug the potential race.

As a separate task though, I can look into for which clang errors we should implement a diagnostics similar to what Swift has and implement them. Let me know if you agree with this approach. 

https://github.com/llvm/llvm-project/pull/209857


More information about the cfe-commits mailing list