Modernization; no functional change intended.
gcc/ChangeLog:
* diagnostics/paths-output.cc: Update for conversion of
location_aspect to enum class.
* diagnostics/source-printing.cc: Likewise.
* input.cc: Likewise.
* input.h: Likewise.
libcpp/ChangeLog:
* include/line-map.h (enum location_aspect): Convert to...
(enum class location_aspect): ...this.
* line-map.cc: Update for conversion of location_aspect to enum
class.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
const location_t prev_loc = prev_event->get_location ();
expanded_location prev_exploc
= linemap_client_expand_location_to_spelling_point
- (line_table, prev_loc, LOCATION_ASPECT_CARET);
+ (line_table, prev_loc, location_aspect::caret);
/* The destination in-edge's line number has to be <= the
source out-edge's line number (if any). */
if (prev_exploc.line >= m_line)
{
expanded_location exploc
= linemap_client_expand_location_to_spelling_point
- (line_table, initial_event.get_location (), LOCATION_ASPECT_CARET);
+ (line_table, initial_event.get_location (),
+ location_aspect::caret);
per_source_line_info &source_line_info
= get_per_source_line_info (exploc.line);
with respect to the link-printing code. */
expanded_location exploc
= linemap_client_expand_location_to_spelling_point
- (line_table, new_ev.get_location (), LOCATION_ASPECT_CARET);
+ (line_table, new_ev.get_location (), location_aspect::caret);
per_source_line_info &source_line_info
= get_per_source_line_info (exploc.line);
const event *prev_event = nullptr;
{
expanded_location exploc
= linemap_client_expand_location_to_spelling_point
- (line_table, initial_loc, LOCATION_ASPECT_CARET);
+ (line_table, initial_loc, location_aspect::caret);
if (exploc.file != LOCATION_FILE (dc.m_last_location))
{
diagnostics::location_print_policy loc_policy (text_output);
{
expanded_location exploc
= linemap_client_expand_location_to_spelling_point
- (line_table, initial_loc, LOCATION_ASPECT_CARET);
+ (line_table, initial_loc, location_aspect::caret);
if (exploc.file != LOCATION_FILE (dc.m_last_location))
{
diagnostics::location_print_policy loc_policy (dc);
{
/* m_display_col is now the final column of the byte.
If escaping has happened, we may want the first column instead. */
- if (aspect != LOCATION_ASPECT_FINISH)
+ if (aspect != location_aspect::finish)
{
expanded_location prev_exploc (exploc);
prev_exploc.column--;
= {"", end_line, end_col, nullptr, false};
return layout_range (exploc_with_display_col (fc,
start_exploc, def_policy (),
- LOCATION_ASPECT_START),
+ location_aspect::start),
exploc_with_display_col (fc,
finish_exploc, def_policy (),
- LOCATION_ASPECT_FINISH),
+ location_aspect::finish),
SHOW_RANGE_WITHOUT_CARET,
exploc_with_display_col (fc,
start_exploc, def_policy (),
- LOCATION_ASPECT_CARET),
+ location_aspect::caret),
0, nullptr);
}
m_primary_loc (richloc.get_range (0)->m_loc),
m_exploc (m_file_cache,
richloc.get_expanded_location (0), m_char_policy,
- LOCATION_ASPECT_CARET),
+ location_aspect::caret),
m_layout_ranges (richloc.get_num_locations ()),
m_fixit_hints (richloc.get_num_fixit_hints ()),
m_line_spans (1 + richloc.get_num_locations ()),
/* Expand the various locations. */
expanded_location start
= linemap_client_expand_location_to_spelling_point
- (m_line_table, src_range.m_start, LOCATION_ASPECT_START);
+ (m_line_table, src_range.m_start, location_aspect::start);
expanded_location finish
= linemap_client_expand_location_to_spelling_point
- (m_line_table, src_range.m_finish, LOCATION_ASPECT_FINISH);
+ (m_line_table, src_range.m_finish, location_aspect::finish);
expanded_location caret
= linemap_client_expand_location_to_spelling_point
- (m_line_table, loc_range->m_loc, LOCATION_ASPECT_CARET);
+ (m_line_table, loc_range->m_loc, location_aspect::caret);
/* If any part of the range isn't in the same file as the primary
location of this diagnostic, ignore the range. */
but it may require further sanitization. */
layout_range ri (exploc_with_display_col (m_file_cache,
start, m_char_policy,
- LOCATION_ASPECT_START),
+ location_aspect::start),
exploc_with_display_col (m_file_cache,
finish, m_char_policy,
- LOCATION_ASPECT_FINISH),
+ location_aspect::finish),
range_display_kind,
exploc_with_display_col (m_file_cache,
caret, m_char_policy,
- LOCATION_ASPECT_CARET),
+ location_aspect::caret),
original_idx, loc_range->m_label);
/* If we have a range that finishes before it starts (perhaps
default:
gcc_unreachable ();
/* Fall through. */
- case LOCATION_ASPECT_CARET:
+ case location_aspect::caret:
break;
- case LOCATION_ASPECT_START:
+ case location_aspect::start:
{
location_t start = get_start (loc);
if (start != loc)
return expand_location_1 (set, start, expansion_point_p, aspect);
}
break;
- case LOCATION_ASPECT_FINISH:
+ case location_aspect::finish:
{
location_t finish = get_finish (loc);
if (finish != loc)
location_t start, location_t end)
{
expanded_location expstart
- = expand_location_to_spelling_point (start, LOCATION_ASPECT_START);
+ = expand_location_to_spelling_point (start, location_aspect::start);
expanded_location expend
- = expand_location_to_spelling_point (end, LOCATION_ASPECT_FINISH);
+ = expand_location_to_spelling_point (end, location_aspect::finish);
/* If the locations are in different files or the end comes before the
start, give up and return nothing. */
expand_location (location_t loc)
{
return expand_location_1 (line_table, loc, /*expansion_point_p=*/true,
- LOCATION_ASPECT_CARET);
+ location_aspect::caret);
}
/* Expand the source location LOC into a human readable location. If
expanded_location start
= expand_location_to_spelling_point (src_range.m_start,
- LOCATION_ASPECT_START);
+ location_aspect::start);
expanded_location finish
= expand_location_to_spelling_point (src_range.m_finish,
- LOCATION_ASPECT_FINISH);
+ location_aspect::finish);
if (start.file != finish.file)
return "range endpoints are in different files";
if (start.line != finish.line)
extern expanded_location
expand_location_to_spelling_point (location_t,
enum location_aspect aspect
- = LOCATION_ASPECT_CARET);
+ = location_aspect::caret);
extern location_t expansion_point_location_if_in_system_header (location_t);
extern location_t expansion_point_location (location_t);
/* An enum for distinguishing the various parts within a location_t. */
-enum location_aspect
+enum class location_aspect
{
- LOCATION_ASPECT_CARET,
- LOCATION_ASPECT_START,
- LOCATION_ASPECT_FINISH
+ caret,
+ start,
+ finish
};
/* The rich_location class requires a way to expand location_t instances.
{
m_expanded_location
= linemap_client_expand_location_to_spelling_point
- (m_line_table, get_loc (0), LOCATION_ASPECT_CARET);
+ (m_line_table, get_loc (0), location_aspect::caret);
if (m_column_override)
m_expanded_location.column = m_column_override;
m_have_expanded_location = true;
}
else
return linemap_client_expand_location_to_spelling_point
- (m_line_table, get_loc (idx), LOCATION_ASPECT_CARET);
+ (m_line_table, get_loc (idx), location_aspect::caret);
}
/* Set the column of the primary location, with 0 meaning
expanded_location exploc_start
= linemap_client_expand_location_to_spelling_point (m_line_table,
start,
- LOCATION_ASPECT_START);
+ location_aspect::start);
expanded_location exploc_next_loc
= linemap_client_expand_location_to_spelling_point (m_line_table,
next_loc,
- LOCATION_ASPECT_START);
+ location_aspect::start);
/* They must be within the same file... */
if (exploc_start.file != exploc_next_loc.file)
{
expanded_location exploc_start
= linemap_client_expand_location_to_spelling_point (set,
m_start,
- LOCATION_ASPECT_START);
+ location_aspect::start);
if (file != exploc_start.file)
return false;
if (line < exploc_start.line)
expanded_location exploc_next_loc
= linemap_client_expand_location_to_spelling_point (set,
m_next_loc,
- LOCATION_ASPECT_START);
+ location_aspect::start);
if (file != exploc_next_loc.file)
return false;
if (line > exploc_next_loc.line)