summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2025-09-18 16:07:04 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2025-09-18 16:07:04 -0400
commit21fe45f111cf531c1a20cec837492d22addfa6c2 (patch)
treec3fc0aacc355306c9bf1291fce6ce87e78f3ba02 /libcpp
parent60d748800835fba95e1147d82755135035b9acbb (diff)
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>
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/include/line-map.h8
-rw-r--r--libcpp/line-map.cc12
2 files changed, 10 insertions, 10 deletions
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
index 21a59af2236..9bcf4d0c807 100644
--- a/libcpp/include/line-map.h
+++ b/libcpp/include/line-map.h
@@ -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.
diff --git a/libcpp/line-map.cc b/libcpp/line-map.cc
index 33701b519e1..2875bf2092b 100644
--- a/libcpp/line-map.cc
+++ b/libcpp/line-map.cc
@@ -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)