=?utf-8?q?José?= L. Junior <[email protected]>,taalhaataahir0102
 <[email protected]>,taalhaataahir0102 
<[email protected]>,taalhaataahir0102
 <[email protected]>,taalhaataahir0102 <[email protected]>,
=?utf-8?q?José?= L. Junior <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>


================
@@ -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:

You might be able to get it from the exe_scope like this does:
```
bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
                   DumpStyle fallback_style, uint32_t addr_size,
                   bool all_ranges) const {
```
But you won't always have a target. Which is a bit odd because there'd always 
be a settings object somewhere, if only you could get to it.

Seems like symbolcontext can have a target or not, and methods that definitely 
need one have it as a parameter. So that's the other way to go, add a parameter 
for it.

https://github.com/llvm/llvm-project/pull/69422
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to