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

River Riddle llvmlistbot at llvm.org
Mon Apr 7 11:38:00 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();
+  }
----------------
River707 wrote:

```suggestion
  if (failed(p.parseInteger(value)))
    return failure();
```

LLVM style elides trivial braces

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


More information about the Mlir-commits mailing list