|
20 | 20 | #include "llvm/ADT/Twine.h" |
21 | 21 | #include "llvm/Support/SMLoc.h" |
22 | 22 | #include <optional> |
23 | | -#include <type_traits> |
24 | 23 |
|
25 | 24 | namespace { |
26 | 25 | // reference https://stackoverflow.com/a/16000226 |
@@ -204,57 +203,6 @@ class AsmPrinter { |
204 | 203 | *this << attrOrType; |
205 | 204 | } |
206 | 205 |
|
207 | | - /// Print the provided attribute or type ensuring that any dialect-specific |
208 | | - /// prefixes (e.g. `#dialect.mnemonic`) are retained. This is used in |
209 | | - /// contexts, such as structured property dictionaries, where the fully |
210 | | - /// qualified form is required for disambiguation. |
211 | | - template <typename AttrOrType, |
212 | | - std::enable_if_t<std::is_convertible_v<AttrOrType, Attribute>> * |
213 | | - sfinae = nullptr> |
214 | | - void printQualifiedAttrOrType(AttrOrType attrOrType) { |
215 | | - Attribute attr = attrOrType; |
216 | | - Dialect &dialect = attr.getDialect(); |
217 | | - StringRef dialectNamespace = dialect.getNamespace(); |
218 | | - if (dialectNamespace.empty() || dialectNamespace == "builtin") { |
219 | | - printStrippedAttrOrType(attrOrType); |
220 | | - return; |
221 | | - } |
222 | | - printAttribute(attr); |
223 | | - } |
224 | | - |
225 | | - template <typename AttrOrType, |
226 | | - std::enable_if_t<std::is_convertible_v<AttrOrType, Type> && |
227 | | - !std::is_convertible_v<AttrOrType, Attribute>> * |
228 | | - sfinae = nullptr> |
229 | | - void printQualifiedAttrOrType(AttrOrType attrOrType) { |
230 | | - Type type = attrOrType; |
231 | | - Dialect &dialect = type.getDialect(); |
232 | | - StringRef dialectNamespace = dialect.getNamespace(); |
233 | | - if (dialectNamespace.empty() || dialectNamespace == "builtin") { |
234 | | - printStrippedAttrOrType(attrOrType); |
235 | | - return; |
236 | | - } |
237 | | - printType(type); |
238 | | - } |
239 | | - |
240 | | - template <typename ElementT, |
241 | | - std::enable_if_t<std::is_convertible_v<ElementT, Attribute> || |
242 | | - std::is_convertible_v<ElementT, Type>> *sfinae = |
243 | | - nullptr> |
244 | | - void printQualifiedAttrOrType(ArrayRef<ElementT> attrOrTypes) { |
245 | | - llvm::interleaveComma(attrOrTypes, getStream(), [&](ElementT element) { |
246 | | - printQualifiedAttrOrType(element); |
247 | | - }); |
248 | | - } |
249 | | - |
250 | | - template <typename AttrOrType, |
251 | | - std::enable_if_t<!std::is_convertible_v<AttrOrType, Attribute> && |
252 | | - !std::is_convertible_v<AttrOrType, Type>> * |
253 | | - sfinae = nullptr> |
254 | | - void printQualifiedAttrOrType(AttrOrType attrOrType) { |
255 | | - *this << attrOrType; |
256 | | - } |
257 | | - |
258 | 206 | /// Print the given attribute without its type. The corresponding parser must |
259 | 207 | /// provide a valid type for the attribute. |
260 | 208 | virtual void printAttributeWithoutType(Attribute attr); |
|
0 commit comments