[Mlir-commits] [mlir] [mlir][tblgen] Add custom parsing and printing within struct (PR #133939)
Mehdi Amini
llvmlistbot at llvm.org
Tue Apr 22 04:15:47 PDT 2025
================
@@ -316,6 +316,27 @@ 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) {
+ return p.parseInteger(value);
+}
+
+static void printCustomOptStructFieldAttr(AsmPrinter &p, ArrayAttr attr) {
+ p.printStrippedAttrOrType(attr);
+}
+
+static ParseResult parseCustomOptStructFieldAttr(AsmParser &p,
+ ArrayAttr &attr) {
+ return p.parseAttribute(attr);
+}
----------------
joker-eph wrote:
Sure, but in general it makes more sense to me to demonstrate the feature in a useful way, for example with a customized keyword / token in the format.
https://github.com/llvm/llvm-project/pull/133939
More information about the Mlir-commits
mailing list