diff --git a/mlir/include/mlir/IR/Value.h b/mlir/include/mlir/IR/Value.h index af58778a0a13..e72ace0920eb 100644 --- a/mlir/include/mlir/IR/Value.h +++ b/mlir/include/mlir/IR/Value.h @@ -243,10 +243,7 @@ protected: detail::ValueImpl *impl; }; -inline raw_ostream &operator<<(raw_ostream &os, Value value) { - value.print(os); - return os; -} +raw_ostream &operator<<(raw_ostream &os, Value value); //===----------------------------------------------------------------------===// // OpOperand diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp index b3242f838fc1..5e9f6e87dfe0 100644 --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -4142,8 +4142,13 @@ void Value::print(raw_ostream &os, AsmState &state) const { << "' at index: " << arg.getArgNumber(); } +raw_ostream &mlir::operator<<(raw_ostream &os, Value value) { + value.print(os, OpPrintingFlags().useLocalScope()); + return os; +} + void Value::dump() const { - print(llvm::errs()); + print(llvm::errs(), OpPrintingFlags().useLocalScope()); llvm::errs() << "\n"; }