Skip to content

Commit 0b3aba4

Browse files
committed
[silgen] Eliminate another level of indentation by inverting an if condition in a for loop.
1 parent af40fcf commit 0b3aba4

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

lib/SILGen/SILGenPattern.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,27 +2859,29 @@ void SILGenFunction::emitSwitchFallthrough(FallthroughStmt *S) {
28592859
continue;
28602860
for (auto var : VarLocs) {
28612861
auto varDecl = dyn_cast<VarDecl>(var.getFirst());
2862-
if (varDecl && varDecl->hasName() &&
2863-
varDecl->getName() == expected->getName()) {
2864-
SILValue value = var.getSecond().value;
2862+
if (!varDecl || !varDecl->hasName() ||
2863+
varDecl->getName() != expected->getName()) {
2864+
continue;
2865+
}
28652866

2866-
if (value->getType().isAddressOnly(M)) {
2867-
context->Emission.emitAddressOnlyInitialization(expected, value);
2868-
break;
2869-
}
2867+
SILValue value = var.getSecond().value;
28702868

2871-
if (var.getSecond().box) {
2872-
auto &lowering = getTypeLowering(value->getType());
2873-
auto argValue = lowering.emitLoad(B, CurrentSILLoc, value,
2874-
LoadOwnershipQualifier::Copy);
2875-
args.push_back(argValue);
2876-
break;
2877-
}
2869+
if (value->getType().isAddressOnly(M)) {
2870+
context->Emission.emitAddressOnlyInitialization(expected, value);
2871+
break;
2872+
}
28782873

2879-
auto argValue = B.emitCopyValueOperation(CurrentSILLoc, value);
2874+
if (var.getSecond().box) {
2875+
auto &lowering = getTypeLowering(value->getType());
2876+
auto argValue = lowering.emitLoad(B, CurrentSILLoc, value,
2877+
LoadOwnershipQualifier::Copy);
28802878
args.push_back(argValue);
28812879
break;
28822880
}
2881+
2882+
auto argValue = B.emitCopyValueOperation(CurrentSILLoc, value);
2883+
args.push_back(argValue);
2884+
break;
28832885
}
28842886
}
28852887
Cleanups.emitBranchAndCleanups(sharedDest, S, args);

0 commit comments

Comments
 (0)