File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -5894,6 +5894,25 @@ This instruction is assumed to forward a fixed ownership (set upon its
5894
5894
construction) and lowers to 'unchecked_bitwise_cast' in non-ossa code. This
5895
5895
causes the cast to lose its guarantee of layout-compatibility.
5896
5896
5897
+ unchecked_ownership_conversion
5898
+ ``````````````````````````````
5899
+ ::
5900
+
5901
+ sil-instruction ::= 'unchecked_ownership_conversion' sil-operand ',' sil-value-ownership-kind 'to' sil-value-ownership-kind
5902
+
5903
+ %1 = unchecked_ownership_conversion %0 : $A, @guaranteed to @owned
5904
+
5905
+ Converts its operand to an identical value of the same type but with
5906
+ different ownership without performing any semantic operations
5907
+ normally required by for ownership conversion.
5908
+
5909
+ This is used in Objective-C compatible destructors to convert a
5910
+ guaranteed parameter to an owned parameter without performing a
5911
+ semantic copy.
5912
+
5913
+ The resulting value must meet the usual ownership requirements; for
5914
+ example, a trivial type must have '.none' ownership.
5915
+
5897
5916
ref_to_raw_pointer
5898
5917
``````````````````
5899
5918
::
Original file line number Diff line number Diff line change @@ -1958,6 +1958,17 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
1958
1958
" Inst with qualified ownership in a function that is not qualified" );
1959
1959
}
1960
1960
1961
+ void checkUncheckedOwnershipConversionInst (
1962
+ UncheckedOwnershipConversionInst *uoci) {
1963
+ require (
1964
+ F.hasOwnership (),
1965
+ " Inst with qualified ownership in a function that is not qualified" );
1966
+ require (!uoci->getType ().isAddress (),
1967
+ " cannot convert ownership of an address" );
1968
+ require (uoci->getType () == uoci->getOperand ()->getType (),
1969
+ " converting ownership does not affect the type" );
1970
+ }
1971
+
1961
1972
template <class AI >
1962
1973
void checkAccessEnforcement (AI *AccessInst) {
1963
1974
if (AccessInst->getModule ().getStage () != SILStage::Raw) {
You can’t perform that action at this time.
0 commit comments