diagnostics/libcpp: convert enum location_aspect to enum class

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>
This commit is contained in:
David Malcolm
2025-09-18 16:07:04 -04:00
parent 60d7488008
commit 21fe45f111
6 changed files with 36 additions and 35 deletions

View File

@@ -1459,11 +1459,11 @@ void line_table_dump (FILE *, const line_maps *,
/* 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.

View File

@@ -2326,7 +2326,7 @@ rich_location::get_expanded_location (unsigned int idx) const
{
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;
@@ -2336,7 +2336,7 @@ rich_location::get_expanded_location (unsigned int idx) const
}
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
@@ -2611,11 +2611,11 @@ rich_location::maybe_add_fixit (location_t start,
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)
{
@@ -2717,7 +2717,7 @@ fixit_hint::affects_line_p (const line_maps *set,
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)
@@ -2725,7 +2725,7 @@ fixit_hint::affects_line_p (const line_maps *set,
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)