================ @@ -403,9 +404,41 @@ bool Address::GetDescription(Stream &s, Target &target, return false; } +void Address::DumpName(Stream *strm, llvm::StringRef text, + const char *pattern) { + if (!pattern) { + strm->PutCString(text.data()); + return; + } + + llvm::Regex reg_pattern(pattern); + llvm::SmallVector<llvm::StringRef, 1> matches; + llvm::StringRef remaining = text; + std::string red_start = + lldb_private::ansi::FormatAnsiTerminalCodes("${ansi.fg.red}"); + std::string reset_color = + lldb_private::ansi::FormatAnsiTerminalCodes("${ansi.normal}"); ---------------- DavidSpickett wrote:
I'm also wondering whether you could make this into a format string like: ``` lldb_private::ansi::FormatAnsiTerminalCodes("${ansi.fg.red}%s${ansi.normal}") ``` Then later use that with strm.printf like this: https://godbolt.org/z/zG6Tsn4WP Assuming that stream's Printf does support `.*` like that. Just saves you having to wrap the colour codes around the text each time and is a bit more obvious to the reader. https://github.com/llvm/llvm-project/pull/69422 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits