[PATCH] D49260: [clangd] JSONTracer: flush after writing event

Simon Marchi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 12 11:26:48 PDT 2018


simark created this revision.
Herald added subscribers: cfe-commits, omtcyfz, jkorous, MaskRay, ioeric, ilya-biryukov.

Let's say I use "CLANGD_TRACE=/tmp/clangd.json" and "tail -F
/tmp/clangd.json", I'll often see unfinished lines, where the rest of
the data is still in clangd's output buffer.  Doing a flush in
rawEvent makes sure we can see all the data immediatly.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49260

Files:
  clangd/Trace.cpp


Index: clangd/Trace.cpp
===================================================================
--- clangd/Trace.cpp
+++ clangd/Trace.cpp
@@ -151,6 +151,7 @@
     Event["ph"] = Phase;
     Out << Sep << formatv(JSONFormat, json::Value(std::move(Event)));
     Sep = ",\n";
+    Out.flush();
   }
 
   // If we haven't already, emit metadata describing this thread.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49260.155233.patch
Type: text/x-patch
Size: 361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180712/9584a663/attachment.bin>


More information about the cfe-commits mailing list