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/dwarf2 | |
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/dwarf2')
-rw-r--r-- | gdb/dwarf2/attribute.h | 2 | ||||
-rw-r--r-- | gdb/dwarf2/cu.h | 8 | ||||
-rw-r--r-- | gdb/dwarf2/die.h | 4 | ||||
-rw-r--r-- | gdb/dwarf2/index-cache.h | 2 | ||||
-rw-r--r-- | gdb/dwarf2/index-write.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2/line-header.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2/macro.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2/macro.h | 2 | ||||
-rw-r--r-- | gdb/dwarf2/read-gdb-index.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 24 | ||||
-rw-r--r-- | gdb/dwarf2/read.h | 4 |
11 files changed, 31 insertions, 31 deletions
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h index 4cfdaa1..fdb579a 100644 --- a/gdb/dwarf2/attribute.h +++ b/gdb/dwarf2/attribute.h @@ -29,7 +29,7 @@ #include "dwarf2.h" #include "dwarf2/types.h" -#include "gdbsupport/gdb_optional.h" +#include <optional> /* Blocks are a bunch of untyped bytes. */ struct dwarf_block diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h index ef8db48..a8879de 100644 --- a/gdb/dwarf2/cu.h +++ b/gdb/dwarf2/cu.h @@ -22,7 +22,7 @@ #include "buildsym.h" #include "dwarf2/comp-unit-head.h" -#include "gdbsupport/gdb_optional.h" +#include <optional> #include "language.h" /* Type used for delaying computation of method physnames. @@ -101,7 +101,7 @@ struct dwarf2_cu struct comp_unit_head header; /* Base address of this compilation unit. */ - gdb::optional<unrelocated_addr> base_address; + std::optional<unrelocated_addr> base_address; /* The language we are debugging. */ const struct language_defn *language_defn = nullptr; @@ -189,7 +189,7 @@ public: /* The DW_AT_addr_base (DW_AT_GNU_addr_base) attribute if present. Note this value comes from the Fission stub CU/TU's DIE. */ - gdb::optional<ULONGEST> addr_base; + std::optional<ULONGEST> addr_base; /* The DW_AT_GNU_ranges_base attribute, if present. @@ -242,7 +242,7 @@ public: files, the value is implicitly zero. For DWARF 5 version DWO files, the value is often implicit and is the size of the header of .debug_str_offsets section (8 or 4, depending on the address size). */ - gdb::optional<ULONGEST> str_offsets_base; + std::optional<ULONGEST> str_offsets_base; /* Mark used when releasing cached dies. */ bool m_mark : 1; diff --git a/gdb/dwarf2/die.h b/gdb/dwarf2/die.h index cdee469..c704077 100644 --- a/gdb/dwarf2/die.h +++ b/gdb/dwarf2/die.h @@ -59,7 +59,7 @@ struct die_info /* Return the address base of the compile unit, which, if exists, is stored either at the attribute DW_AT_GNU_addr_base, or DW_AT_addr_base. */ - gdb::optional<ULONGEST> addr_base () + std::optional<ULONGEST> addr_base () { for (unsigned i = 0; i < num_attrs; ++i) if (attrs[i].name == DW_AT_addr_base @@ -73,7 +73,7 @@ struct die_info complaint (_("address base attribute (offset %s) as wrong form"), sect_offset_str (sect_off)); } - return gdb::optional<ULONGEST> (); + return std::optional<ULONGEST> (); } /* Return the base address of the compile unit into the .debug_ranges section, diff --git a/gdb/dwarf2/index-cache.h b/gdb/dwarf2/index-cache.h index cfa4543..023fc86 100644 --- a/gdb/dwarf2/index-cache.h +++ b/gdb/dwarf2/index-cache.h @@ -52,7 +52,7 @@ private: std::string build_id_str; /* Captured value of dwz build id. */ - gdb::optional<std::string> dwz_build_id_str; + std::optional<std::string> dwz_build_id_str; }; /* Class to manage the access to the DWARF index cache. */ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index c9d6e63..d1b10a2 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -1474,7 +1474,7 @@ struct index_wip_file FILENAME_TEMP is unlinked, because on MS-Windows one cannot delete a file that is still open. So, we wrap the unlinker in an optional and emplace it once we know the file name. */ - gdb::optional<gdb::unlinker> unlink_file; + std::optional<gdb::unlinker> unlink_file; gdb_file_up out_file; }; @@ -1497,7 +1497,7 @@ write_dwarf_index (dwarf2_per_bfd *per_bfd, const char *dir, ? INDEX5_SUFFIX : INDEX4_SUFFIX); index_wip_file objfile_index_wip (dir, basename, index_suffix); - gdb::optional<index_wip_file> dwz_index_wip; + std::optional<index_wip_file> dwz_index_wip; if (dwz_basename != NULL) dwz_index_wip.emplace (dir, dwz_basename, index_suffix); diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c index d072a91..ddaf7e4 100644 --- a/gdb/dwarf2/line-header.c +++ b/gdb/dwarf2/line-header.c @@ -160,8 +160,8 @@ read_formatted_entries (dwarf2_per_objfile *per_objfile, bfd *abfd, ULONGEST form = read_unsigned_leb128 (abfd, format, &bytes_read); format += bytes_read; - gdb::optional<const char *> string; - gdb::optional<unsigned int> uint; + std::optional<const char *> string; + std::optional<unsigned int> uint; switch (form) { diff --git a/gdb/dwarf2/macro.c b/gdb/dwarf2/macro.c index 78cce2d..2e88e67 100644 --- a/gdb/dwarf2/macro.c +++ b/gdb/dwarf2/macro.c @@ -444,7 +444,7 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile, unsigned int offset_size, struct dwarf2_section_info *str_section, struct dwarf2_section_info *str_offsets_section, - gdb::optional<ULONGEST> str_offsets_base, + std::optional<ULONGEST> str_offsets_base, htab_t include_hash, struct dwarf2_cu *cu) { struct objfile *objfile = per_objfile->objfile; @@ -805,7 +805,7 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile, const struct line_header *lh, unsigned int offset_size, unsigned int offset, struct dwarf2_section_info *str_section, struct dwarf2_section_info *str_offsets_section, - gdb::optional<ULONGEST> str_offsets_base, + std::optional<ULONGEST> str_offsets_base, int section_is_gnu, struct dwarf2_cu *cu) { bfd *abfd; diff --git a/gdb/dwarf2/macro.h b/gdb/dwarf2/macro.h index d92994f..7daf147 100644 --- a/gdb/dwarf2/macro.h +++ b/gdb/dwarf2/macro.h @@ -30,7 +30,7 @@ extern void dwarf_decode_macros (dwarf2_per_objfile *per_objfile, unsigned int offset, dwarf2_section_info *str_section, dwarf2_section_info *str_offsets_section, - gdb::optional<ULONGEST> str_offsets_base, + std::optional<ULONGEST> str_offsets_base, int section_is_gnu, struct dwarf2_cu *cu); #endif /* GDB_DWARF2_MACRO_H */ diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c index 064a9f1..7788626 100644 --- a/gdb/dwarf2/read-gdb-index.c +++ b/gdb/dwarf2/read-gdb-index.c @@ -181,7 +181,7 @@ struct dw2_symtab_iterator dwarf2_per_objfile *per_objfile; /* If set, only look for symbols that match that block. Valid values are GLOBAL_BLOCK and STATIC_BLOCK. */ - gdb::optional<block_enum> block_index; + std::optional<block_enum> block_index; /* The kind of symbol we're looking for. */ domain_enum domain; /* The list of CUs from the index entry of the symbol, @@ -203,7 +203,7 @@ struct dw2_symtab_iterator static void dw2_symtab_iter_init (struct dw2_symtab_iterator *iter, dwarf2_per_objfile *per_objfile, - gdb::optional<block_enum> block_index, + std::optional<block_enum> block_index, domain_enum domain, offset_type namei, mapped_gdb_index &index) { diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 2a7fd8f..6d86d28 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -78,7 +78,7 @@ #include "build-id.h" #include "namespace.h" #include "gdbsupport/function-view.h" -#include "gdbsupport/gdb_optional.h" +#include <optional> #include "gdbsupport/underlying.h" #include "gdbsupport/hash_enum.h" #include "filename-seen-cache.h" @@ -3916,7 +3916,7 @@ read_cutu_die_from_dwo (dwarf2_cu *cu, /* Return the signature of the compile unit, if found. In DWARF 4 and before, the signature is in the DW_AT_GNU_dwo_id attribute. In DWARF 5 and later, the signature is part of the header. */ -static gdb::optional<ULONGEST> +static std::optional<ULONGEST> lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die) { if (cu->header.version >= 5) @@ -3924,7 +3924,7 @@ lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die) struct attribute *attr; attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu); if (attr == nullptr || !attr->form_is_unsigned ()) - return gdb::optional<ULONGEST> (); + return std::optional<ULONGEST> (); return attr->as_unsigned (); } @@ -3957,7 +3957,7 @@ lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name) dwo_unit = lookup_dwo_type_unit (cu, dwo_name, comp_dir); else { - gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die); + std::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die); if (!signature.has_value ()) error (_("Dwarf Error: missing dwo_id for dwo_name %s" @@ -7829,7 +7829,7 @@ create_dwo_cu_reader (const struct die_reader_specs *reader, sect_offset sect_off = cu->per_cu->sect_off; struct dwarf2_section_info *section = cu->per_cu->section; - gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die); + std::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die); if (!signature.has_value ()) { complaint (_("Dwarf Error: debug entry at offset %s is missing" @@ -10633,7 +10633,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu, struct objfile *objfile = per_objfile->objfile; bfd *obfd = objfile->obfd.get (); /* Base address selection entry. */ - gdb::optional<unrelocated_addr> base; + std::optional<unrelocated_addr> base; const gdb_byte *buffer; bool overflow = false; ULONGEST addr_index; @@ -10839,7 +10839,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag, unsigned int addr_size = cu_header->addr_size; CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1)); /* Base address selection entry. */ - gdb::optional<unrelocated_addr> base; + std::optional<unrelocated_addr> base; unsigned int dummy; const gdb_byte *buffer; @@ -16070,8 +16070,8 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, bool is_declaration = false; sect_offset origin_offset {}; - gdb::optional<unrelocated_addr> low_pc; - gdb::optional<unrelocated_addr> high_pc; + std::optional<unrelocated_addr> low_pc; + std::optional<unrelocated_addr> high_pc; bool high_pc_relative = false; for (int i = 0; i < abbrev->num_attrs; ++i) @@ -17448,7 +17448,7 @@ dwarf2_per_objfile::read_line_string (const gdb_byte *buf, static unrelocated_addr read_addr_index_1 (dwarf2_per_objfile *per_objfile, unsigned int addr_index, - gdb::optional<ULONGEST> addr_base, int addr_size) + std::optional<ULONGEST> addr_base, int addr_size) { struct objfile *objfile = per_objfile->objfile; bfd *abfd = objfile->obfd.get (); @@ -17501,7 +17501,7 @@ dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu, unsigned int addr_index) { struct dwarf2_cu *cu = per_objfile->get_cu (per_cu); - gdb::optional<ULONGEST> addr_base; + std::optional<ULONGEST> addr_base; int addr_size; /* We need addr_base and addr_size. @@ -21270,7 +21270,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, struct dwarf2_section_info *str_offsets_section; struct dwarf2_section_info *str_section; - gdb::optional<ULONGEST> str_offsets_base; + std::optional<ULONGEST> str_offsets_base; if (cu->dwo_unit != nullptr) { diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index da90772..7bb6d4c 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -524,7 +524,7 @@ public: /* The shared '.dwz' file, if one exists. This is used when the original data was compressed using 'dwz -m'. */ - gdb::optional<std::unique_ptr<struct dwz_file>> dwz_file; + std::optional<std::unique_ptr<struct dwz_file>> dwz_file; /* Whether copy relocations are supported by this object format. */ bool can_copy; @@ -743,7 +743,7 @@ struct dwarf2_per_objfile dwarf2_cu *sym_cu = nullptr; /* CUs that are queued to be read. */ - gdb::optional<std::queue<dwarf2_queue_item>> queue; + std::optional<std::queue<dwarf2_queue_item>> queue; private: /* Hold the corresponding compunit_symtab for each CU or TU. This |