Skip to content

Commit af40fcf

Browse files
committed
[silgen] Use early breaks in an if-else-if block instead of having a break at the end.
Just reducing indentation more.
1 parent 9570384 commit af40fcf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/SILGen/SILGenPattern.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,15 +2865,19 @@ void SILGenFunction::emitSwitchFallthrough(FallthroughStmt *S) {
28652865

28662866
if (value->getType().isAddressOnly(M)) {
28672867
context->Emission.emitAddressOnlyInitialization(expected, value);
2868-
} else if (var.getSecond().box) {
2868+
break;
2869+
}
2870+
2871+
if (var.getSecond().box) {
28692872
auto &lowering = getTypeLowering(value->getType());
28702873
auto argValue = lowering.emitLoad(B, CurrentSILLoc, value,
28712874
LoadOwnershipQualifier::Copy);
28722875
args.push_back(argValue);
2873-
} else {
2874-
auto argValue = B.emitCopyValueOperation(CurrentSILLoc, value);
2875-
args.push_back(argValue);
2876+
break;
28762877
}
2878+
2879+
auto argValue = B.emitCopyValueOperation(CurrentSILLoc, value);
2880+
args.push_back(argValue);
28772881
break;
28782882
}
28792883
}

0 commit comments

Comments
 (0)