junior-jl wrote:

In the last commit:

- Added the conditions `prefix.empty()` and `suffix.empty()` to the 'no color' 
path.
- Added missing arguments to `PutCStringColorHighlighted` call in 
`SymbolContext` (line 177).

I had to copy the same statements from line 99 here. Is it better if I declared 
`llvm::StringRef ansi_prefix` and `llvm::StringRef ansi_suffix` outside the 
conditions even if they are not used?

```cpp
      llvm::StringRef ansi_prefix;
      llvm::StringRef ansi_suffix;
      if (target_sp) {
        ansi_prefix = target_sp->GetDebugger().GetRegexMatchAnsiPrefix();
        ansi_suffix = target_sp->GetDebugger().GetRegexMatchAnsiSuffix();
      }
      s->PutCStringColorHighlighted(symbol->GetName().GetStringRef(), pattern,
                                    ansi_prefix, ansi_suffix);
```

Also, since these changes were approved, we opted to finalize this PR like it 
is now. Since we are creating another PR to do the same thing for function 
search, we are planning on refactoring this with an optional struct and 
`llvm::Regex` type as suggested. This change would also make this `if 
(pattern.empty() || prefix.empty() || suffix.empty())` prettier, I guess. Is 
that good?

I would also like to understand better the relation between SymbolContext and 
the target (or another way of getting Debugger properties).

https://github.com/llvm/llvm-project/pull/69422
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to