================ @@ -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:
> `StoredFile` is never checked for existence anywhere else That makes sense. > & this code path can only happen if `ImportedFile` existed at the time of > `lookupModuleFile`. Then `FileManager` will never report it as missing after that point, unless I'm missing something. > It would be nice to reuse the FileEntry created by the ModuleManager, but it > goes out of scope by the time this check happens. Does it? It seems like it gets stored as `ModuleFile::File`. https://github.com/llvm/llvm-project/pull/136612 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits