[Lldb-commits] [lldb] [lldb][TypeSystem] Enable colored AST dump (PR #86159)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 25 07:35:04 PDT 2024


Michael137 wrote:

> > > What happens if you have colors disabled in your terminal? Does this do nothing? Or does it start inserting ANSI escape codes in plain text?
> > 
> > 
> > Yea good question, was about to try this out. It does whatever clang's `ast-dump` would do if colors aren't turned off
> 
> That keys off of the output stream supporting colors, but LLDB also allows you to disable colors globally. Please also try `lldb --no-use-colors` and see if that behaves correctly (it might if we set the properties of the stream correctly). If it doesn't you'll need to read `debugger.GetUseColor()`.

It behaves correctly for the `target modules dump ast` case because that uses the LLDB streams, as you mentioned. For other diagnostics we would have to use the `GetUseColor` API, though we'd have to plumb the target through to `TypeSystemClang::CreateASTContext` first, to get access to the debugger object. Will try that instead

https://github.com/llvm/llvm-project/pull/86159


More information about the lldb-commits mailing list