================
@@ -1506,13 +1514,50 @@ static bool LookupAddressInModule(CommandInterpreter
&interpreter, Stream &strm,
ExecutionContextScope *exe_scope =
interpreter.GetExecutionContext().GetBestExecutionContextScope();
- DumpAddress(exe_scope, so_addr, verbose, all_ranges, strm);
+ DumpAddress(exe_scope, so_addr, verbose, all_ranges, strm, nullptr);
return true;
}
return false;
}
+//===========================================================================================
+
+// This function is the one which colorizes the regex symbol searched
+static void PrintRed(Stream &strm, const char *text, const char *name,
CommandInterpreter *interpreter= nullptr) {
+ if (!name) {
+ strm.PutCString(text);
+ return;
+ }
+
+ bool use_color = interpreter->GetDebugger().GetUseColor();
----------------
DavidSpickett wrote:
1. If we only need this one part of the CommandInterpreter, we should only be
passing that one thing down.
Try to find the earliest place you can to do the GetUseColor call, then
pass the result down to here.
2. You can combine that approach with one observation, that if `name` is
nullptr, this will never use colour regardless of the setting. Therefore
instead of having another parameter you could just set name to nullptr if
colours are disabled.
As in:
* No regex search - name is nullptr, colour setting is unused
* Regex search - name is not nullptr, colour setting must be read
So if early in the callstack you know that GetUseColor returns false, you could
just pass name=nullptr. No extra parameters needed. So it becomes something
like:
```
interpreter->GetDebugger().GetUseColor() ? name : nullptr;
```
https://github.com/llvm/llvm-project/pull/69422
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits