llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Adrian Prantl (adrian-prantl) <details> <summary>Changes</summary> Based on post-commit review feedback by Felipe Piovezan! --- Full diff: https://github.com/llvm/llvm-project/pull/116876.diff 1 Files Affected: - (modified) lldb/source/Utility/DiagnosticsRendering.cpp (+8-15) ``````````diff diff --git a/lldb/source/Utility/DiagnosticsRendering.cpp b/lldb/source/Utility/DiagnosticsRendering.cpp index a20d82ad4eb678..f5aa27baadfef8 100644 --- a/lldb/source/Utility/DiagnosticsRendering.cpp +++ b/lldb/source/Utility/DiagnosticsRendering.cpp @@ -132,23 +132,16 @@ void RenderDiagnosticDetails(Stream &stream, stream << '\n'; // Reverse the order within groups of diagnostics that are on the same column. - auto group = [](const std::vector<DiagnosticDetail> &details) { - uint16_t column = 0; - std::vector<DiagnosticDetail> result, group; - for (auto &d : details) { - if (d.source_location->column == column) { - group.push_back(d); - continue; - } - result.insert(result.end(), group.rbegin(), group.rend()); - group.clear(); - column = d.source_location->column; - group.push_back(d); + auto group = [](std::vector<DiagnosticDetail> &details) { + for (auto it = details.begin(), end = details.end(); it != end;) { + auto eq_end = std::find_if(it, end, [&](const DiagnosticDetail &d) { + return d.source_location->column != it->source_location->column; + }); + std::reverse(it, eq_end); + it = eq_end; } - result.insert(result.end(), group.rbegin(), group.rend()); - return result; }; - remaining_details = group(remaining_details); + group(remaining_details); // Work through each detail in reverse order using the vector/stack. bool did_print = false; `````````` </details> https://github.com/llvm/llvm-project/pull/116876 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits