diff options
author | Lancelot Six <lancelot.six@amd.com> | 2023-10-13 09:27:48 +0000 |
---|---|---|
committer | Lancelot Six <lancelot.six@amd.com> | 2023-11-21 11:52:35 +0000 |
commit | 6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b (patch) | |
tree | 07259601270022a6cbeb89826560262f015e1589 /gdb/gdbtypes.c | |
parent | 6b62451ad08056f0ba02e192ec34ef67c4294ef4 (diff) | |
download | gdb-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.zip gdb-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.gz gdb-6b09f1342cf2d8e2b13a0d634acc3bcf2852a73b.tar.bz2 |
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 <optional>
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 <tom@tromey.com>
Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r-- | gdb/gdbtypes.c | 18 |
1 files changed, 9 insertions, 9 deletions
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<LONGEST> +std::optional<LONGEST> 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<LONGEST> low_pos + std::optional<LONGEST> 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<LONGEST> +std::optional<LONGEST> 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<LONGEST> high_pos + std::optional<LONGEST> 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<LONGEST> low = get_discrete_low_bound (type); + std::optional<LONGEST> low = get_discrete_low_bound (type); if (!low.has_value ()) return false; - gdb::optional<LONGEST> high = get_discrete_high_bound (type); + std::optional<LONGEST> 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<LONGEST> +std::optional<LONGEST> 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<bool> &flags) { /* Evaluate the discriminant. */ - gdb::optional<ULONGEST> discr_value; + std::optional<ULONGEST> 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<CORE_ADDR> type_length; + std::optional<CORE_ADDR> type_length; prop = TYPE_DYNAMIC_LENGTH (type); if (prop != NULL && dwarf2_evaluate_property (prop, frame, addr_stack, &value)) |