aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/ExtractAPI
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-12-13 08:54:13 -0800
committerGitHub <noreply@github.com>2023-12-13 08:54:13 -0800
commitf3dcc2351cff7b26c9870d737e5d431551542d9e (patch)
tree31fa2bd937d91cd191045356b5f1ee23316605a3 /clang/lib/ExtractAPI
parenteaa11526c873b65a9dc0aaf0ebaf66de3db8ed21 (diff)
downloadllvm-f3dcc2351cff7b26c9870d737e5d431551542d9e.zip
llvm-f3dcc2351cff7b26c9870d737e5d431551542d9e.tar.gz
llvm-f3dcc2351cff7b26c9870d737e5d431551542d9e.tar.bz2
[clang] Use StringRef::{starts,ends}_with (NFC) (#75149)
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 'clang/lib/ExtractAPI')
-rw-r--r--clang/lib/ExtractAPI/ExtractAPIConsumer.cpp4
-rw-r--r--clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
index fe282df..fd62d84 100644
--- a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
+++ b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
@@ -105,10 +105,10 @@ std::optional<std::string> getRelativeIncludeName(const CompilerInstance &CI,
// Special case Apple .sdk folders since the search path is typically a
// symlink like `iPhoneSimulator14.5.sdk` while the file is instead
// located in `iPhoneSimulator.sdk` (the real folder).
- if (NI->endswith(".sdk") && DI->endswith(".sdk")) {
+ if (NI->ends_with(".sdk") && DI->ends_with(".sdk")) {
StringRef NBasename = path::stem(*NI);
StringRef DBasename = path::stem(*DI);
- if (DBasename.startswith(NBasename))
+ if (DBasename.starts_with(NBasename))
continue;
}
diff --git a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
index d9675b0..53b2229 100644
--- a/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
+++ b/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
@@ -743,7 +743,7 @@ bool SymbolGraphSerializer::shouldSkip(const APIRecord &Record) const {
// Filter out symbols prefixed with an underscored as they are understood to
// be symbols clients should not use.
- if (Record.Name.startswith("_"))
+ if (Record.Name.starts_with("_"))
return true;
return false;