Skip to content

Commit b16bc47

Browse files
committed
[Serialization] Suggest solution for SDK mods causing deserialization failures
Many deserialization failures at this points are caused by archives installed over the SDK. Let's extend the current error message with a solution for such a case. rdar://86280699
1 parent 9e4a00d commit b16bc47

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

lib/Serialization/ModuleFileSharedCore.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,8 @@ void ModuleFileSharedCore::fatal(llvm::Error error) const {
564564
llvm::raw_svector_ostream out(errorStr);
565565

566566
out << "*** DESERIALIZATION FAILURE ***\n";
567+
out << "*** If any module named here was modified in the SDK, please delete the ***\n";
568+
out << "*** swiftmodule files from the root and keep only swiftinterface files. ***\n";
567569
outputDiagnosticInfo(out);
568570
out << "\n";
569571
if (error) {

test/Serialization/Recovery/crash-recovery.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ public class Sub: Base {
1717
// CHECK-CRASH-4_2: Compiling with effective version 4.2
1818
// CHECK-CRASH: While loading members for 'Sub' (in module 'Lib')
1919
// CHECK-CRASH-LABEL: *** DESERIALIZATION FAILURE ***
20+
// CHECK-CRASH-LABEL: *** If any module named here was modified in the SDK, please delete the ***
21+
// CHECK-CRASH-LABEL: *** swiftmodule files from the root and keep only swiftinterface files. ***
2022
// CHECK-CRASH: module 'Lib' with full misc version {{.*}}4.1.50
2123
// CHECK-CRASH: could not find 'disappearingMethod()' in parent class

test/Serialization/Recovery/crash-xref.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
// RUN: cat %t/normal_stderr | %FileCheck %s -check-prefixes=NORMALFAILURE
2525
// NORMALFAILURE-LABEL: *** DESERIALIZATION FAILURE ***
26+
// NORMALFAILURE-LABEL: *** If any module named here was modified in the SDK, please delete the ***
27+
// NORMALFAILURE-LABEL: *** swiftmodule files from the root and keep only swiftinterface files. ***
2628
// NORMALFAILURE-NEXT: module 'Client' with full misc version {{.*}}'
2729
// NORMALFAILURE-NEXT: Could not deserialize type for 'foo()'
2830
// NORMALFAILURE-NEXT: Caused by: top-level value not found
@@ -33,6 +35,8 @@
3335

3436
// RUN: cat %t/error_stderr | %FileCheck %s -check-prefixes=ALLOWFAILURE
3537
// ALLOWFAILURE-LABEL: *** DESERIALIZATION FAILURE ***
38+
// ALLOWFAILURE-LABEL: *** If any module named here was modified in the SDK, please delete the ***
39+
// ALLOWFAILURE-LABEL: *** swiftmodule files from the root and keep only swiftinterface files. ***
3640
// ALLOWFAILURE-NEXT: module 'Client' with full misc version {{.*}}' (built with -experimental-allow-module-with-compiler-errors)
3741
// ALLOWFAILURE-NEXT: Could not deserialize type for 'foo()'
3842
// ALLOWFAILURE-NEXT: Caused by: top-level value not found

0 commit comments

Comments
 (0)