diff options
author | David Malcolm <dmalcolm@redhat.com> | 2017-07-06 14:17:24 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2017-07-06 14:17:24 +0000 |
commit | c471c6edcbe945b8925f72fd7683caef884e5835 (patch) | |
tree | 3ff3a35cba1a15d75b13502857d21a4e5d17cb92 /gcc/genmatch.c | |
parent | 32aaf6ef10bf77d8300c0774dcc9bfcc8ed595c2 (diff) |
diagnostics: fix end-points of ranges within macros (PR c++/79300)
gcc/ChangeLog:
PR c++/79300
* diagnostic-show-locus.c (layout::layout): Use start and finish
spelling location for the start and finish of each range.
* genmatch.c (linemap_client_expand_location_to_spelling_point):
Add unused aspect param.
* input.c (expand_location_1): Add "aspect" param, and use it
to access the correct part of the location.
(expand_location): Pass LOCATION_ASPECT_CARET to new param of
expand_location_1.
(expand_location_to_spelling_point): Likewise.
(linemap_client_expand_location_to_spelling_point): Add "aspect"
param, and pass it to expand_location_1.
gcc/testsuite/ChangeLog:
PR c++/79300
* c-c++-common/Wmisleading-indentation-3.c (fn_14): Update
expected underlining within macro expansion.
* c-c++-common/pr70264.c: Likewise.
* g++.dg/plugin/diagnostic-test-expressions-1.C
(test_within_macro_1): New test.
(test_within_macro_2): Likewise.
(test_within_macro_3): Likewise.
(test_within_macro_4): Likewise.
* gcc.dg/format/diagnostic-ranges.c (test_macro_3): Update
expected underlining within macro expansion.
(test_macro_4): Likewise.
* gcc.dg/plugin/diagnostic-test-expressions-1.c
(test_within_macro_1): New test.
(test_within_macro_2): Likewise.
(test_within_macro_3): Likewise.
(test_within_macro_4): Likewise.
* gcc.dg/spellcheck-fields-2.c (test_macro): Update expected
underlining within macro expansion.
libcpp/ChangeLog:
PR c++/79300
* include/line-map.h (enum location_aspect): New enum.
(linemap_client_expand_location_to_spelling_point): Add
enum location_aspect param.
* line-map.c (rich_location::get_expanded_location): Update for
new param of linemap_client_expand_location_to_spelling_point.
(rich_location::maybe_add_fixit): Likewise.
(fixit_hint::affects_line_p): Likewise.
From-SVN: r250022
Diffstat (limited to 'gcc/genmatch.c')
-rw-r--r-- | gcc/genmatch.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/genmatch.c b/gcc/genmatch.c index f20e39f9158..7045bb9103c 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -61,7 +61,8 @@ static struct line_maps *line_table; This is the implementation for genmatch. */ expanded_location -linemap_client_expand_location_to_spelling_point (source_location loc) +linemap_client_expand_location_to_spelling_point (source_location loc, + enum location_aspect) { const struct line_map_ordinary *map; loc = linemap_resolve_location (line_table, loc, LRK_SPELLING_LOCATION, &map); |