diff options
author | David Malcolm <dmalcolm@redhat.com> | 2019-09-30 20:03:55 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2019-09-30 20:03:55 +0000 |
commit | 5a05b737e1b626f92ee968f6e32715bf955dae54 (patch) | |
tree | 714cd83c7f54b55c831205be869d3c3dd488b5e5 /gcc/go | |
parent | 2f00786128f190a4ad7a0819a84026cd8be19ad4 (diff) | |
download | gcc-5a05b737e1b626f92ee968f6e32715bf955dae54.zip gcc-5a05b737e1b626f92ee968f6e32715bf955dae54.tar.gz gcc-5a05b737e1b626f92ee968f6e32715bf955dae54.tar.bz2 |
diagnostic-show-locus.c: rework handling of multiple labels
This patch improves the handling of large numbers of labels within a
rich_location: previously, overlapping labels could lead to an assertion
failure within layout::print_any_labels. Also, the labels were printed
in reverse order of insertion into the rich_location.
This patch moves the determination of whether a vertical bar should
be printed for a line_label into the
'Figure out how many "label lines" we need, and which
one each label is printed in.'
step of layout::print_any_labels, rather than doing it as the lines
are printed. It also flips the sort order, so that labels at the
same line/column are printed in order of insertion into the
rich_location.
I haven't run into these issues with our existing diagnostics, but it
affects a patch kit I'm working on that makes more extensive use of
labels.
gcc/ChangeLog:
* diagnostic-show-locus.c (line_label::line_label): Initialize
m_has_vbar.
(line_label::comparator): Reverse the sort order by m_state_idx,
so that when the list is walked backwards the labels appear in
order of insertion into the rich_location.
(line_label::m_has_vbar): New field.
(layout::print_any_labels): When dealing with multiple labels at
the same line and column, only print vertical bars for the one
with the highest label_line.
(selftest::test_one_liner_labels): Update test for multiple labels
to expect the labels to be in the order of insertion into the
rich_location. Add a test for many such labels, where the column
numbers are out-of-order relative to the insertion order.
From-SVN: r276371
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions