================
@@ -72,23 +72,20 @@ size_t Stream::PutCString(llvm::StringRef str) {
return bytes_written;
}
-void Stream::PutCStringColorHighlighted(llvm::StringRef text,
- llvm::StringRef pattern,
- llvm::StringRef prefix,
- llvm::StringRef suffix) {
- // Only apply color formatting when a pattern is present and both prefix and
- // suffix are specified. In the absence of these conditions, output the text
- // without color formatting.
- if (pattern.empty() || (prefix.empty() && suffix.empty())) {
+void Stream::PutCStringColorHighlighted(
+ llvm::StringRef text, std::optional<HighlightSettings> pattern_info) {
+ // Only apply color formatting when a pattern information is specified.
+ // Otherwise, output the text without color formatting.
----------------
DavidSpickett wrote:
To link back to my earlier comment, this early exit is fine and should stay.
I think, however, that it's best for callers to pass `nullopt` for the settings
if they want to disable highlighting. That's a much more intuitive way to do
it, backed up by the type system.
Which is what you're doing, so don't change anything! (just wanted to explain
my thinking here)
https://github.com/llvm/llvm-project/pull/76112
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits