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

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 6 07:33:50 PST 2023


================
@@ -403,9 +407,48 @@ bool Address::GetDescription(Stream &s, Target &target,
   return false;
 }
 
+//==================================================================================
+
+// Function to print the searched symbol in red color
+void Address::re_pattern(Stream *strm, const char *text, const char *name) {
----------------
DavidSpickett wrote:

We're moving away from PrintRed, that's good. I suggest you name this something like `DumpName` to fit the rest of the class style.

Then below in Address::dump all it has to do is call DumpName (and anyone calling Address:dump externally does the same).

One way to make sure this has been done is to make Address::re_pattern / Address::DumpName private. Then you'll get a compiler error if someone is calling it directly.

Also, the parameters are confusingly named now. What this function does it dump the name of the symbol but the name is passed as `text` and then there's the regex pattern as `name`. `text` is fine, but I think `name` should be `pattern` or `re_pattern`, whatever makes it clear to you that this is a pattern we will use to match things, not some plain text to dump.

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


More information about the lldb-commits mailing list