aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/common-utils.h8
-rw-r--r--gdbsupport/format.h5
-rw-r--r--gdbsupport/gdb_string_view.h2
3 files changed, 8 insertions, 7 deletions
diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
index 4ceb44d..1efc5bb 100644
--- a/gdbsupport/common-utils.h
+++ b/gdbsupport/common-utils.h
@@ -26,7 +26,7 @@
#include "gdbsupport/gdb_unique_ptr.h"
#include "gdbsupport/array-view.h"
#include "poison.h"
-#include "gdb_string_view.h"
+#include <string_view>
#if defined HAVE_LIBXXHASH
# include <xxhash.h>
@@ -94,7 +94,7 @@ extern const char *safe_strerror (int);
true if the start of STRING matches PATTERN, false otherwise. */
static inline bool
-startswith (gdb::string_view string, gdb::string_view pattern)
+startswith (std::string_view string, std::string_view pattern)
{
return (string.length () >= pattern.length ()
&& strncmp (string.data (), pattern.data (), pattern.length ()) == 0);
@@ -228,7 +228,7 @@ fast_hash (const void *ptr, size_t len, unsigned int start_value = 0)
namespace gdb
{
-/* Hash type for gdb::string_view.
+/* Hash type for std::string_view.
Even after we switch to C++17 and dump our string_view implementation, we
might want to keep this hash implementation if it's faster than std::hash
@@ -236,7 +236,7 @@ namespace gdb
struct string_view_hash
{
- std::size_t operator() (gdb::string_view view) const
+ std::size_t operator() (std::string_view view) const
{ return fast_hash (view.data (), view.length ()); }
};
diff --git a/gdbsupport/format.h b/gdbsupport/format.h
index 2af34ab..26e327a 100644
--- a/gdbsupport/format.h
+++ b/gdbsupport/format.h
@@ -20,7 +20,7 @@
#ifndef COMMON_FORMAT_H
#define COMMON_FORMAT_H
-#include "gdbsupport/gdb_string_view.h"
+#include <string_view>
#if defined(__MINGW32__) && !defined(PRINTF_HAS_LONG_LONG)
# define USE_PRINTF_I64 1
@@ -56,12 +56,13 @@ struct format_piece
argclass (argc),
n_int_args (n)
{
+ gdb_assert (str != nullptr);
}
bool operator== (const format_piece &other) const
{
return (this->argclass == other.argclass
- && gdb::string_view (this->string) == other.string);
+ && std::string_view (this->string) == other.string);
}
const char *string;
diff --git a/gdbsupport/gdb_string_view.h b/gdbsupport/gdb_string_view.h
index 26a3a9f..cf7af62 100644
--- a/gdbsupport/gdb_string_view.h
+++ b/gdbsupport/gdb_string_view.h
@@ -556,7 +556,7 @@ namespace gdb {
namespace gdb {
static inline std::string
-to_string(const gdb::string_view &view)
+to_string(const std::string_view &view)
{
return { view.data (), view.size () };
}