From 6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b Mon Sep 17 00:00:00 2001 From: Lancelot Six Date: Fri, 13 Oct 2023 09:27:48 +0000 Subject: gdb: Replace gdb::optional with std::optional Since GDB now requires C++17, we don't need the internally maintained gdb::optional implementation. This patch does the following replacing: - gdb::optional -> std::optional - gdb::in_place -> std::in_place - #include "gdbsupport/gdb_optional.h" -> #include This change has mostly been done automatically. One exception is gdbsupport/thread-pool.* which did not use the gdb:: prefix as it already lives in the gdb namespace. Change-Id: I19a92fa03e89637bab136c72e34fd351524f65e9 Approved-By: Tom Tromey Approved-By: Pedro Alves --- gdb/gdbtypes.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'gdb/gdbtypes.c') diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index e424077..04598c6 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1045,7 +1045,7 @@ has_static_range (const struct range_bounds *bounds) /* See gdbtypes.h. */ -gdb::optional +std::optional get_discrete_low_bound (struct type *type) { type = check_typedef (type); @@ -1061,7 +1061,7 @@ get_discrete_low_bound (struct type *type) if (type->target_type ()->code () == TYPE_CODE_ENUM) { - gdb::optional low_pos + std::optional low_pos = discrete_position (type->target_type (), low); if (low_pos.has_value ()) @@ -1112,7 +1112,7 @@ get_discrete_low_bound (struct type *type) /* See gdbtypes.h. */ -gdb::optional +std::optional get_discrete_high_bound (struct type *type) { type = check_typedef (type); @@ -1128,7 +1128,7 @@ get_discrete_high_bound (struct type *type) if (type->target_type ()->code () == TYPE_CODE_ENUM) { - gdb::optional high_pos + std::optional high_pos = discrete_position (type->target_type (), high); if (high_pos.has_value ()) @@ -1191,11 +1191,11 @@ get_discrete_high_bound (struct type *type) bool get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) { - gdb::optional low = get_discrete_low_bound (type); + std::optional low = get_discrete_low_bound (type); if (!low.has_value ()) return false; - gdb::optional high = get_discrete_high_bound (type); + std::optional high = get_discrete_high_bound (type); if (!high.has_value ()) return false; @@ -1243,7 +1243,7 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound) in which case the value of POS is unmodified. */ -gdb::optional +std::optional discrete_position (struct type *type, LONGEST val) { if (type->code () == TYPE_CODE_RANGE) @@ -2534,7 +2534,7 @@ compute_variant_fields_inner (struct type *type, std::vector &flags) { /* Evaluate the discriminant. */ - gdb::optional discr_value; + std::optional discr_value; if (part.discriminant_index != -1) { int idx = part.discriminant_index; @@ -2757,7 +2757,7 @@ resolve_dynamic_type_internal (struct type *type, if (!is_dynamic_type_internal (real_type, top_level)) return type; - gdb::optional type_length; + std::optional type_length; prop = TYPE_DYNAMIC_LENGTH (type); if (prop != NULL && dwarf2_evaluate_property (prop, frame, addr_stack, &value)) -- cgit v1.1