[Lldb-commits] [lldb] [lldb] Remove redundant severity substring within a diagnostic message. (PR #76111)
Pete Lawrence via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 8 13:03:47 PST 2024
================
@@ -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:
Ok, you're suggestion is up @felipepiovezan.
Thanks again! 🙂
https://github.com/llvm/llvm-project/pull/76111
More information about the lldb-commits
mailing list