[Mlir-commits] [mlir] [MLIR] Add a OpWithFlags class that acts as a "stream modifier" to customize Operation streaming (PR #150636)

Jacques Pienaar llvmlistbot at llvm.org
Fri Jul 25 11:00:00 PDT 2025


================
@@ -1102,6 +1102,29 @@ inline raw_ostream &operator<<(raw_ostream &os, const Operation &op) {
   return os;
 }
 
+/// A wrapper class that allows for printing an operation with a set of flags,
+/// useful to act as a "stream modifier" to customize printing an operation
+/// with a stream using the operator<< overload, e.g.:
+///   llvm::dbgs() << OpWithFlags(op, OpPrintingFlags().skipRegions());
+class OpWithFlags {
----------------
jpienaar wrote:

This is a bit more verbose than helpers like printSkipRegions but less duplication. So probably better tradeoff.

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


More information about the Mlir-commits mailing list