Skip to content

Commit a0ee5c5

Browse files
authored
Merge pull request #63116 from xymus/deser-safety-by-default
[Serialization] Enable deserialization safety by default
2 parents 6a0f68e + 9c866dd commit a0ee5c5

8 files changed

+9
-19
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ namespace swift {
366366

367367
/// Enable early skipping deserialization of decls that are marked as
368368
/// unsafe to read.
369-
bool EnableDeserializationSafety = false;
369+
bool EnableDeserializationSafety = true;
370370

371371
/// Whether to enable the new operator decl and precedencegroup lookup
372372
/// behavior. This is a staging flag, and will be removed in the future.

test/IRGen/type_layout_dumper_all.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %empty-directory(%t)
33
// RUN: %target-swift-frontend -emit-module -enable-library-evolution -emit-module-path=%t/type_layout_dumper_other.swiftmodule -module-name=type_layout_dumper_other %S/Inputs/type_layout_dumper_other.swift
44

5-
// RUN: %target-swift-frontend -dump-type-info -I %t %s | %FileCheck %s
5+
// RUN: %target-swift-frontend -dump-type-info -I %t %s -disable-deserialization-safety | %FileCheck %s
66

77
// REQUIRES: CPU=x86_64
88
// REQUIRES: OS=macosx

test/IRGen/type_layout_dumper_resilient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %empty-directory(%t)
33
// RUN: %target-swift-frontend -emit-module -enable-library-evolution -emit-module-path=%t/type_layout_dumper_other.swiftmodule -module-name=type_layout_dumper_other %S/Inputs/type_layout_dumper_other.swift
44

5-
// RUN: %target-swift-frontend -dump-type-info -type-info-dump-filter=resilient -I %t %s | %FileCheck %s
5+
// RUN: %target-swift-frontend -dump-type-info -type-info-dump-filter=resilient -I %t %s -disable-deserialization-safety | %FileCheck %s
66

77
// REQUIRES: CPU=x86_64
88
// REQUIRES: OS=macosx

test/Serialization/Safety/override-internal-func.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
// RUN: -emit-module-interface-path %t/Lib.swiftinterface
1111

1212
/// Build against the swiftmodule.
13-
// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
14-
// RUN: -enable-deserialization-safety
13+
// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t
1514

1615
/// Build against the swiftinterface.
1716
// RUN: rm %t/Lib.swiftmodule
18-
// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
19-
// RUN: -enable-deserialization-safety
17+
// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t
2018

2119
//--- Lib.swift
2220

test/Serialization/Safety/skip-reading-internal-anyobject.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
/// Build client.
1313
// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
14-
// RUN: -verify -Xllvm -debug-only=Serialization \
15-
// RUN: -enable-deserialization-safety 2>&1 \
14+
// RUN: -verify -Xllvm -debug-only=Serialization 2>&1 \
1615
// RUN: | %FileCheck --check-prefixes=SAFE %s
1716

1817
/// Decls skips by the deserialization safety logic.

test/Serialization/Safety/skip-reading-internal-details.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
// RUN: | %FileCheck --check-prefixes=NEEDED,UNSAFE %s
2020

2121
// RUN: %target-swift-frontend -typecheck %t/Client.swift -I %t \
22-
// RUN: -verify -Xllvm -debug-only=Serialization \
23-
// RUN: -enable-deserialization-safety 2>&1 \
22+
// RUN: -verify -Xllvm -debug-only=Serialization 2>&1 \
2423
// RUN: | %FileCheck --check-prefixes=NEEDED,CLEAN,SAFE %s
2524

2625
/// Build against the swiftinterface.

test/Serialization/Safety/unsafe-decls.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,25 @@
44

55
// RUN: %target-swift-frontend -emit-module %s \
66
// RUN: -enable-library-evolution -swift-version 5 \
7-
// RUN: -enable-deserialization-safety \
87
// RUN: -Xllvm -debug-only=Serialization 2>&1 \
98
// RUN: | %FileCheck --check-prefixes=SAFETY-PRIVATE,SAFETY-INTERNAL %s
109

1110
// RUN: %target-swift-frontend -emit-module %s \
1211
// RUN: -enable-library-evolution -swift-version 5 \
13-
// RUN: -enable-deserialization-safety \
1412
// RUN: -Xllvm -debug-only=Serialization \
1513
// RUN: -enable-testing 2>&1 \
1614
// RUN: | %FileCheck --check-prefixes=SAFETY-PRIVATE,NO-SAFETY-INTERNAL-NOT %s
1715

1816
/// Don't mark decls as unsafe when private import is enabled.
1917
// RUN: %target-swift-frontend -emit-module %s \
2018
// RUN: -enable-library-evolution -swift-version 5 \
21-
// RUN: -enable-deserialization-safety \
2219
// RUN: -Xllvm -debug-only=Serialization \
2320
// RUN: -enable-private-imports 2>&1 \
2421
// RUN: | %FileCheck --check-prefixes=DISABLED %s
2522

2623
/// Don't mark decls as unsafe without library evolution.
2724
// RUN: %target-swift-frontend -emit-module %s \
28-
// RUN: -enable-deserialization-safety -swift-version 5 \
25+
// RUN: -swift-version 5 \
2926
// RUN: -Xllvm -debug-only=Serialization 2>&1 \
3027
// RUN: | %FileCheck --check-prefixes=DISABLED %s
3128

test/Serialization/Safety/unsafe-extensions.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,25 @@
44

55
// RUN: %target-swift-frontend -emit-module %s \
66
// RUN: -enable-library-evolution -swift-version 5 \
7-
// RUN: -enable-deserialization-safety \
87
// RUN: -Xllvm -debug-only=Serialization 2>&1 \
98
// RUN: | %FileCheck --check-prefixes=SAFETY-PRIVATE,SAFETY-INTERNAL %s
109

1110
// RUN: %target-swift-frontend -emit-module %s \
1211
// RUN: -enable-library-evolution -swift-version 5 \
13-
// RUN: -enable-deserialization-safety \
1412
// RUN: -Xllvm -debug-only=Serialization \
1513
// RUN: -enable-testing 2>&1 \
1614
// RUN: | %FileCheck --check-prefixes=SAFETY-PRIVATE,NO-SAFETY-INTERNAL %s
1715

1816
/// Don't mark decls as unsafe when private import is enabled.
1917
// RUN: %target-swift-frontend -emit-module %s \
2018
// RUN: -enable-library-evolution -swift-version 5 \
21-
// RUN: -enable-deserialization-safety \
2219
// RUN: -Xllvm -debug-only=Serialization \
2320
// RUN: -enable-private-imports 2>&1 \
2421
// RUN: | %FileCheck --check-prefixes=DISABLED %s
2522

2623
/// Don't mark decls as unsafe without library evolution.
2724
// RUN: %target-swift-frontend -emit-module %s \
28-
// RUN: -enable-deserialization-safety -swift-version 5 \
25+
// RUN: -swift-version 5 \
2926
// RUN: -Xllvm -debug-only=Serialization 2>&1 \
3027
// RUN: | %FileCheck --check-prefixes=DISABLED %s
3128

0 commit comments

Comments
 (0)