[Mlir-commits] [mlir] [MLIR][DLTI] Pretty parsing and printing for DLTI attrs (PR #113365)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Oct 28 16:16:17 PDT 2024


================
@@ -28,6 +29,123 @@ using namespace mlir;
 
 #define DEBUG_TYPE "dlti"
 
+//===----------------------------------------------------------------------===//
+// parsing
+//===----------------------------------------------------------------------===//
+
+static ParseResult parseKeyValuePair(AsmParser &parser,
+                                     DataLayoutEntryInterface &entry,
+                                     bool tryType = false) {
+  Attribute value;
+
+  if (tryType) {
+    Type type;
+    OptionalParseResult parsedType = parser.parseOptionalType(type);
+    if (parsedType.has_value()) {
----------------
ftynse wrote:

I actually prefer the current style, it avoids potential confusion.

https://github.com/llvm/llvm-project/pull/113365


More information about the Mlir-commits mailing list