@@ -930,28 +930,24 @@ bool SILFunction::hasName(const char *Name) const {
930
930
931
931
bool SILFunction::canBeSerializedIntoCaller (
932
932
std::optional<SerializedKind_t> callerSerializedKind) const {
933
- // If Package-CMO is enabled, we serialize package, public,
934
- // and @usableFromInline decls as [serialized_for_package].
935
- // They must not, however, leak into @inlinable functions
936
- // outside of their defining module. The following contains
937
- // the rule of inlinability of a callee (e.g. serialized
938
- // in a library module with Package-CMO) into a caller (e.g.
939
- // an @inlinable function in a client module).
940
-
941
933
switch (getSerializedKind ()) {
942
- // If this callee is not serialized, caller must also
943
- // be _not_ serialized for this callee to be inlined
944
- // into the caller.
934
+ // If this callee is not serialized, it can't be inlined
935
+ // into the caller unless Package-CMO is enabled; if so,
936
+ // the callee should have package or more visibility and
937
+ // the caller must also be _not_ serialized for this callee
938
+ // to be inlined.
945
939
case IsNotSerialized:
946
- return false ;
947
- // pcmo TODO: should we return the following instead?
948
- // return callerSerializedKind.has_value() &&
949
- // callerSerializedKind.value() == IsNotSerialized &&
950
- // getModule().getSwiftModule()->serializePackageEnabled() &&
951
- // getModule().getSwiftModule()->isResilient() &&
952
- // hasPublicOrPackageVisibility(getLinkage(), true);
953
- // If this callee is serialized_for_package, the caller
954
- // must be either not serialized or serialized_for_package
940
+ return callerSerializedKind.has_value () &&
941
+ callerSerializedKind.value () == IsNotSerialized &&
942
+ getModule ().getSwiftModule ()->serializePackageEnabled () &&
943
+ getModule ().getSwiftModule ()->isResilient () &&
944
+ hasPublicOrPackageVisibility (getLinkage (), true );
945
+ // If Package-CMO is enabled, we serialize package, public,
946
+ // and @usableFromInline decls as [serialized_for_package].
947
+ // They must not, however, leak into @inlinable functions
948
+ // outside of their defining module that are [serialized].
949
+ // If this callee is [serialized_for_package], the caller
950
+ // must be either non-serialized or [serialized_for_package]
955
951
// for this callee to be inlined into the caller.
956
952
case IsSerializedForPackage:
957
953
return callerSerializedKind.has_value () &&
0 commit comments