================ @@ -6067,14 +6062,21 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile &F, if (OptionalFileEntryRef CurFile = CurrentModule->getASTFile()) { // Don't emit module relocation error if we have -fno-validate-pch if (!bool(PP.getPreprocessorOpts().DisablePCHOrModuleValidation & - DisableValidationForModuleKind::Module) && - CurFile != F.File) { - auto ConflictError = - PartialDiagnostic(diag::err_module_file_conflict, - ContextObj->DiagAllocator) + DisableValidationForModuleKind::Module)) { + assert(CurFile != F.File && "ModuleManager did not de-duplicate"); + + Diag(diag::err_module_file_conflict) << CurrentModule->getTopLevelModuleName() << CurFile->getName() << F.File.getName(); - return DiagnosticError::create(CurrentImportLoc, ConflictError); + + auto CurModMapFile = + ModMap.getContainingModuleMapFile(CurrentModule); + auto ModMapFile = FileMgr.getOptionalFileRef(F.ModuleMapPath); + if (CurModMapFile && ModMapFile && CurModMapFile != ModMapFile) ---------------- jansvoboda11 wrote:
Could be file being removed during build, could be an importer with different VFS overlay setup to the PCM file, could be other situations I'm not thinking of right now. If we can't get the `FileEntry` out of `FileManager`, we'd need to rely on string comparisons, which is a no-no in my view. I don't want to emit this diagnostic unless we're 100% sure this is the reason for the duplicate PCM. https://github.com/llvm/llvm-project/pull/134475 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits