Skip to content

Commit 4b6e0bf

Browse files
committed
Package CMO: downgrade error to warning when checking for deserialization errors.
Binary module built with Package CMO can be loaded for package-external client modules which do not have direct access to decls that are serialized_for_package. Downgrade build-time error to warning when a deserialization error is found for a decl that should be allowed to access by package-external clients resiliently. rdar://143800032
1 parent 4ae5685 commit 4b6e0bf

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4735,7 +4735,7 @@ NOTE(ambiguous_because_of_trailing_closure,none,
47354735
(bool, const ValueDecl *))
47364736

47374737
// In-package resilience bypassing
4738-
ERROR(cannot_bypass_resilience_due_to_missing_member,none,
4738+
WARNING(cannot_bypass_resilience_due_to_missing_member,none,
47394739
"cannot bypass resilience due to member deserialization failure while attempting to access %select{member %0|missing member}1 of %2 in module %3 from module %4",
47404740
(Identifier, bool, Identifier, Identifier, Identifier))
47414741

lib/AST/Decl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4752,6 +4752,7 @@ bool ValueDecl::bypassResilienceInPackage(ModuleDecl *accessingModule) const {
47524752
if (auto IDC = dyn_cast<IterableDeclContext>(this)) {
47534753
// Recursively check if members and their members have failing
47544754
// deserialization, and emit a diagnostic.
4755+
// FIXME: It throws a warning for now; need to upgrade to an error.
47554756
IDC->checkDeserializeMemberErrorInPackage(accessingModule);
47564757
}
47574758
}

test/SILOptimizer/package-cmo-disallow-bypass-resilience-on-deserialization-fail.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222

2323
/// Build a swift module that depends on the above Core swift module without `INCLUDE_FOO`;
2424
/// it should fail and diagnose that there was a deserialization failure.
25-
// RUN: not %target-build-swift-dylib(%t/artifacts/SwiftBuilds/%target-library-name(MyUIA)) %t/src/UIA.swift \
25+
// RUN: %target-build-swift-dylib(%t/artifacts/SwiftBuilds/%target-library-name(MyUIA)) %t/src/UIA.swift \
2626
// RUN: -module-name MyUIA -emit-module -package-name pkg \
2727
// RUN: -enable-library-evolution -O -wmo \
2828
// RUN: -I %t/artifacts/SwiftBuilds -L %t/artifacts/SwiftBuilds \
2929
// RUN: -I %t/artifacts/ObjcBuilds -L %t/artifacts/ObjcBuilds \
3030
// RUN: -lMyCore -lObjCAPI -Rmodule-loading \
3131
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK
32-
// CHECK-DAG: error: cannot bypass resilience due to member deserialization failure while attempting to access missing member of 'PkgStructA' in module 'MyCore' from module 'MyCore'
32+
// CHECK-DAG: warning: cannot bypass resilience due to member deserialization failure while attempting to access missing member of 'PkgStructA' in module 'MyCore' from module 'MyCore'
3333

3434
/// Build a swift module that depends on Core without `INCLUDE_FOO` but
3535
/// opt out of deserialization checks; it builds even though deserialization failed.

0 commit comments

Comments
 (0)