|
35 | 35 | #include "llvm/ADT/STLExtras.h" |
36 | 36 | #include "llvm/ADT/StringExtras.h" |
37 | 37 | #include "llvm/ADT/TypeSwitch.h" |
| 38 | +#include "llvm/Support/InterleavedRange.h" |
38 | 39 | #include <cassert> |
39 | 40 | #include <numeric> |
40 | 41 | #include <optional> |
@@ -807,10 +808,8 @@ void spirv::EntryPointOp::print(OpAsmPrinter &printer) { |
807 | 808 | printer << " \"" << stringifyExecutionModel(getExecutionModel()) << "\" "; |
808 | 809 | printer.printSymbolName(getFn()); |
809 | 810 | auto interfaceVars = getInterface().getValue(); |
810 | | - if (!interfaceVars.empty()) { |
811 | | - printer << ", "; |
812 | | - llvm::interleaveComma(interfaceVars, printer); |
813 | | - } |
| 811 | + if (!interfaceVars.empty()) |
| 812 | + printer << ", " << llvm::interleaved(interfaceVars); |
814 | 813 | } |
815 | 814 |
|
816 | 815 | LogicalResult spirv::EntryPointOp::verify() { |
@@ -862,13 +861,9 @@ void spirv::ExecutionModeOp::print(OpAsmPrinter &printer) { |
862 | 861 | printer << " "; |
863 | 862 | printer.printSymbolName(getFn()); |
864 | 863 | printer << " \"" << stringifyExecutionMode(getExecutionMode()) << "\""; |
865 | | - auto values = this->getValues(); |
866 | | - if (values.empty()) |
867 | | - return; |
868 | | - printer << ", "; |
869 | | - llvm::interleaveComma(values, printer, [&](Attribute a) { |
870 | | - printer << llvm::cast<IntegerAttr>(a).getInt(); |
871 | | - }); |
| 864 | + ArrayAttr values = this->getValues(); |
| 865 | + if (!values.empty()) |
| 866 | + printer << ", " << llvm::interleaved(values.getAsValueRange<IntegerAttr>()); |
872 | 867 | } |
873 | 868 |
|
874 | 869 | //===----------------------------------------------------------------------===// |
@@ -1824,13 +1819,8 @@ ParseResult spirv::SpecConstantCompositeOp::parse(OpAsmParser &parser, |
1824 | 1819 | void spirv::SpecConstantCompositeOp::print(OpAsmPrinter &printer) { |
1825 | 1820 | printer << " "; |
1826 | 1821 | printer.printSymbolName(getSymName()); |
1827 | | - printer << " ("; |
1828 | | - auto constituents = this->getConstituents().getValue(); |
1829 | | - |
1830 | | - if (!constituents.empty()) |
1831 | | - llvm::interleaveComma(constituents, printer); |
1832 | | - |
1833 | | - printer << ") : " << getType(); |
| 1822 | + printer << " (" << llvm::interleaved(this->getConstituents().getValue()) |
| 1823 | + << ") : " << getType(); |
1834 | 1824 | } |
1835 | 1825 |
|
1836 | 1826 | LogicalResult spirv::SpecConstantCompositeOp::verify() { |
|
0 commit comments