mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
BorrowToDestructureUtils: handle borrowing switches.
Instead of trying to convert all switches into consumes, allow a switch of a borrow to remain as such.
This commit is contained in:
@@ -488,10 +488,10 @@ void MoveOnlyObjectCheckerPImpl::check(DominanceInfo *domTree,
|
||||
|
||||
// Handle:
|
||||
//
|
||||
// bb0(%0 : @guaranteed $Type):
|
||||
// %1 = copy_value %0
|
||||
// %2 = mark_unresolved_non_copyable_value [no_consume_or_assign] %1
|
||||
if (auto *arg = dyn_cast<SILFunctionArgument>(i->getOperand(0))) {
|
||||
// bb(%arg : @guaranteed $Type):
|
||||
// %copy = copy_value %arg
|
||||
// %mark = mark_unresolved_non_copyable_value [no_consume_or_assign] %copy
|
||||
if (auto *arg = dyn_cast<SILArgument>(i->getOperand(0))) {
|
||||
if (arg->getOwnershipKind() == OwnershipKind::Guaranteed) {
|
||||
for (auto *use : markedInst->getConsumingUses()) {
|
||||
destroys.push_back(cast<DestroyValueInst>(use->getUser()));
|
||||
|
||||
Reference in New Issue
Block a user