================ @@ -48,8 +48,17 @@ std::string DiagnosticManager::GetString(char separator) { std::string ret; for (const auto &diagnostic : Diagnostics()) { - ret.append(StringForSeverity(diagnostic->GetSeverity())); - ret.append(std::string(diagnostic->GetMessage())); + std::string message(diagnostic->GetMessage()); + std::string searchable_message(diagnostic->GetMessage().lower()); + std::string severity(StringForSeverity(diagnostic->GetSeverity())); + + // Erase the (first) redundant severity string in the message. + size_t position = searchable_message.find(severity); + if (position != std::string::npos) + message.erase(position, severity.length()); + + ret.append(severity); + ret.append(message); ---------------- PortalPete wrote:
I thought `StringRef` was better for strings that get passed around and reused and `std::string` is better for transient work, such as this. Is general, is there an advantage to using `StringRef` over `std::string`? https://github.com/llvm/llvm-project/pull/76111 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits