Merge remote-tracking branch 'origin/main' into rebranch

This commit is contained in:
swift-ci
2022-06-15 21:34:18 -07:00
9 changed files with 63 additions and 34 deletions

View File

@@ -1257,11 +1257,11 @@ public:
/// Given that the value being abstracted is a move only type, return the
/// abstraction pattern with the move only bit removed.
AbstractionPattern withoutMoveOnly() const;
AbstractionPattern removingMoveOnlyWrapper() const;
/// Given that the value being abstracted is not a move only type, return the
/// abstraction pattern with the move only bit added.
AbstractionPattern withMoveOnly() const;
AbstractionPattern addingMoveOnlyWrapper() const;
/// Given that the value being abstracted is a tuple type, return
/// the abstraction pattern for its object type.

View File

@@ -1299,14 +1299,16 @@ public:
MoveOnlyWrapperToCopyableValueInst *
createOwnedMoveOnlyWrapperToCopyableValue(SILLocation loc, SILValue src) {
return insert(new (getModule()) MoveOnlyWrapperToCopyableValueInst(
*F, getSILDebugLocation(loc), src, OwnershipKind::Owned));
*F, getSILDebugLocation(loc), src,
MoveOnlyWrapperToCopyableValueInst::Owned));
}
MoveOnlyWrapperToCopyableValueInst *
createGuaranteedMoveOnlyWrapperToCopyableValue(SILLocation loc,
SILValue src) {
return insert(new (getModule()) MoveOnlyWrapperToCopyableValueInst(
*F, getSILDebugLocation(loc), src, OwnershipKind::Guaranteed));
*F, getSILDebugLocation(loc), src,
MoveOnlyWrapperToCopyableValueInst::Guaranteed));
}
UnconditionalCheckedCastInst *

View File

@@ -7627,19 +7627,29 @@ class CopyableToMoveOnlyWrapperValueInst
class MoveOnlyWrapperToCopyableValueInst
: public UnaryInstructionBase<
SILInstructionKind::MoveOnlyWrapperToCopyableValueInst,
SingleValueInstruction>,
public OwnershipForwardingMixin {
FirstArgOwnershipForwardingSingleValueInst> {
public:
enum InitialKind {
Guaranteed,
Owned,
};
private:
friend class SILBuilder;
InitialKind initialKind;
MoveOnlyWrapperToCopyableValueInst(const SILFunction &fn,
SILDebugLocation DebugLoc,
SILValue operand,
OwnershipKind forwardingOwnershipKind)
: UnaryInstructionBase(DebugLoc, operand,
operand->getType().removingMoveOnlyWrapper()),
OwnershipForwardingMixin(
SILInstructionKind::MoveOnlyWrapperToCopyableValueInst,
forwardingOwnershipKind) {}
SILValue operand, InitialKind kind)
: UnaryInstructionBase(
DebugLoc, operand, operand->getType().removingMoveOnlyWrapper(),
kind == InitialKind::Guaranteed ? OwnershipKind::Guaranteed
: OwnershipKind::Owned),
initialKind(kind) {}
public:
InitialKind getInitialKind() const { return initialKind; }
};
/// Given an object reference, return true iff it is non-nil and refers
@@ -9783,8 +9793,7 @@ inline bool OwnershipForwardingMixin::isa(SILInstructionKind kind) {
OwnershipForwardingConversionInst::classof(kind) ||
OwnershipForwardingSelectEnumInstBase::classof(kind) ||
OwnershipForwardingMultipleValueInstruction::classof(kind) ||
kind == SILInstructionKind::MarkMustCheckInst ||
kind == SILInstructionKind::MoveOnlyWrapperToCopyableValueInst;
kind == SILInstructionKind::MarkMustCheckInst;
}
inline OwnershipForwardingMixin *

View File

@@ -296,7 +296,7 @@ public:
IsInfiniteType_t isInfinite() const {
return IsInfiniteType_t((Flags & InfiniteFlag) != 0);
}
IsMoveOnly_t isMoveOnly() const {
IsMoveOnly_t isMoveOnlyWrapped() const {
return IsMoveOnly_t((Flags & MoveOnlyFlag) != 0);
}