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

Mehdi Amini llvmlistbot at llvm.org
Fri Jul 25 11:06:41 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 {
----------------
joker-eph wrote:

IMO: the benefit is mostly about not having to break chains of `<<` (and the ability to use LDBG)

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


More information about the Mlir-commits mailing list