[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 15 02:58:38 PST 2023


=?utf-8?q?José?= L. Junior <josejunior at 10xengineers.ai>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/69422 at github.com>


================
@@ -70,6 +72,32 @@ size_t Stream::PutCString(llvm::StringRef str) {
   return bytes_written;
 }
 
+void Stream::PutCStringColorHighlighted(llvm::StringRef text,
+                                        const char *pattern) {
+  if (!pattern) {
+    PutCString(text.data());
----------------
DavidSpickett wrote:

`size_t PutCString(llvm::StringRef cstr);` so you don't need the .data();

What likely happens is that .data gives you const char* and StringRef has a constructor from const char *, so it ends up back as a string ref.

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


More information about the lldb-commits mailing list