From: Sam McCall Date: Thu, 25 Apr 2019 13:33:18 +0000 (+0000) Subject: [Support] json::OStream::flush(), which passes through to the underlying stream X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cce940f6102202fa324fc19ee6f7427ad8860619;p=llvm [Support] json::OStream::flush(), which passes through to the underlying stream git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359190 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/JSON.h b/include/llvm/Support/JSON.h index ebda4e80f69..fb6a6d4e19a 100644 --- a/include/llvm/Support/JSON.h +++ b/include/llvm/Support/JSON.h @@ -751,7 +751,6 @@ public: class OStream { public: using Block = llvm::function_ref; - // OStream does not buffer internally, and need never be flushed or destroyed. // If IndentSize is nonzero, output is pretty-printed. explicit OStream(llvm::raw_ostream &OS, unsigned IndentSize = 0) : OS(OS), IndentSize(IndentSize) { @@ -763,6 +762,9 @@ class OStream { 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. // Valid at top-level (exactly once), in an attribute value (exactly once), // or in an array (any number of times).