mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] When crashing, note if mix-and-match may be to blame.
That is, a Swift 3 target imported into a Swift 4 context or vice versa. This requires serializing the compatibility mode explicitly, instead of including it in the textual version string that's only for debugging.
This commit is contained in:
@@ -193,9 +193,20 @@ validateControlBlock(llvm::BitstreamCursor &cursor,
|
||||
}
|
||||
}
|
||||
|
||||
// This field was added later; be resilient against its absence.
|
||||
if (scratch.size() > 2) {
|
||||
// These fields were added later; be resilient against their absence.
|
||||
switch (scratch.size()) {
|
||||
default:
|
||||
// Add new cases here, in descending order.
|
||||
case 4:
|
||||
result.compatibilityVersion = blobData.substr(scratch[2]+1, scratch[3]);
|
||||
LLVM_FALLTHROUGH;
|
||||
case 3:
|
||||
result.shortVersion = blobData.slice(0, scratch[2]);
|
||||
LLVM_FALLTHROUGH;
|
||||
case 2:
|
||||
case 1:
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
||||
versionSeen = true;
|
||||
@@ -932,6 +943,7 @@ ModuleFile::ModuleFile(
|
||||
}
|
||||
Name = info.name;
|
||||
TargetTriple = info.targetTriple;
|
||||
CompatibilityVersion = info.compatibilityVersion;
|
||||
|
||||
hasValidControlBlock = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user