[Mlir-commits] [mlir] [mlir] add optional type functor to call and function interfaces (PR #146979)

River Riddle llvmlistbot at llvm.org
Wed Jul 9 09:32:26 PDT 2025


================
@@ -463,10 +463,11 @@ class OpAsmPrinter : public AsmPrinter {
   /// where location printing is controlled by the standard internal option.
   /// You may pass omitType=true to not print a type, and pass an empty
   /// attribute list if you don't care for attributes.
-  virtual void printRegionArgument(BlockArgument arg,
-                                   ArrayRef<NamedAttribute> argAttrs = {},
-                                   bool omitType = false) = 0;
-
+  /// You can override default type printing behavior with the typePrinter arg.
+  virtual void printRegionArgument(
+      BlockArgument arg, ArrayRef<NamedAttribute> argAttrs = {},
+      bool omitType = false,
+      function_ref<void(OpAsmPrinter &, Type)> typePrinter = nullptr) = 0;
----------------
River707 wrote:

```suggestion
      function_ref<void(OpAsmPrinter &, Type)> typePrinter = {}) = 0;
```

Please use {} as a better default value for function_ref, applies throughout.

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


More information about the Mlir-commits mailing list