summaryrefslogtreecommitdiff
path: root/libcpp/line-map.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2017-07-31 14:43:24 +0200
committerMartin Jambor <mjambor@suse.cz>2017-07-31 14:43:24 +0200
commitb32f12dece884f1fa0f04c643a77105aff6ce8bc (patch)
treecdab5f10806561fc198f907299b0e55eb5701ef0 /libcpp/line-map.c
parent166bec868d991fdf71f9a66f994e5977fcab4aa2 (diff)
parenta168a775e93ec31ae743ad282d8e60fa1c116891 (diff)
downloadgcc-gcn.tar.gz
Merge branch 'master' into gcngcn
Diffstat (limited to 'libcpp/line-map.c')
-rw-r--r--libcpp/line-map.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 476a465efa0..0e5804b65bc 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -1440,21 +1440,23 @@ linemap_macro_loc_to_def_point (struct line_maps *set,
{
struct line_map *map;
- if (IS_ADHOC_LOC (location))
- location = set->location_adhoc_data_map.data[location
- & MAX_SOURCE_LOCATION].locus;
-
linemap_assert (set && location >= RESERVED_LOCATION_COUNT);
while (true)
{
- map = const_cast <line_map *> (linemap_lookup (set, location));
+ source_location caret_loc;
+ if (IS_ADHOC_LOC (location))
+ caret_loc = get_location_from_adhoc_loc (set, location);
+ else
+ caret_loc = location;
+
+ map = const_cast <line_map *> (linemap_lookup (set, caret_loc));
if (!linemap_macro_expansion_map_p (map))
break;
location =
linemap_macro_map_loc_to_def_point (linemap_check_macro (map),
- location);
+ caret_loc);
}
if (original_map)
@@ -2066,7 +2068,8 @@ rich_location::get_expanded_location (unsigned int idx)
if (!m_have_expanded_location)
{
m_expanded_location
- = linemap_client_expand_location_to_spelling_point (get_loc (0));
+ = linemap_client_expand_location_to_spelling_point
+ (get_loc (0), LOCATION_ASPECT_CARET);
if (m_column_override)
m_expanded_location.column = m_column_override;
m_have_expanded_location = true;
@@ -2075,7 +2078,8 @@ rich_location::get_expanded_location (unsigned int idx)
return m_expanded_location;
}
else
- return linemap_client_expand_location_to_spelling_point (get_loc (idx));
+ return linemap_client_expand_location_to_spelling_point
+ (get_loc (idx), LOCATION_ASPECT_CARET);
}
/* Set the column of the primary location, with 0 meaning
@@ -2331,9 +2335,11 @@ rich_location::maybe_add_fixit (source_location start,
/* Only allow fix-it hints that affect a single line in one file.
Compare the end-points. */
expanded_location exploc_start
- = linemap_client_expand_location_to_spelling_point (start);
+ = linemap_client_expand_location_to_spelling_point (start,
+ LOCATION_ASPECT_START);
expanded_location exploc_next_loc
- = linemap_client_expand_location_to_spelling_point (next_loc);
+ = linemap_client_expand_location_to_spelling_point (next_loc,
+ LOCATION_ASPECT_START);
/* They must be within the same file... */
if (exploc_start.file != exploc_next_loc.file)
{
@@ -2407,13 +2413,15 @@ bool
fixit_hint::affects_line_p (const char *file, int line) const
{
expanded_location exploc_start
- = linemap_client_expand_location_to_spelling_point (m_start);
+ = linemap_client_expand_location_to_spelling_point (m_start,
+ LOCATION_ASPECT_START);
if (file != exploc_start.file)
return false;
if (line < exploc_start.line)
return false;
expanded_location exploc_next_loc
- = linemap_client_expand_location_to_spelling_point (m_next_loc);
+ = linemap_client_expand_location_to_spelling_point (m_next_loc,
+ LOCATION_ASPECT_START);
if (file != exploc_next_loc.file)
return false;
if (line > exploc_next_loc.line)