[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup with a regex pattern (PR #69422)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 7 06:53:10 PST 2023
=?utf-8?q?José?= L. Junior <josejunior at 10xengineers.ai>,taalhaataahir0102
<23100293 at lums.edu.pk>,taalhaataahir0102 <23100293 at lums.edu.pk>,taalhaataahir0102
<23100293 at lums.edu.pk>,taalhaataahir0102 <23100293 at lums.edu.pk>,
=?utf-8?q?José?= L. Junior <josejunior at 10xengineers.ai>,
=?utf-8?q?José?= L. Junior <josejunior at 10xengineers.ai>,
=?utf-8?q?José?= L. Junior <josejunior at 10xengineers.ai>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/69422 at github.com>
DavidSpickett wrote:
> Is it better if I declared llvm::StringRef ansi_prefix and llvm::StringRef ansi_suffix outside the conditions even if they are not used?
As far as I can tell, that's how you must do it, or at least, one of the simpler ways.
You could do:
```
s->PutCStringColorHighlighted(symbol->GetName().GetStringRef(), pattern,
target_sp ? target_sp->GetDebugger().GetRegexMatchAnsiPrefix() : "",
target_sp ? target_sp->GetDebugger().GetRegexMatchAnsiSuffix() : "");
```
If you prefer. There's not much difference to it. One puts it all in a single call which is good because the scope of the values is limited. The other has 1 conditional instead of two.
Leave it as is. Sounds like you will end up refactoring it anyway.
https://github.com/llvm/llvm-project/pull/69422
More information about the lldb-commits
mailing list