[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu May 16 14:39:29 PDT 2024
JDevlieghere wrote:
The stream already knows whether color support is enabled, but it looks like we're only storing that in the underlying llvm stream, which is commonly used in combination with `WithColor`. I think we could add a member to check if the stream has colors enabled. It's already a property of `m_forwarder` so we don't need to create a new member.
```
SBStream::HasColor() {
return m_forwarded.has_color();
}
```
Alternatively, we could add a helper that does that under the hood.
```
SBStream::FormatAnsiTerminalCodes(llvm::StringRef format) {
if (m_forwarded.has_color())
print(FormatAnsiTerminalCodes(format));
}
```
So instead of having to write:
```
if(s->HasColor())
s->Printf("%s", ansi::FormatAnsiTerminalCodes("${ansi.faint}").c_str());
```
You can just write:
```
s-> FormatAnsiTerminalCodes("${ansi.faint}")
```
and have it do the right thing.
```
I think I understand Jim's concern. Most places that we use colors, we do that through `WithColor` which checks the color property of the underlying LLVM stream. Chelsea is not going through WithColor, so in her case she would indeed need to check
https://github.com/llvm/llvm-project/pull/91404
More information about the lldb-commits
mailing list