diff options
author | Kazu Hirata <kazu@google.com> | 2023-12-11 21:01:36 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 21:01:36 -0800 |
commit | 586ecdf205aa8b3d162da6f955170a6736656615 (patch) | |
tree | 75cbe2050cd2f1a06a656be8b845f82433970ff3 /llvm/lib/Object/COFFImportFile.cpp | |
parent | d5fb4c0f118b47db74233af2d99ae075e1dbe148 (diff) | |
download | llvm-586ecdf205aa8b3d162da6f955170a6736656615.zip llvm-586ecdf205aa8b3d162da6f955170a6736656615.tar.gz llvm-586ecdf205aa8b3d162da6f955170a6736656615.tar.bz2 |
[llvm] Use StringRef::{starts,ends}_with (NFC) (#74956)
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 'llvm/lib/Object/COFFImportFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFImportFile.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp index 2cca1f7..eeb13ff 100644 --- a/llvm/lib/Object/COFFImportFile.cpp +++ b/llvm/lib/Object/COFFImportFile.cpp @@ -91,11 +91,11 @@ static ImportNameType getNameType(StringRef Sym, StringRef ExtName, // stdcall function still omits the underscore (IMPORT_NAME_NOPREFIX). // See the comment in isDecorated in COFFModuleDefinition.cpp for more // details. - if (ExtName.startswith("_") && ExtName.contains('@') && !MinGW) + if (ExtName.starts_with("_") && ExtName.contains('@') && !MinGW) return IMPORT_NAME; if (Sym != ExtName) return IMPORT_NAME_UNDECORATE; - if (Machine == IMAGE_FILE_MACHINE_I386 && Sym.startswith("_")) + if (Machine == IMAGE_FILE_MACHINE_I386 && Sym.starts_with("_")) return IMPORT_NAME_NOPREFIX; return IMPORT_NAME; } @@ -105,7 +105,7 @@ static Expected<std::string> replace(StringRef S, StringRef From, size_t Pos = S.find(From); // From and To may be mangled, but substrings in S may not. - if (Pos == StringRef::npos && From.startswith("_") && To.startswith("_")) { + if (Pos == StringRef::npos && From.starts_with("_") && To.starts_with("_")) { From = From.substr(1); To = To.substr(1); Pos = S.find(From); |