[Mlir-commits] [mlir] [mlir][tblgen] Add custom parsing and printing within struct (PR #133939)

Jorn Tuyls llvmlistbot at llvm.org
Mon Apr 7 14:10:47 PDT 2025


================
@@ -316,6 +316,33 @@ static ParseResult parseCustomFloatAttr(AsmParser &p, StringAttr &typeStrAttr,
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// TestCustomStructAttr
+//===----------------------------------------------------------------------===//
+
+static void printCustomStructAttr(AsmPrinter &p, int64_t value) {
+  p.printStrippedAttrOrType(value);
+}
+
+static ParseResult parseCustomStructAttr(AsmParser &p, int64_t &value) {
+  if (failed(p.parseInteger(value))) {
+    return failure();
+  }
+  return success();
+}
+
+static void printCustomOptStructFieldAttr(AsmPrinter &p, ArrayAttr attr) {
+  p.printStrippedAttrOrType(attr);
+}
+
+static ParseResult parseCustomOptStructFieldAttr(AsmParser &p,
+                                                 ArrayAttr &attr) {
+  if (failed(p.parseAttribute(attr))) {
+    return failure();
+  }
----------------
jtuyls wrote:

Yes, updated it.

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


More information about the Mlir-commits mailing list