mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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:
@@ -344,6 +344,17 @@ static bool skipRecord(llvm::BitstreamCursor &cursor, unsigned recordKind) {
|
||||
void ModuleFile::fatal(llvm::Error error) {
|
||||
if (FileContext) {
|
||||
getContext().Diags.diagnose(SourceLoc(), diag::serialization_fatal, Name);
|
||||
|
||||
if (!CompatibilityVersion.empty()) {
|
||||
SmallString<16> buffer;
|
||||
llvm::raw_svector_ostream out(buffer);
|
||||
out << getContext().LangOpts.EffectiveLanguageVersion;
|
||||
if (out.str() != CompatibilityVersion) {
|
||||
getContext().Diags.diagnose(
|
||||
SourceLoc(), diag::serialization_compatibility_version_mismatch,
|
||||
out.str(), Name, CompatibilityVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logAllUnhandledErrors(std::move(error), llvm::errs(),
|
||||
|
||||
Reference in New Issue
Block a user