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

Jorn Tuyls llvmlistbot at llvm.org
Wed Apr 9 07:41:44 PDT 2025


================
@@ -832,17 +871,24 @@ void DefFormat::genCommaSeparatedPrinter(
   // The first printed element does not need to emit a comma.
   os << "{\n";
   os.indent() << "bool _firstPrinted = true;\n";
-  for (ParameterElement *param : params) {
-    if (param->isOptional()) {
-      param->genPrintGuard(ctx, os << "if (") << ") {\n";
-      os.indent();
+  for (FormatElement *arg : args) {
+    ParameterElement *param = getStructParameterElement(arg);
+    if (param) {
----------------
jtuyls wrote:

Ok, this was called for the `custom` directive as well, so the assert was actually hit for a `RefDirective`, so I added that one as well and renamed `getStructParameterElement` to `getEncapsulatedParameterElement`.

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


More information about the Mlir-commits mailing list