[mlir-opt] Don't enable `printOpOnDiagnostic` if it was explicitly disabled.
authorRiver Riddle <riddleriver@gmail.com>
Mon, 24 May 2021 22:56:22 +0000 (15:56 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Mon, 24 May 2021 22:56:48 +0000 (15:56 -0700)
We are currently explicitly setting the flag solely based on the value of `-verify`, which ends up ignoring the situation where the user explicitly disabled this option from the command line.

Differential Revision: https://reviews.llvm.org/D102952

mlir/lib/Support/MlirOptMain.cpp

index 7c4930d..7f4b6e1 100644 (file)
@@ -109,7 +109,8 @@ static LogicalResult processBuffer(raw_ostream &os,
   if (preloadDialectsInContext)
     context.loadAllAvailableDialects();
   context.allowUnregisteredDialects(allowUnregisteredDialects);
-  context.printOpOnDiagnostic(!verifyDiagnostics);
+  if (verifyDiagnostics)
+    context.printOpOnDiagnostic(false);
   context.getDebugActionManager().registerActionHandler<DebugCounter>();
 
   // If we are in verify diagnostics mode then we have a lot of work to do,