[Serialization] Remark on stderr when loading a mismatching swiftmodule

Swiftmodules built by a mismatching compiler are loaded if the mismatch
is only on the last digit of the compiler version. In such a case, write
a remark directly to stderr to avoid showing this error in IDE but keep
it for debugging purposes.

rdar://105881894
This commit is contained in:
Alexis Laferrière
2023-03-03 10:46:27 -08:00
parent fbac54546d
commit f4bb6dc9ec
2 changed files with 6 additions and 8 deletions

View File

@@ -846,11 +846,13 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
loadedModuleFile->mayHaveDiagnosticsPointingAtBuffer())
OrphanedModuleFiles.push_back(std::move(loadedModuleFile));
} else {
// Report non-fatal compiler tag mismatch.
// Report non-fatal compiler tag mismatch on stderr only to avoid
// polluting the IDE UI.
if (!loadInfo.problematicRevision.empty()) {
Ctx.Diags.diagnose(*diagLoc,
diag::serialization_module_problematic_revision,
loadInfo.problematicRevision, moduleBufferID);
llvm::errs() << "remark: compiled module was created by a different " <<
"version of the compiler '" <<
loadInfo.problematicRevision <<
"': " << moduleBufferID << "\n";
}
}