=?utf-8?q?José?= L. Junior <jljunio...@gmail.com>, =?utf-8?q?José?= L. Junior <jljunio...@gmail.com>, =?utf-8?q?José?= L. Junior <jljunio...@gmail.com> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/76...@github.com>
================ @@ -72,23 +72,21 @@ 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<Information> pattern_info) { + // Only apply color formatting when the pattern information is specified. + // Otherwise, output the text without color formatting. + if (!pattern_info.has_value()) { PutCString(text); return; } - llvm::Regex reg_pattern(pattern); + llvm::Regex reg_pattern(pattern_info.value().pattern); ---------------- DavidSpickett wrote: This isn't wrong but you can instead do: ``` pattern_info->pattern ``` Pointer like operations on optionals accessed the contained value. https://github.com/llvm/llvm-project/pull/76112 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits