aboutsummaryrefslogtreecommitdiff
path: root/lldb/tools
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/tools
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/tools')
-rw-r--r--lldb/tools/lldb-dap/IOStream.cpp2
-rw-r--r--lldb/tools/lldb-dap/JSONUtils.cpp5
-rw-r--r--lldb/tools/lldb-dap/lldb-dap.cpp2
3 files changed, 5 insertions, 4 deletions
diff --git a/lldb/tools/lldb-dap/IOStream.cpp b/lldb/tools/lldb-dap/IOStream.cpp
index 897ab79..96e9a1e 100644
--- a/lldb/tools/lldb-dap/IOStream.cpp
+++ b/lldb/tools/lldb-dap/IOStream.cpp
@@ -138,7 +138,7 @@ bool InputStream::read_line(std::ofstream *log, std::string &line) {
if (!read_full(log, 1, line))
return false;
- if (llvm::StringRef(line).endswith("\r\n"))
+ if (llvm::StringRef(line).ends_with("\r\n"))
break;
}
line.erase(line.size() - 2);
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index c8e5304..a0a175f 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -455,8 +455,9 @@ llvm::json::Value CreateBreakpoint(lldb::SBBreakpoint &bp,
static uint64_t GetDebugInfoSizeInSection(lldb::SBSection section) {
uint64_t debug_info_size = 0;
llvm::StringRef section_name(section.GetName());
- if (section_name.startswith(".debug") || section_name.startswith("__debug") ||
- section_name.startswith(".apple") || section_name.startswith("__apple"))
+ if (section_name.starts_with(".debug") ||
+ section_name.starts_with("__debug") ||
+ section_name.starts_with(".apple") || section_name.starts_with("__apple"))
debug_info_size += section.GetFileByteSize();
size_t num_sub_sections = section.GetNumSubSections();
for (size_t i = 0; i < num_sub_sections; i++) {
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index d36e9b4..75b3948 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -3094,7 +3094,7 @@ void request_setVariable(const llvm::json::Object &request) {
lldb::SBValue container = g_dap.variables.GetVariable(variablesReference);
variable = container.GetChildMemberWithName(name.data());
if (!variable.IsValid()) {
- if (name.startswith("[")) {
+ if (name.starts_with("[")) {
llvm::StringRef index_str(name.drop_front(1));
uint64_t index = 0;
if (!index_str.consumeInteger(0, index)) {