================ @@ -1548,14 +1566,29 @@ static uint32_t LookupSymbolInModule(CommandInterpreter &interpreter, Symbol *symbol = symtab->SymbolAtIndex(match_indexes[i]); if (symbol) { if (symbol->ValueIsAddress()) { + // Using the new dump function to add colors in the summary. + if (name && use_color){ DumpAddress( + interpreter.GetExecutionContext().GetBestExecutionContextScope(), + symbol->GetAddressRef(), verbose, all_ranges, strm, name); + } + else{ + DumpAddress( interpreter.GetExecutionContext().GetBestExecutionContextScope(), symbol->GetAddressRef(), verbose, all_ranges, strm); + } ---------------- DavidSpickett wrote:
This can be simplified to: ``` DumpAddress( interpreter.GetExecutionContext().GetBestExecutionContextScope(), symbol->GetAddressRef(), verbose, all_ranges, strm, name && use_color ? name : nullptr); ``` If you haven't seen it before, the "in line if" is called the "ternary operator". https://www.w3schools.com/cpp/cpp_conditions_shorthand.asp What you could even do is very early in the function say "if no colour, set name to nullptr". Then any subsequent call using `name`, can just be passed `name` not `name && use_color ? name : nullptr`. ``` // If color is disabled, we have no use for the search pattern. name = use_color && name ? name : nullptr; ``` 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