aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-12-16 14:39:37 -0800
committerKazu Hirata <kazu@google.com>2023-12-16 14:39:37 -0800
commit744f38913fa380580431df0ae89ef5fb3df30240 (patch)
tree538d4e6bc7bf3d7c8d69232316ff89b82e1a2d7a /lldb/source/Commands
parent01c8af573961c54f0d922c3f3acffa880a0a459c (diff)
downloadllvm-744f38913fa380580431df0ae89ef5fb3df30240.zip
llvm-744f38913fa380580431df0ae89ef5fb3df30240.tar.gz
llvm-744f38913fa380580431df0ae89ef5fb3df30240.tar.bz2
[lldb] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandCompletions.cpp4
-rw-r--r--lldb/source/Commands/CommandObjectCommands.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp6
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp2
5 files changed, 8 insertions, 8 deletions
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index e766a6c..16078a9 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -424,7 +424,7 @@ static void DiskFilesOrDirectories(const llvm::Twine &partial_name,
auto Name = path::filename(Entry.path());
// Omit ".", ".."
- if (Name == "." || Name == ".." || !Name.startswith(PartialItem))
+ if (Name == "." || Name == ".." || !Name.starts_with(PartialItem))
continue;
bool is_dir = Status->isDirectory();
@@ -608,7 +608,7 @@ void CommandCompletions::Registers(CommandInterpreter &interpreter,
CompletionRequest &request,
SearchFilter *searcher) {
std::string reg_prefix;
- if (request.GetCursorArgumentPrefix().startswith("$"))
+ if (request.GetCursorArgumentPrefix().starts_with("$"))
reg_prefix = "$";
RegisterContext *reg_ctx =
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp
index 74d97b0..5b9af4a 100644
--- a/lldb/source/Commands/CommandObjectCommands.cpp
+++ b/lldb/source/Commands/CommandObjectCommands.cpp
@@ -411,7 +411,7 @@ protected:
// Get the alias command.
auto alias_command = args[0].ref();
- if (alias_command.startswith("-")) {
+ if (alias_command.starts_with("-")) {
result.AppendError("aliases starting with a dash are not supported");
if (alias_command == "--help" || alias_command == "--long-help") {
result.AppendWarning("if trying to pass options to 'command alias' add "
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 4ecac73..b78a049 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -1421,7 +1421,7 @@ protected:
// Be careful, getAsInteger with a radix of 16 rejects "0xab" so we
// have to special case that:
bool success = false;
- if (entry.ref().startswith("0x"))
+ if (entry.ref().starts_with("0x"))
success = !entry.ref().getAsInteger(0, uval64);
if (!success)
success = !entry.ref().getAsInteger(16, uval64);
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index dd9fab4..a1e7e3f 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -145,14 +145,14 @@ public:
for (size_t idx = 0; idx < num_entries; idx++) {
llvm::StringRef arg_string = copy_args[idx].ref();
- if (arg_string.equals("-c") || count_opt.startswith(arg_string)) {
+ if (arg_string.equals("-c") || count_opt.starts_with(arg_string)) {
idx++;
if (idx == num_entries)
return std::nullopt;
count_idx = idx;
if (copy_args[idx].ref().getAsInteger(0, count_val))
return std::nullopt;
- } else if (arg_string.equals("-s") || start_opt.startswith(arg_string)) {
+ } else if (arg_string.equals("-s") || start_opt.starts_with(arg_string)) {
idx++;
if (idx == num_entries)
return std::nullopt;
@@ -1575,7 +1575,7 @@ protected:
// I am going to handle this by hand, because I don't want you to have to
// say:
// "thread return -- -5".
- if (command.startswith("-x")) {
+ if (command.starts_with("-x")) {
if (command.size() != 2U)
result.AppendWarning("Return values ignored when returning from user "
"called expressions");
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 411dc2f..f76420f 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -1570,7 +1570,7 @@ void CommandObjectTypeSummaryAdd::DoExecute(Args &command,
static bool FixArrayTypeNameWithRegex(ConstString &type_name) {
llvm::StringRef type_name_ref(type_name.GetStringRef());
- if (type_name_ref.endswith("[]")) {
+ if (type_name_ref.ends_with("[]")) {
std::string type_name_str(type_name.GetCString());
type_name_str.resize(type_name_str.length() - 2);
if (type_name_str.back() != ' ')