[clang] [clang][modules] Minor improvements to diagnosing `out of date` errors (PR #136612)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 22 15:29:06 PDT 2025
================
@@ -3349,10 +3351,29 @@ ASTReader::ReadControlBlock(ModuleFile &F,
.getModuleCache()
.getInMemoryModuleCache()
.isPCMFinal(F.FileName);
- if (isDiagnosedResult(Result, Capabilities) || recompilingFinalized)
+ if (isDiagnosedResult(Result, Capabilities) || recompilingFinalized) {
Diag(diag::note_module_file_imported_by)
<< F.FileName << !F.ModuleName.empty() << F.ModuleName;
+ // When a Filemap is used, the ImportedFile may be different than what
+ // was encoded as a dependency in StoredFile.
+ // When this happens, look up both files when reporting that they
+ // differ. If either file does not exist, fall back to a string path
+ // check.
+ if (UseFilemap && !F.ModuleName.empty() && !StoredFile.empty()) {
+ auto ImportedFileRef =
+ PP.getFileManager().getOptionalFileRef(ImportedFile);
+ auto StoredFileRef =
+ PP.getFileManager().getOptionalFileRef(StoredFile);
+ const bool MissingFiles = !ImportedFileRef || !StoredFileRef;
+ if ((MissingFiles && (StoredFile != ImportedFile)) ||
----------------
jansvoboda11 wrote:
If either file is missing, haven't we already emitted a diagnostic elsewhere? I'm thinking this might only add noise to the previous diagnostic (complaining about benign path differences).
https://github.com/llvm/llvm-project/pull/136612
More information about the cfe-commits
mailing list