aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorLancelot Six <lancelot.six@amd.com>2023-10-13 10:17:02 +0000
committerLancelot Six <lancelot.six@amd.com>2023-11-21 11:52:36 +0000
commit8082468ffe65095cdd640fb081b9d3d28dd7add4 (patch)
tree4e9ab5a6ad254f77e96e295d873a1d5b31cf44fa /gdb/ada-lang.c
parent42742fc5817a8f2e47c711880501073a9ad86cfc (diff)
downloadbinutils-8082468ffe65095cdd640fb081b9d3d28dd7add4.zip
binutils-8082468ffe65095cdd640fb081b9d3d28dd7add4.tar.gz
binutils-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/ada-lang.c')
-rw-r--r--gdb/ada-lang.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 58c7016..843583e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -58,6 +58,7 @@
#include "gdbsupport/function-view.h"
#include "gdbsupport/byte-vector.h"
#include "gdbsupport/selftest.h"
+#include "gdbsupport/gdb_string_view.h"
#include <algorithm>
#include "ada-exp.h"
#include "charset.h"
@@ -1035,7 +1036,7 @@ find_case_fold_entry (uint32_t c)
rather than emitting a warning. Result good to next call. */
static const char *
-ada_fold_name (gdb::string_view name, bool throw_on_error = false)
+ada_fold_name (std::string_view name, bool throw_on_error = false)
{
static std::string fold_storage;
@@ -13250,7 +13251,7 @@ do_exact_match (const char *symbol_search_name,
ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
{
- gdb::string_view user_name = lookup_name.name ();
+ std::string_view user_name = lookup_name.name ();
if (!user_name.empty () && user_name[0] == '<')
{
@@ -13269,7 +13270,7 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
{
m_verbatim_p = false;
- m_encoded_p = user_name.find ("__") != gdb::string_view::npos;
+ m_encoded_p = user_name.find ("__") != std::string_view::npos;
if (!m_encoded_p)
{
@@ -13326,7 +13327,7 @@ literal_symbol_name_matcher (const char *symbol_search_name,
const lookup_name_info &lookup_name,
completion_match_result *comp_match_res)
{
- gdb::string_view name_view = lookup_name.name ();
+ std::string_view name_view = lookup_name.name ();
if (lookup_name.completion_mode ()
? (strncmp (symbol_search_name, name_view.data (),