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

Sam McCall via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 06:33:19 PDT 2019


Author: sammccall
Date: Thu Apr 25 06:33:18 2019
New Revision: 359190

URL: http://llvm.org/viewvc/llvm-project?rev=359190&view=rev
Log:
[Support] json::OStream::flush(), which passes through to the underlying stream

Modified:
    llvm/trunk/include/llvm/Support/JSON.h

Modified: llvm/trunk/include/llvm/Support/JSON.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/JSON.h?rev=359190&r1=359189&r2=359190&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/JSON.h (original)
+++ llvm/trunk/include/llvm/Support/JSON.h Thu Apr 25 06:33:18 2019
@@ -751,7 +751,6 @@ public:
 class OStream {
  public:
   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.
   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).




More information about the llvm-commits mailing list