[Support] json::OStream::flush(), which passes through to the underlying stream

llvm-svn: 359190
This commit is contained in:
Sam McCall 2019-04-25 13:33:18 +00:00
parent 98b0c910fb
commit 0fc09d0d25
1 changed files with 3 additions and 1 deletions

View File

@ -751,7 +751,6 @@ public:
class OStream { class OStream {
public: public:
using Block = llvm::function_ref<void()>; using Block = llvm::function_ref<void()>;
// OStream does not buffer internally, and need never be flushed or destroyed.
// If IndentSize is nonzero, output is pretty-printed. // If IndentSize is nonzero, output is pretty-printed.
explicit OStream(llvm::raw_ostream &OS, unsigned IndentSize = 0) explicit OStream(llvm::raw_ostream &OS, unsigned IndentSize = 0)
: OS(OS), IndentSize(IndentSize) { : OS(OS), IndentSize(IndentSize) {
@ -763,6 +762,9 @@ class OStream {
assert(Stack.back().HasValue && "Did not write top-level value"); assert(Stack.back().HasValue && "Did not write top-level value");
} }
/// Flushes the underlying ostream. OStream does not buffer internally.
void flush() { OS.flush(); }
// High level functions to output a value. // High level functions to output a value.
// Valid at top-level (exactly once), in an attribute value (exactly once), // Valid at top-level (exactly once), in an attribute value (exactly once),
// or in an array (any number of times). // or in an array (any number of times).