File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -4901,6 +4901,9 @@ class ReferenceStorageType : public TypeBase {
4901
4901
}
4902
4902
}
4903
4903
4904
+ // / Is this storage type known to be loadable in the given resilience scope?
4905
+ bool isLoadable (ResilienceExpansion resilience) const ;
4906
+
4904
4907
// Implement isa/cast/dyncast/etc.
4905
4908
static bool classof (const TypeBase *T) {
4906
4909
return T->getKind () >= TypeKind::First_ReferenceStorageType &&
@@ -4929,10 +4932,6 @@ class UnownedStorageType : public ReferenceStorageType {
4929
4932
ReferenceStorageType::get (referent, ReferenceOwnership::Unowned, C));
4930
4933
}
4931
4934
4932
- // / Is this unowned storage type known to be loadable within the given
4933
- // / resilience scope?
4934
- bool isLoadable (ResilienceExpansion resilience) const ;
4935
-
4936
4935
// Implement isa/cast/dyncast/etc.
4937
4936
static bool classof (const TypeBase *T) {
4938
4937
return T->getKind () == TypeKind::UnownedStorage;
Original file line number Diff line number Diff line change @@ -4023,7 +4023,7 @@ bool Type::isPrivateStdlibType(bool treatNonBuiltinProtocolsAsPublic) const {
4023
4023
return false ;
4024
4024
}
4025
4025
4026
- bool UnownedStorageType ::isLoadable (ResilienceExpansion resilience) const {
4026
+ bool ReferenceStorageType ::isLoadable (ResilienceExpansion resilience) const {
4027
4027
return getReferentType ()->usesNativeReferenceCounting (resilience);
4028
4028
}
4029
4029
Original file line number Diff line number Diff line change @@ -3325,6 +3325,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
3325
3325
auto operandType = I->getOperand ()->getType ().getSwiftRValueType ();
3326
3326
auto resultType = requireObjectType (UnmanagedStorageType, I,
3327
3327
" Result of ref_to_unmanaged" );
3328
+ require (resultType->isLoadable (ResilienceExpansion::Maximal),
3329
+ " ref_to_unmanaged requires unowned type to be loadable" );
3328
3330
require (resultType.getReferentType () == operandType,
3329
3331
" Result of ref_to_unmanaged does not have the "
3330
3332
" operand's type as its referent type" );
@@ -3334,6 +3336,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
3334
3336
auto operandType = requireObjectType (UnmanagedStorageType,
3335
3337
I->getOperand (),
3336
3338
" Operand of unmanaged_to_ref" );
3339
+ require (operandType->isLoadable (ResilienceExpansion::Maximal),
3340
+ " unmanaged_to_ref requires unowned type to be loadable" );
3337
3341
requireReferenceStorageCapableValue (I, " Result of unmanaged_to_ref" );
3338
3342
auto resultType = I->getType ().getSwiftRValueType ();
3339
3343
require (operandType.getReferentType () == resultType,
You can’t perform that action at this time.
0 commit comments