[PATCH] D66026: Make circular_raw_ostream delegate is_displayed to contained stream

Troy Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 13:17:39 PDT 2019


troyj created this revision.
troyj added a reviewer: greened.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

raw_ostream has an is_displayed() member function that determines if the stream is connected to a console for display or is connected to a file/pipe.  By default, is_displayed() return false, and derived classes like raw_fd_ostream override it.  Because circular_raw_ostream wraps another stream, its result for is_displayed() should be the same as that stream.


https://reviews.llvm.org/D66026

Files:
  llvm/include/llvm/Support/circular_raw_ostream.h


Index: llvm/include/llvm/Support/circular_raw_ostream.h
===================================================================
--- llvm/include/llvm/Support/circular_raw_ostream.h
+++ llvm/include/llvm/Support/circular_raw_ostream.h
@@ -122,6 +122,10 @@
       delete[] BufferArray;
     }
 
+    bool is_displayed() const override {
+      return TheStream->is_displayed();
+    }
+
     /// setStream - Tell the circular_raw_ostream to output a
     /// different stream.  "Owns" tells circular_raw_ostream whether
     /// it should take responsibility for managing the underlying


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66026.214432.patch
Type: text/x-patch
Size: 581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190809/2585ca06/attachment.bin>


More information about the llvm-commits mailing list