diff --git a/mlir/include/mlir/CAPI/Utils.h b/mlir/include/mlir/CAPI/Utils.h --- a/mlir/include/mlir/CAPI/Utils.h +++ b/mlir/include/mlir/CAPI/Utils.h @@ -28,7 +28,8 @@ public: CallbackOstream(std::function callback, void *opaqueData) - : callback(callback), opaqueData(opaqueData), pos(0u) {} + : raw_ostream(/*unbuffered =*/true), callback(callback), + opaqueData(opaqueData), pos(0u) {} void write_impl(const char *ptr, size_t size) override { callback(ptr, size, opaqueData); diff --git a/mlir/lib/CAPI/IR/AffineExpr.cpp b/mlir/lib/CAPI/IR/AffineExpr.cpp --- a/mlir/lib/CAPI/IR/AffineExpr.cpp +++ b/mlir/lib/CAPI/IR/AffineExpr.cpp @@ -25,7 +25,6 @@ void *userData) { mlir::detail::CallbackOstream stream(callback, userData); unwrap(affineExpr).print(stream); - stream.flush(); } void mlirAffineExprDump(MlirAffineExpr affineExpr) { diff --git a/mlir/lib/CAPI/IR/AffineMap.cpp b/mlir/lib/CAPI/IR/AffineMap.cpp --- a/mlir/lib/CAPI/IR/AffineMap.cpp +++ b/mlir/lib/CAPI/IR/AffineMap.cpp @@ -29,7 +29,6 @@ void *userData) { mlir::detail::CallbackOstream stream(callback, userData); unwrap(affineMap).print(stream); - stream.flush(); } void mlirAffineMapDump(MlirAffineMap affineMap) { unwrap(affineMap).dump(); } diff --git a/mlir/lib/CAPI/IR/Diagnostics.cpp b/mlir/lib/CAPI/IR/Diagnostics.cpp --- a/mlir/lib/CAPI/IR/Diagnostics.cpp +++ b/mlir/lib/CAPI/IR/Diagnostics.cpp @@ -19,7 +19,6 @@ void *userData) { detail::CallbackOstream stream(callback, userData); unwrap(diagnostic).print(stream); - stream.flush(); } MlirLocation mlirDiagnosticGetLocation(MlirDiagnostic diagnostic) { diff --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp --- a/mlir/lib/CAPI/IR/IR.cpp +++ b/mlir/lib/CAPI/IR/IR.cpp @@ -126,7 +126,6 @@ void *userData) { detail::CallbackOstream stream(callback, userData); unwrap(location).print(stream); - stream.flush(); } /* ========================================================================== */ @@ -325,14 +324,12 @@ void *userData) { detail::CallbackOstream stream(callback, userData); unwrap(op)->print(stream); - stream.flush(); } void mlirOperationPrintWithFlags(MlirOperation op, MlirOpPrintingFlags flags, MlirStringCallback callback, void *userData) { detail::CallbackOstream stream(callback, userData); unwrap(op)->print(stream, *unwrap(flags)); - stream.flush(); } void mlirOperationDump(MlirOperation op) { return unwrap(op)->dump(); } @@ -476,7 +473,6 @@ void *userData) { detail::CallbackOstream stream(callback, userData); unwrap(block)->print(stream); - stream.flush(); } /* ========================================================================== */ @@ -523,7 +519,6 @@ void *userData) { detail::CallbackOstream stream(callback, userData); unwrap(value).print(stream); - stream.flush(); } /* ========================================================================== */ @@ -543,7 +538,6 @@ void mlirTypePrint(MlirType type, MlirStringCallback callback, void *userData) { detail::CallbackOstream stream(callback, userData); unwrap(type).print(stream); - stream.flush(); } void mlirTypeDump(MlirType type) { unwrap(type).dump(); } @@ -572,7 +566,6 @@ void *userData) { detail::CallbackOstream stream(callback, userData); unwrap(attr).print(stream); - stream.flush(); } void mlirAttributeDump(MlirAttribute attr) { unwrap(attr).dump(); }