Skip to content

Commit ed8dc59

Browse files
committed
[NFC] SILGen: Inverted control flow.
Used the main body of the function for the "normal" path.
1 parent a9079bc commit ed8dc59

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/SILGen/SILGenDecl.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -805,22 +805,22 @@ class LetValueInitialization : public Initialization {
805805
MarkMustCheckInst::CheckKind::ConsumableAndAssignable);
806806
}
807807

808-
// Otherwise, if we do not have a no implicit copy variable, just follow
809-
// the "normal path": perform a lexical borrow if the lifetime is lexical.
810-
if (!vd->isNoImplicitCopy()) {
811-
if (SGF.F.getLifetime(vd, value->getType()).isLexical())
812-
return SGF.B.createBeginBorrow(PrologueLoc, value, /*isLexical*/ true);
813-
else
814-
return value;
815-
}
816-
817808
// If we have a no implicit copy lexical, emit the instruction stream so
818809
// that the move checker knows to check this variable.
819-
value = SGF.B.createMoveValue(PrologueLoc, value, /*IisLexical*/ true);
820-
value = SGF.B.createOwnedCopyableToMoveOnlyWrapperValue(PrologueLoc, value);
821-
return SGF.B.createMarkMustCheckInst(
822-
PrologueLoc, value,
823-
MarkMustCheckInst::CheckKind::ConsumableAndAssignable);
810+
if (vd->isNoImplicitCopy()) {
811+
value = SGF.B.createMoveValue(PrologueLoc, value, /*IisLexical*/ true);
812+
value = SGF.B.createOwnedCopyableToMoveOnlyWrapperValue(PrologueLoc, value);
813+
return SGF.B.createMarkMustCheckInst(
814+
PrologueLoc, value,
815+
MarkMustCheckInst::CheckKind::ConsumableAndAssignable);
816+
}
817+
818+
// Otherwise, if we do not have a no implicit copy variable, just follow
819+
// the "normal path": perform a lexical borrow if the lifetime is lexical.
820+
if (SGF.F.getLifetime(vd, value->getType()).isLexical())
821+
return SGF.B.createBeginBorrow(PrologueLoc, value, /*isLexical*/ true);
822+
else
823+
return value;
824824
}
825825

826826
void bindValue(SILValue value, SILGenFunction &SGF, bool wasPlusOne,

0 commit comments

Comments
 (0)