=?utf-8?q?José?= L. Junior <josejun...@10xengineers.ai>,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk>,taalhaataahir0102 <23100...@lums.edu.pk>, =?utf-8?q?José?= L. Junior <josejun...@10xengineers.ai> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/69...@github.com>
================ @@ -70,6 +72,31 @@ size_t Stream::PutCString(llvm::StringRef str) { return bytes_written; } +void Stream::PutCStringColorHighlighted(llvm::StringRef text, + const char *pattern) { + if (!pattern) { + PutCString(text); + return; + } + + // If pattern is not nullptr, we should use color + llvm::Regex reg_pattern(pattern); + llvm::SmallVector<llvm::StringRef, 1> matches; + llvm::StringRef remaining = text; + std::string format_str = lldb_private::ansi::FormatAnsiTerminalCodes( + "${ansi.fg.red}%.*s${ansi.normal}"); ---------------- DavidSpickett wrote: I assume if we have no target set we won't know whether to colour anything, so we'd default to no colours. Which means the prefix/suffix can default to empty string. Which is exactly what you've suggested. Worst case in some situation it doesn't highlight and if the user cares they can open an issue for it. I expect the SymbolContext can live without a target in some scenario, if you want to find out what, find somewhere in SymbolContext that null checks target, remove the check and see what tests fail. 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