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>
This commit is contained in:
Lancelot Six
2023-10-13 10:17:02 +00:00
parent 42742fc581
commit 8082468ffe
31 changed files with 133 additions and 123 deletions

View File

@@ -96,6 +96,7 @@
#include "split-name.h"
#include "gdbsupport/parallel-for.h"
#include "gdbsupport/thread-pool.h"
#include "gdbsupport/gdb_string_view.h"
/* When == 1, print basic high level tracing messages.
When > 1, be more verbose.
@@ -16767,7 +16768,7 @@ cooked_index_functions::expand_symtabs_matching
for (enum language lang : unique_styles)
{
std::vector<gdb::string_view> name_vec
std::vector<std::string_view> name_vec
= lookup_name_without_params.split_name (lang);
std::string last_name = gdb::to_string (name_vec.back ());