Skip to content

Commit 9dd96f9

Browse files
vporpoaaryanshukla
authored andcommitted
[SandboxIR][NFC] Refactor Function::dumpNameAndArgs()
1 parent 163e3da commit 9dd96f9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

llvm/lib/SandboxIR/SandboxIR.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,16 @@ void Constant::dump() const {
270270
void Function::dumpNameAndArgs(raw_ostream &OS) const {
271271
auto *F = cast<llvm::Function>(Val);
272272
OS << *F->getReturnType() << " @" << F->getName() << "(";
273-
auto NumArgs = F->arg_size();
274-
for (auto [Idx, Arg] : enumerate(F->args())) {
275-
auto *SBArg = cast_or_null<Argument>(Ctx.getValue(&Arg));
276-
if (SBArg == nullptr)
277-
OS << "NULL";
278-
else
279-
SBArg->printAsOperand(OS);
280-
if (Idx + 1 < NumArgs)
281-
OS << ", ";
282-
}
273+
interleave(
274+
F->args(),
275+
[this, &OS](const llvm::Argument &LLVMArg) {
276+
auto *SBArg = cast_or_null<Argument>(Ctx.getValue(&LLVMArg));
277+
if (SBArg == nullptr)
278+
OS << "NULL";
279+
else
280+
SBArg->printAsOperand(OS);
281+
},
282+
[this, &OS] { OS << ", "; });
283283
OS << ")";
284284
}
285285
void Function::dump(raw_ostream &OS) const {

0 commit comments

Comments
 (0)