[Serialization] Only remark if the last digit mismatches in precise tag check

Weaken the precise tag check at loading swiftmodule to accept binary
modules build by a compiler with a tag where only the last digit is
different. We assume that the other digit in the version should ensure
compiler and stdlib compatibility. If the last digit doesn't match,
still raise a remark.

rdar://105158258
This commit is contained in:
Alexis Laferrière
2023-02-13 12:56:07 -08:00
parent e079db233f
commit a5ccbf3264
5 changed files with 44 additions and 17 deletions

View File

@@ -836,6 +836,13 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
if (loadedModuleFile &&
loadedModuleFile->mayHaveDiagnosticsPointingAtBuffer())
OrphanedModuleFiles.push_back(std::move(loadedModuleFile));
} else {
// Report non-fatal compiler tag mismatch.
if (!loadInfo.problematicRevision.empty()) {
Ctx.Diags.diagnose(*diagLoc,
diag::serialization_module_problematic_revision,
loadInfo.problematicRevision, moduleBufferID);
}
}
// The -experimental-hermetic-seal-at-link flag turns on dead-stripping
@@ -896,7 +903,7 @@ void swift::serialization::diagnoseSerializedASTLoadFailure(
break;
case serialization::Status::RevisionIncompatible:
Ctx.Diags.diagnose(diagLoc, diag::serialization_module_incompatible_revision,
ModuleName, moduleBufferID);
loadInfo.problematicRevision, ModuleName, moduleBufferID);
break;
case serialization::Status::Malformed:
Ctx.Diags.diagnose(diagLoc, diag::serialization_malformed_module,