Skip to content

Commit 24c9046

Browse files
committed
[NFC] SILGen: Invert control flow.
1 parent babf807 commit 24c9046

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

lib/SILGen/SILGenDecl.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -788,20 +788,20 @@ class LetValueInitialization : public Initialization {
788788
ConsumableAndAssignable);
789789
}
790790

791-
// Otherwise, if we don't have a no implicit copy trivial type, just
792-
// return value.
793-
if (!vd->isNoImplicitCopy() || !value->getType().isTrivial(SGF.F))
794-
return value;
791+
// If we have a no implicit copy trivial type, wrap it in the move only
792+
// wrapper and mark it as needing checking by the move checker.
793+
if (vd->isNoImplicitCopy() && value->getType().isTrivial(SGF.F)) {
794+
value =
795+
SGF.B.createOwnedCopyableToMoveOnlyWrapperValue(PrologueLoc, value);
796+
value = SGF.B.createMoveValue(PrologueLoc, value, IsLexical);
797+
return SGF.B.createMarkUnresolvedNonCopyableValueInst(
798+
PrologueLoc, value,
799+
MarkUnresolvedNonCopyableValueInst::CheckKind::
800+
ConsumableAndAssignable);
801+
}
795802

796-
// Otherwise, we have a no implicit copy trivial type, so wrap it in the
797-
// move only wrapper and mark it as needing checking by the move cherk.
798-
value =
799-
SGF.B.createOwnedCopyableToMoveOnlyWrapperValue(PrologueLoc, value);
800-
value = SGF.B.createMoveValue(PrologueLoc, value, IsLexical);
801-
return SGF.B.createMarkUnresolvedNonCopyableValueInst(
802-
PrologueLoc, value,
803-
MarkUnresolvedNonCopyableValueInst::CheckKind::
804-
ConsumableAndAssignable);
803+
804+
return value;
805805
}
806806

807807
// Otherwise, we need to perform some additional processing. First, if we

0 commit comments

Comments
 (0)