Skip to content

Commit 38db63c

Browse files
committed
[NFC] ClosureSpecializer: Use llvm::enumerate.
Rather than manually tracking the index.
1 parent 2d70de8 commit 38db63c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/SILOptimizer/IPO/ClosureSpecializer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,11 @@ static bool isSupportedClosure(const SILInstruction *Closure) {
680680
// This is a temporary limitation.
681681
auto ClosureCallee = FRI->getReferencedFunction();
682682
auto ClosureCalleeConv = ClosureCallee->getConventions();
683-
unsigned ClosureArgIdx =
683+
unsigned ClosureArgIdxBase =
684684
ClosureCalleeConv.getNumSILArguments() - PAI->getNumArguments();
685-
for (auto Arg : PAI->getArguments()) {
685+
for (auto pair : llvm::enumerate(PAI->getArguments())) {
686+
auto Arg = pair.value();
687+
auto ClosureArgIdx = pair.index() + ClosureArgIdxBase;
686688
SILType ArgTy = Arg->getType();
687689
// If our argument is an object, continue...
688690
if (ArgTy.isObject()) {

0 commit comments

Comments
 (0)