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

2018-11-05 Thread Zachary Turner via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL346149: Add a target modules dump ast command. (authored by zturner, committed by ). Herald added a subscriber: llvm-commi

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

2018-11-05 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment. I updated the patch to not dump color. We can address the color issue in a followup. So for now it just goes to the result object's output stream. Perhaps we can add a `-c` option that ignores the result object's outptu stream (and is documented as doing so), but I'l

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

2018-11-05 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment. If it comes down to choosing between colored output going to stderr and plain output going where it should, i'd go with the second option. The way I'd implement this to support both things is approximately this: - add color (`has_colors`, `changeColor` and friends) suppo

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

2018-11-04 Thread Zachary Turner via Phabricator via lldb-commits
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 o

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

2018-11-04 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment. 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 `-

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

2018-11-04 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment. Yeah it uses the color settings of the diagnostic engine which are probably set to false in LLDB. I think activating colors there should fix the issue. https://reviews.llvm.org/D54072 ___ lldb-commits mailing list lldb-co

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

2018-11-04 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment. I tried that one and it didn’t show color, bit maybe I need to add an overload of dumpColor that allows to pass a raw_ostream https://reviews.llvm.org/D54072 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://l

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

2018-11-04 Thread Zachary Turner via lldb-commits
I tried that one and it didn’t show color, bit maybe I need to add an overload of dumpColor that allows to pass a raw_ostream On Sun, Nov 4, 2018 at 6:25 AM Raphael Isemann via Phabricator < revi...@reviews.llvm.org> wrote: > teemperor added a comment. > > I think Pavel's point is to call the `dum

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

2018-11-04 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment. I think Pavel's point is to call the `dump` overload which allows specifying our own custom raw_ostream: https://clang.llvm.org/doxygen/classclang_1_1Decl.html#a278b3b87b6f9d3b20ed566a8684341a6 And our raw_ostream is configured by LLDB to correctly choose if we want c

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

2018-11-04 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment. The issue is that clang writes directly to stderr https://reviews.llvm.org/D54072 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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

2018-11-04 Thread Zachary Turner via lldb-commits
The issue is that clang writes directly to stderr On Sun, Nov 4, 2018 at 5:38 AM Pavel Labath via Phabricator < revi...@reviews.llvm.org> wrote: > labath added a comment. > > In https://reviews.llvm.org/D54072#1286748, @zturner wrote: > > > Unfortunately then color output is impossible. Where else

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

2018-11-04 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment. In https://reviews.llvm.org/D54072#1286748, @zturner wrote: > Unfortunately then color output is impossible. Where else would the output > be expected to go? If you execute the command over the SB API (SBCommandInterpreter::HandleCommand) then it will go into the provi

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

2018-11-04 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a subscriber: davide. zturner added a comment. Ok so probably this commands output will not go to a log file when logging is enabled? I can’t think of any other side effects. Given that the immediate use case for this is interactive investigation and testing, the first of which is h

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

2018-11-04 Thread Zachary Turner via lldb-commits
Ok so probably this commands output will not go to a log file when logging is enabled? I can’t think of any other side effects. Given that the immediate use case for this is interactive investigation and testing, the first of which is helped by color output and the second of which doesn’t need log

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

2018-11-04 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a subscriber: vsk. zturner added a comment. Unfortunately then color output is impossible. Where else would the output be expected to go? https://reviews.llvm.org/D54072 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://

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

2018-11-04 Thread Zachary Turner via lldb-commits
Unfortunately then color output is impossible. Where else would the output be expected to go? On Sun, Nov 4, 2018 at 2:23 AM Pavel Labath via Phabricator < revi...@reviews.llvm.org> wrote: > labath added inline comments. > > > > Comment at: lldb/source/Commands/CommandObjectTarget

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

2018-11-04 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments. Comment at: lldb/source/Commands/CommandObjectTarget.cpp:2275 +SymbolFile *sf = m->GetSymbolVendor()->GetSymbolFile(); +sf->DumpClangAST(); + } The dump function should take the output stream from the `result` ob

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

2018-11-03 Thread Zachary Turner via Phabricator via lldb-commits
zturner updated this revision to Diff 172510. zturner added a comment. clang dumps to stderr. Only use color if stderr supports this (e.g. if it's not redirected to a file). https://reviews.llvm.org/D54072 Files: lldb/include/lldb/Symbol/SymbolFile.h lldb/source/Commands/CommandObjectTarg

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

2018-11-03 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision. zturner added reviewers: vsk, davide, labath, jingham, aleksandr.urakov, clayborg. Herald added subscribers: JDevlieghere, aprantl. This can be useful when diagnosing AST related problems. For example, I had a bug where I was accidentally creating a record type mu