diff options
author | Lancelot Six <lancelot.six@amd.com> | 2023-10-13 10:17:02 +0000 |
---|---|---|
committer | Lancelot Six <lancelot.six@amd.com> | 2023-11-21 11:52:36 +0000 |
commit | 8082468ffe65095cdd640fb081b9d3d28dd7add4 (patch) | |
tree | 4e9ab5a6ad254f77e96e295d873a1d5b31cf44fa /gdb/xcoffread.c | |
parent | 42742fc5817a8f2e47c711880501073a9ad86cfc (diff) | |
download | gdb-8082468ffe65095cdd640fb081b9d3d28dd7add4.zip gdb-8082468ffe65095cdd640fb081b9d3d28dd7add4.tar.gz gdb-8082468ffe65095cdd640fb081b9d3d28dd7add4.tar.bz2 |
gdb: Use std::string_view instead of gdb::string_view
Given that GDB now requires a C++17, replace all uses of
gdb::string_view with std::string_view.
This change has mostly been done automatically:
- gdb::string_view -> std::string_view
- #include "gdbsupport/gdb_string_view.h" -> #include <string_view>
One things which got brought up during review is that gdb::stging_view
does support being built from "nullptr" while std::sting_view does not.
Two places are manually adjusted to account for this difference:
gdb/tui/tui-io.c:tui_getc_1 and
gdbsupport/format.h:format_piece::format_piece.
The above automatic change transformed
"gdb::to_string (const gdb::string_view &)" into
"gdb::to_string (const std::string_view &)". The various direct users
of this function are now explicitly including
"gdbsupport/gdb_string_view.h". A later patch will remove the users of
gdb::to_string.
The implementation and tests of gdb::string_view are unchanged, they will
be removed in a following patch.
Change-Id: Ibb806a7e9c79eb16a55c87c6e41ad396fecf0207
Approved-By: Tom Tromey <tom@tromey.com>
Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/xcoffread.c')
-rw-r--r-- | gdb/xcoffread.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index e6ecf2a..829fc1f 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2500,7 +2500,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, switch (p[1]) { case 'S': - pst->add_psymbol (gdb::string_view (namestring, + pst->add_psymbol (std::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_STATIC, SECT_OFF_DATA (objfile), @@ -2513,7 +2513,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, case 'G': /* The addresses in these entries are reported to be wrong. See the code that reads 'G's for symtabs. */ - pst->add_psymbol (gdb::string_view (namestring, + pst->add_psymbol (std::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_STATIC, SECT_OFF_DATA (objfile), @@ -2534,7 +2534,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, || (p == namestring + 1 && namestring[0] != ' ')) { - pst->add_psymbol (gdb::string_view (namestring, + pst->add_psymbol (std::string_view (namestring, p - namestring), true, STRUCT_DOMAIN, LOC_TYPEDEF, -1, psymbol_placement::STATIC, @@ -2544,7 +2544,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, if (p[2] == 't') { /* Also a typedef with the same name. */ - pst->add_psymbol (gdb::string_view (namestring, + pst->add_psymbol (std::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_TYPEDEF, -1, psymbol_placement::STATIC, @@ -2559,7 +2559,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, case 't': if (p != namestring) /* a name is there, not just :T... */ { - pst->add_psymbol (gdb::string_view (namestring, + pst->add_psymbol (std::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_TYPEDEF, -1, psymbol_placement::STATIC, @@ -2624,7 +2624,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, ; /* Note that the value doesn't matter for enum constants in psymtabs, just in symtabs. */ - pst->add_psymbol (gdb::string_view (p, q - p), true, + pst->add_psymbol (std::string_view (p, q - p), true, VAR_DOMAIN, LOC_CONST, -1, psymbol_placement::STATIC, unrelocated_addr (0), @@ -2644,7 +2644,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, case 'c': /* Constant, e.g. from "const" in Pascal. */ - pst->add_psymbol (gdb::string_view (namestring, + pst->add_psymbol (std::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_CONST, -1, psymbol_placement::STATIC, @@ -2659,7 +2659,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, std::string name (namestring, (p - namestring)); function_outside_compilation_unit_complaint (name.c_str ()); } - pst->add_psymbol (gdb::string_view (namestring, + pst->add_psymbol (std::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_BLOCK, SECT_OFF_TEXT (objfile), @@ -2686,7 +2686,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, if (startswith (namestring, "@FIX")) continue; - pst->add_psymbol (gdb::string_view (namestring, + pst->add_psymbol (std::string_view (namestring, p - namestring), true, VAR_DOMAIN, LOC_BLOCK, SECT_OFF_TEXT (objfile), |