@@ -8753,6 +8753,23 @@ SILFunction *ApplyInstBase<Impl, Base, false>::getCalleeFunction() const {
8753
8753
}
8754
8754
}
8755
8755
8756
+ class OwnershipForwardingMultipleValueInstruction
8757
+ : public MultipleValueInstruction {
8758
+ ValueOwnershipKind ownershipKind;
8759
+
8760
+ public:
8761
+ OwnershipForwardingMultipleValueInstruction (SILInstructionKind kind,
8762
+ SILDebugLocation loc,
8763
+ ValueOwnershipKind ownershipKind)
8764
+ : MultipleValueInstruction(kind, loc), ownershipKind(ownershipKind) {}
8765
+
8766
+ // / Returns the preferred ownership kind of this multiple value instruction.
8767
+ ValueOwnershipKind getOwnershipKind () const { return ownershipKind; }
8768
+ void setOwnershipKind (ValueOwnershipKind newOwnershipKind) {
8769
+ ownershipKind = newOwnershipKind;
8770
+ }
8771
+ };
8772
+
8756
8773
// / A result for the destructure_struct instruction. See documentation for
8757
8774
// / destructure_struct for more information.
8758
8775
class DestructureStructResult final : public MultipleValueInstructionResult {
@@ -8776,15 +8793,15 @@ class DestructureStructResult final : public MultipleValueInstructionResult {
8776
8793
// / struct's fields.
8777
8794
class DestructureStructInst final
8778
8795
: public UnaryInstructionBase<SILInstructionKind::DestructureStructInst,
8779
- MultipleValueInstruction >,
8780
- public MultipleValueInstructionTrailingObjects<
8781
- DestructureStructInst, DestructureStructResult> {
8796
+ OwnershipForwardingMultipleValueInstruction >,
8797
+ public MultipleValueInstructionTrailingObjects<DestructureStructInst,
8798
+ DestructureStructResult> {
8782
8799
friend TrailingObjects;
8783
8800
8784
8801
DestructureStructInst (SILModule &M, SILDebugLocation Loc, SILValue Operand,
8785
8802
ArrayRef<SILType> Types,
8786
8803
ArrayRef<ValueOwnershipKind> OwnershipKinds)
8787
- : UnaryInstructionBase(Loc, Operand),
8804
+ : UnaryInstructionBase(Loc, Operand, Operand.getOwnershipKind() ),
8788
8805
MultipleValueInstructionTrailingObjects (this , Types, OwnershipKinds) {}
8789
8806
8790
8807
public:
@@ -8825,15 +8842,15 @@ class DestructureTupleResult final : public MultipleValueInstructionResult {
8825
8842
// / tuples's elements.
8826
8843
class DestructureTupleInst final
8827
8844
: public UnaryInstructionBase<SILInstructionKind::DestructureTupleInst,
8828
- MultipleValueInstruction >,
8829
- public MultipleValueInstructionTrailingObjects<
8830
- DestructureTupleInst, DestructureTupleResult> {
8845
+ OwnershipForwardingMultipleValueInstruction >,
8846
+ public MultipleValueInstructionTrailingObjects<DestructureTupleInst,
8847
+ DestructureTupleResult> {
8831
8848
friend TrailingObjects;
8832
8849
8833
8850
DestructureTupleInst (SILModule &M, SILDebugLocation Loc, SILValue Operand,
8834
8851
ArrayRef<SILType> Types,
8835
8852
ArrayRef<ValueOwnershipKind> OwnershipKinds)
8836
- : UnaryInstructionBase(Loc, Operand),
8853
+ : UnaryInstructionBase(Loc, Operand, Operand.getOwnershipKind() ),
8837
8854
MultipleValueInstructionTrailingObjects (this , Types, OwnershipKinds) {}
8838
8855
8839
8856
public:
0 commit comments