Skip to content

Commit e0c248c

Browse files
authored
Turn on deserialization recovery by default. (swiftlang#9486)
I'm still leaving a -disable-deserialization-recovery flag in there just in case.
1 parent 2ecfee3 commit e0c248c

File tree

12 files changed

+32
-35
lines changed

12 files changed

+32
-35
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ namespace swift {
197197
/// Whether to attempt to recover from missing cross-references and other
198198
/// errors when deserializing from a Swift module.
199199
///
200-
/// This is a staging flag; eventually it will be on by default.
201-
bool EnableDeserializationRecovery = false;
200+
/// This is a staging flag; eventually it will be removed.
201+
bool EnableDeserializationRecovery = true;
202202

203203
/// Should we use \c ASTScope-based resolution for unqualified name lookup?
204204
bool EnableASTScopeLookup = false;

include/swift/Option/FrontendOptions.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,12 @@ def enable_experimental_keypaths :
270270
Flag<["-"], "enable-experimental-keypaths">,
271271
HelpText<"Enable experimental keypaths">;
272272

273-
def enable_experimental_deserialization_recovery :
274-
Flag<["-"], "enable-experimental-deserialization-recovery">,
273+
def enable_deserialization_recovery :
274+
Flag<["-"], "enable-deserialization-recovery">,
275275
HelpText<"Attempt to recover from missing xrefs (etc) in swiftmodules">;
276+
def disable_deserialization_recovery :
277+
Flag<["-"], "disable-deserialization-recovery">,
278+
HelpText<"Don't attempt to recover from missing xrefs (etc) in swiftmodules">;
276279

277280
def enable_cow_existentials : Flag<["-"], "enable-cow-existentials">,
278281
HelpText<"Enable the copy-on-write existential implementation">;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
920920
Opts.EnableClassResilience |=
921921
Args.hasArg(OPT_enable_class_resilience);
922922

923-
Opts.EnableDeserializationRecovery |=
924-
Args.hasArg(OPT_enable_experimental_deserialization_recovery);
923+
if (auto A = Args.getLastArg(OPT_enable_deserialization_recovery,
924+
OPT_disable_deserialization_recovery)) {
925+
Opts.EnableDeserializationRecovery
926+
= A->getOption().matches(OPT_enable_deserialization_recovery);
927+
}
925928

926929
Opts.DisableAvailabilityChecking |=
927930
Args.hasArg(OPT_disable_availability_checking);

test/Compatibility/MixAndMatch/witness_change.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// RUN: rm -rf %t
22
// RUN: mkdir -p %t
3-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-deserialization-recovery -emit-module -o %t/SomeObjCModule.swiftmodule -module-name SomeObjCModule -I %t -I %S/Inputs -swift-version 3 %S/Inputs/SomeObjCModuleX.swift
4-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-deserialization-recovery -emit-module -o %t/SomeSwift3Module.swiftmodule -module-name SomeSwift3Module -I %t -I %S/Inputs -swift-version 3 %s
5-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-deserialization-recovery -emit-module -o %t/SomeSwift4Module.swiftmodule -module-name SomeSwift4Module -I %t -I %S/Inputs -swift-version 4 %S/Inputs/witness_change_swift4.swift
6-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-deserialization-recovery -c -I %t -I %S/Inputs -swift-version 3 %S/Inputs/witness_change_swift3_leaf.swift
3+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t/SomeObjCModule.swiftmodule -module-name SomeObjCModule -I %t -I %S/Inputs -swift-version 3 %S/Inputs/SomeObjCModuleX.swift
4+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t/SomeSwift3Module.swiftmodule -module-name SomeSwift3Module -I %t -I %S/Inputs -swift-version 3 %s
5+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t/SomeSwift4Module.swiftmodule -module-name SomeSwift4Module -I %t -I %S/Inputs -swift-version 4 %S/Inputs/witness_change_swift4.swift
6+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -c -I %t -I %S/Inputs -swift-version 3 %S/Inputs/witness_change_swift3_leaf.swift
77

88
// REQUIRES: objc_interop
99

test/Serialization/Recovery/crash-recovery.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: rm -rf %t && mkdir -p %t
22
// RUN: %target-swift-frontend -emit-module -o %t -module-name Lib -I %S/Inputs/custom-modules -swift-version 3 %s
33

4-
// RUN: not --crash %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -swift-version 3 -Xcc -DBAD 2>&1 | %FileCheck -check-prefix CHECK-CRASH -check-prefix CHECK-CRASH-3 %s
5-
// RUN: not --crash %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -swift-version 4 -Xcc -DBAD 2>&1 | %FileCheck -check-prefix CHECK-CRASH -check-prefix CHECK-CRASH-4 %s
4+
// RUN: echo 'import Lib; _ = Sub.disappearingMethod' | not --crash %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -swift-version 3 -disable-deserialization-recovery -Xcc -DBAD - 2>&1 | %FileCheck -check-prefix CHECK-CRASH -check-prefix CHECK-CRASH-3 %s
5+
// RUN: echo 'import Lib; _ = Sub.disappearingMethod' | not --crash %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -swift-version 4 -disable-deserialization-recovery -Xcc -DBAD - 2>&1 | %FileCheck -check-prefix CHECK-CRASH -check-prefix CHECK-CRASH-4 %s
66

77
// REQUIRES: objc_interop
88

test/Serialization/Recovery/overrides.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules | %FileCheck %s
55

6-
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -enable-experimental-deserialization-recovery | %FileCheck -check-prefix CHECK-RECOVERY %s
6+
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD | %FileCheck -check-prefix CHECK-RECOVERY %s
77

8-
// RUN: %target-swift-frontend -typecheck %s -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -enable-experimental-deserialization-recovery -D TEST -verify
8+
// RUN: %target-swift-frontend -typecheck %s -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -D TEST -verify
99

1010
// REQUIRES: objc_interop
1111

test/Serialization/Recovery/type-removal-objc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules | %FileCheck %s
55

6-
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -enable-experimental-deserialization-recovery > %t.txt
6+
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD > %t.txt
77
// RUN: %FileCheck -check-prefix CHECK-RECOVERY %s < %t.txt
88
// RUN: %FileCheck -check-prefix CHECK-RECOVERY-NEGATIVE %s < %t.txt
99

test/Serialization/Recovery/typedefs-in-protocols.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules | %FileCheck %s
55

6-
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -enable-experimental-deserialization-recovery | %FileCheck -check-prefix CHECK-RECOVERY %s
6+
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD | %FileCheck -check-prefix CHECK-RECOVERY %s
77

8-
// RUN: %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST -enable-experimental-deserialization-recovery -DVERIFY %s -verify
8+
// RUN: %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST -DVERIFY %s -verify
99

1010
// RUN: %target-swift-frontend -emit-ir -I %t -I %S/Inputs/custom-modules -DTEST %s | %FileCheck -check-prefix CHECK-IR %s
11-
// RUN: %target-swift-frontend -emit-ir -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST -enable-experimental-deserialization-recovery %s | %FileCheck -check-prefix CHECK-IR %s
11+
// RUN: %target-swift-frontend -emit-ir -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST %s | %FileCheck -check-prefix CHECK-IR %s
1212

1313
#if TEST
1414

test/Serialization/Recovery/typedefs.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules | %FileCheck %s
55

6-
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -enable-experimental-deserialization-recovery > %t.txt
6+
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -Xcc -DBAD > %t.txt
77
// RUN: %FileCheck -check-prefix CHECK-RECOVERY %s < %t.txt
88
// RUN: %FileCheck -check-prefix CHECK-RECOVERY-NEGATIVE %s < %t.txt
99

10-
// RUN: %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST -enable-experimental-deserialization-recovery -DVERIFY %s -verify
11-
// RUN: %target-swift-frontend -emit-silgen -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST -enable-experimental-deserialization-recovery %s | %FileCheck -check-prefix CHECK-SIL %s
10+
// RUN: %target-swift-frontend -typecheck -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST -DVERIFY %s -verify
11+
// RUN: %target-swift-frontend -emit-silgen -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST %s | %FileCheck -check-prefix CHECK-SIL %s
1212

1313
// RUN: %target-swift-frontend -emit-ir -I %t -I %S/Inputs/custom-modules -DTEST %s | %FileCheck -check-prefix CHECK-IR %s
14-
// RUN: %target-swift-frontend -emit-ir -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST -enable-experimental-deserialization-recovery %s | %FileCheck -check-prefix CHECK-IR %s
14+
// RUN: %target-swift-frontend -emit-ir -I %t -I %S/Inputs/custom-modules -Xcc -DBAD -DTEST %s | %FileCheck -check-prefix CHECK-IR %s
1515

1616
#if TEST
1717

test/Serialization/Recovery/types-3-to-4.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -swift-version 3 | %FileCheck -check-prefix=CHECK-3 %s
55

6-
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -enable-experimental-deserialization-recovery -swift-version 4 | %FileCheck -check-prefix=CHECK-4 %s
6+
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -swift-version 4 | %FileCheck -check-prefix=CHECK-4 %s
77

8-
// RUN: %target-swift-frontend -typecheck %s -I %t -I %S/Inputs/custom-modules -swift-version 4 -enable-experimental-deserialization-recovery -D TEST -verify
8+
// RUN: %target-swift-frontend -typecheck %s -I %t -I %S/Inputs/custom-modules -swift-version 4 -D TEST -verify
99

1010
// REQUIRES: objc_interop
1111

test/Serialization/Recovery/types-4-to-3.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -swift-version 4 | %FileCheck %s
55

6-
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -enable-experimental-deserialization-recovery -swift-version 3 | %FileCheck %s
6+
// RUN: %target-swift-ide-test -source-filename=x -print-module -module-to-print Lib -I %t -I %S/Inputs/custom-modules -swift-version 3 | %FileCheck %s
77

8-
// RUN: %target-swift-frontend -typecheck %s -I %t -I %S/Inputs/custom-modules -swift-version 3 -enable-experimental-deserialization-recovery -D TEST -verify
8+
// RUN: %target-swift-frontend -typecheck %s -I %t -I %S/Inputs/custom-modules -swift-version 3 -D TEST -verify
99

1010
// REQUIRES: objc_interop
1111

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,6 @@ EnableSwift3ObjCInference("enable-swift3-objc-inference",
352352
llvm::cl::cat(Category),
353353
llvm::cl::init(false));
354354

355-
static llvm::cl::opt<bool>
356-
EnableDeserializationRecovery(
357-
"enable-experimental-deserialization-recovery",
358-
llvm::cl::desc("Attempt to recover from missing xrefs (etc) in swiftmodules"),
359-
llvm::cl::cat(Category),
360-
llvm::cl::init(false));
361-
362355
static llvm::cl::opt<bool>
363356
DisableObjCAttrRequiresFoundationModule(
364357
"disable-objc-attr-requires-foundation-module",
@@ -3017,8 +3010,6 @@ int main(int argc, char *argv[]) {
30173010
InitInvok.getLangOptions().EnableSwift3ObjCInference =
30183011
options::EnableSwift3ObjCInference ||
30193012
InitInvok.getLangOptions().isSwiftVersion3();
3020-
InitInvok.getLangOptions().EnableDeserializationRecovery |=
3021-
options::EnableDeserializationRecovery;
30223013
InitInvok.getClangImporterOptions().ImportForwardDeclarations |=
30233014
options::ObjCForwardDeclarations;
30243015
InitInvok.getClangImporterOptions().InferImportAsMember |=

0 commit comments

Comments
 (0)