mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -372,10 +372,18 @@ static ValidationInfo validateControlBlock(
|
||||
StringRef compilerRevision = forcedDebugRevision ?
|
||||
forcedDebugRevision : version::getCurrentCompilerSerializationTag();
|
||||
if (moduleRevision != compilerRevision) {
|
||||
result.status = Status::RevisionIncompatible;
|
||||
// The module versions are mismatching, record it and diagnose later.
|
||||
result.problematicRevision = moduleRevision;
|
||||
|
||||
// We can't trust this module format at this point.
|
||||
return result;
|
||||
// Reject the module only it still mismatches without the last digit.
|
||||
StringRef compilerRevisionHead = compilerRevision.rsplit('.').first;
|
||||
StringRef moduleRevisionHead = moduleRevision.rsplit('.').first;
|
||||
if (moduleRevisionHead != compilerRevisionHead) {
|
||||
result.status = Status::RevisionIncompatible;
|
||||
|
||||
// We can't trust the module format at this point.
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user