Skip to content

Commit ce4d762

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

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
@@ -581,9 +581,11 @@ static bool isSupportedClosure(const SILInstruction *Closure) {
581581
// This is a temporary limitation.
582582
auto ClosureCallee = FRI->getReferencedFunction();
583583
auto ClosureCalleeConv = ClosureCallee->getConventions();
584-
unsigned ClosureArgIdx =
584+
unsigned ClosureArgIdxBase =
585585
ClosureCalleeConv.getNumSILArguments() - PAI->getNumArguments();
586-
for (auto Arg : PAI->getArguments()) {
586+
for (auto pair : llvm::enumerate(PAI->getArguments())) {
587+
auto Arg = pair.value();
588+
auto ClosureArgIdx = pair.index() + ClosureArgIdxBase;
587589
SILType ArgTy = Arg->getType();
588590
// If our argument is an object, continue...
589591
if (ArgTy.isObject()) {

0 commit comments

Comments
 (0)