[Lldb-commits] [PATCH] D54072: Add a command to dump a module's clang ast.

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 4 16:40:56 PST 2018

zturner added a comment.

In https://reviews.llvm.org/D54072#1286811, @zturner wrote:

> So I tried to go down this route, but alas, I still can't come up with a good way to make color output work, because the Stream is not a `StreamFile` object, it is a `StreamString` object, even when the output is going to a terminal. We could have an argument such as `--color` but perhaps it should be the default and the option should be `--no-color`.

I tried some more, and yea this is really not easy.  The only `raw_ostream` in LLVM that supports color output is the `raw_fd_ostream`, so we can't even easily set up the forwarder to support any of this.  Even if we configure the diagnostics engine to use color output and pass it the forwarder `raw_ostream` it still won't work, because it will just call `raw_ostream::changeColor` which does nothing, since that method is only implemented on `raw_fd_ostream`.

I'm open to suggestions, but it would be a real shame to not be able to take advantage of the built-in colorization here.  Perhaps we can make this a hidden or unsupported command.


More information about the lldb-commits mailing list