diff options
author | Jeff Niu <jeff@modular.com> | 2022-09-29 13:45:44 -0700 |
---|---|---|
committer | Jeff Niu <jeff@modular.com> | 2022-09-29 15:58:37 -0700 |
commit | 5e82120e6815bb7aa2af095f056b0c18bfd314d7 (patch) | |
tree | c1fad014893ad3a645fbca8542a54fc7ff868771 | |
parent | 3840e960bafc175c830963f8250d90339fac0d16 (diff) | |
download | llvm-project-5e82120e6815bb7aa2af095f056b0c18bfd314d7.tar.gz |
[mlir] Use `interleave` in `printOperands` (NFC)
Instead of reimplementing it.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D134904
-rw-r--r-- | mlir/include/mlir/IR/OpImplementation.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h index fcfd2f57cf91..78843accdf45 100644 --- a/mlir/include/mlir/IR/OpImplementation.h +++ b/mlir/include/mlir/IR/OpImplementation.h @@ -356,13 +356,8 @@ public: /// Print a comma separated list of operands. template <typename IteratorType> void printOperands(IteratorType it, IteratorType end) { - if (it == end) - return; - printOperand(*it); - for (++it; it != end; ++it) { - getStream() << ", "; - printOperand(*it); - } + llvm::interleaveComma(llvm::make_range(it, end), getStream(), + [this](Value value) { printOperand(value); }); } /// Print the given successor. |