Skip to content

Commit 95f46ac

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

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/SILGen/SILGenDecl.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -832,22 +832,22 @@ class LetValueInitialization : public Initialization {
832832
ConsumableAndAssignable);
833833
}
834834

835-
// Otherwise, if we do not have a no implicit copy variable, just follow
836-
// the "normal path": perform a lexical borrow if the lifetime is lexical.
837-
if (!vd->isNoImplicitCopy()) {
838-
return SGF.B.createBeginBorrow(
835+
// If we have a no implicit copy lexical, emit the instruction stream so
836+
// that the move checker knows to check this variable.
837+
if (vd->isNoImplicitCopy()) {
838+
value = SGF.B.createMoveValue(PrologueLoc, value, /*IisLexical*/ true, /*hasPointerEscape=*/false, /*fromVarDecl=*/true);
839+
value = SGF.B.createOwnedCopyableToMoveOnlyWrapperValue(PrologueLoc, value);
840+
return SGF.B.createMarkUnresolvedNonCopyableValueInst(
839841
PrologueLoc, value,
840-
/*isLexical=*/SGF.F.getLifetime(vd, value->getType()).isLexical(),
841-
/*hasPointerEscape=*/false, /*fromVarDecl=*/true);
842+
MarkUnresolvedNonCopyableValueInst::CheckKind::ConsumableAndAssignable);
842843
}
843844

844-
// If we have a no implicit copy lexical, emit the instruction stream so
845-
// that the move checker knows to check this variable.
846-
value = SGF.B.createMoveValue(PrologueLoc, value, /*IisLexical*/ true, /*hasPointerEscape=*/false, /*fromVarDecl=*/true);
847-
value = SGF.B.createOwnedCopyableToMoveOnlyWrapperValue(PrologueLoc, value);
848-
return SGF.B.createMarkUnresolvedNonCopyableValueInst(
845+
// Otherwise, if we do not have a no implicit copy variable, just follow
846+
// the "normal path": perform a lexical borrow if the lifetime is lexical.
847+
return SGF.B.createBeginBorrow(
849848
PrologueLoc, value,
850-
MarkUnresolvedNonCopyableValueInst::CheckKind::ConsumableAndAssignable);
849+
/*isLexical=*/SGF.F.getLifetime(vd, value->getType()).isLexical(),
850+
/*hasPointerEscape=*/false, /*fromVarDecl=*/true);
851851
}
852852

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

0 commit comments

Comments
 (0)