File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -132,23 +132,16 @@ void RenderDiagnosticDetails(Stream &stream,
132
132
stream << ' \n ' ;
133
133
134
134
// Reverse the order within groups of diagnostics that are on the same column.
135
- auto group = [](const std::vector<DiagnosticDetail> &details) {
136
- uint16_t column = 0 ;
137
- std::vector<DiagnosticDetail> result, group;
138
- for (auto &d : details) {
139
- if (d.source_location ->column == column) {
140
- group.push_back (d);
141
- continue ;
142
- }
143
- result.insert (result.end (), group.rbegin (), group.rend ());
144
- group.clear ();
145
- column = d.source_location ->column ;
146
- group.push_back (d);
135
+ auto group = [](std::vector<DiagnosticDetail> &details) {
136
+ for (auto it = details.begin (), end = details.end (); it != end;) {
137
+ auto eq_end = std::find_if (it, end, [&](const DiagnosticDetail &d) {
138
+ return d.source_location ->column != it->source_location ->column ;
139
+ });
140
+ std::reverse (it, eq_end);
141
+ it = eq_end;
147
142
}
148
- result.insert (result.end (), group.rbegin (), group.rend ());
149
- return result;
150
143
};
151
- remaining_details = group (remaining_details);
144
+ group (remaining_details);
152
145
153
146
// Work through each detail in reverse order using the vector/stack.
154
147
bool did_print = false ;
You can’t perform that action at this time.
0 commit comments