[Lldb-commits] [lldb] 364d7e7 - [lldb] Use StringRef::starts_with (NFC)

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Sun Dec 17 15:51:54 PST 2023


Author: Kazu Hirata
Date: 2023-12-17T15:51:48-08:00
New Revision: 364d7e775fcad5ef20a5c5788586f79c467b47db

URL: https://github.com/llvm/llvm-project/commit/364d7e775fcad5ef20a5c5788586f79c467b47db
DIFF: https://github.com/llvm/llvm-project/commit/364d7e775fcad5ef20a5c5788586f79c467b47db.diff

LOG: [lldb] Use StringRef::starts_with (NFC)

This patch replaces uses of StringRef::startswith with
StringRef::starts_with for consistency with
std::{string,string_view}::starts_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

Added: 
    

Modified: 
    lldb/bindings/python/python-typemaps.swig

Removed: 
    


################################################################################
diff  --git a/lldb/bindings/python/python-typemaps.swig b/lldb/bindings/python/python-typemaps.swig
index 7660e0282c8fcf..8d4b740e5f35ca 100644
--- a/lldb/bindings/python/python-typemaps.swig
+++ b/lldb/bindings/python/python-typemaps.swig
@@ -110,7 +110,7 @@ AND call SWIG_fail at the same time, because it will result in a double free.
         SWIG_fail;
       }
 
-      if (llvm::StringRef(type_name.get()).startswith("SB")) {
+      if (llvm::StringRef(type_name.get()).starts_with("SB")) {
         std::string error_msg = "Input type is invalid: " + type_name.get();
         PyErr_SetString(PyExc_TypeError, error_msg.c_str());
         SWIG_fail;


        


More information about the lldb-commits mailing list