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/ObjectYAML | |
| parent | d5fb4c0f118b47db74233af2d99ae075e1dbe148 (diff) | |
| download | llvm-586ecdf205aa8b3d162da6f955170a6736656615.tar.gz llvm-586ecdf205aa8b3d162da6f955170a6736656615.tar.bz2 llvm-586ecdf205aa8b3d162da6f955170a6736656615.zip | |
[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/ObjectYAML')
| -rw-r--r-- | llvm/lib/ObjectYAML/ELFEmitter.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/ObjectYAML/ELFYAML.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp index 40f81f867efa..d54faec20866 100644 --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -666,7 +666,7 @@ bool ELFState<ELFT>::initImplicitHeader(ContiguousBlobAccumulator &CBA, initSymtabSectionHeader(Header, SymtabType::Static, CBA, YAMLSec); else if (SecName == ".dynsym") initSymtabSectionHeader(Header, SymtabType::Dynamic, CBA, YAMLSec); - else if (SecName.startswith(".debug_")) { + else if (SecName.starts_with(".debug_")) { // If a ".debug_*" section's type is a preserved one, e.g., SHT_DYNAMIC, we // will not treat it as a debug section. if (YAMLSec && !isa<ELFYAML::RawContentSection>(YAMLSec)) diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp index c47d4eaa309d..9d845a0c7c48 100644 --- a/llvm/lib/ObjectYAML/ELFYAML.cpp +++ b/llvm/lib/ObjectYAML/ELFYAML.cpp @@ -1291,10 +1291,10 @@ StringRef ScalarTraits<ELFYAML::YAMLIntUInt>::input(StringRef Scalar, void *Ctx, StringRef ErrMsg = "invalid number"; // We do not accept negative hex numbers because their meaning is ambiguous. // For example, would -0xfffffffff mean 1 or INT32_MIN? - if (Scalar.empty() || Scalar.startswith("-0x")) + if (Scalar.empty() || Scalar.starts_with("-0x")) return ErrMsg; - if (Scalar.startswith("-")) { + if (Scalar.starts_with("-")) { const int64_t MinVal = Is64 ? INT64_MIN : INT32_MIN; long long Int; if (getAsSignedInteger(Scalar, /*Radix=*/0, Int) || (Int < MinVal)) @@ -1559,7 +1559,7 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping( // When the Type string does not have a "SHT_" prefix, we know it is not a // description of a regular ELF output section. TypeStr = getStringValue(IO, "Type"); - if (TypeStr.startswith("SHT_") || isInteger(TypeStr)) + if (TypeStr.starts_with("SHT_") || isInteger(TypeStr)) IO.mapRequired("Type", Type); } |
