Skip to content

Commit f3dcc23

Browse files
authoredDec 13, 2023
[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.
1 parent eaa1152 commit f3dcc23

File tree

155 files changed

+547
-541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+547
-541
lines changed
 

‎clang/include/clang/Basic/Attr.td

+3-3
Original file line numberDiff line numberDiff line change
@@ -2878,7 +2878,7 @@ def Target : InheritableAttr {
28782878

28792879
for (auto &Feature : AttrFeatures) {
28802880
Feature = Feature.trim();
2881-
if (Feature.startswith("arch="))
2881+
if (Feature.starts_with("arch="))
28822882
return Feature.drop_front(sizeof("arch=") - 1);
28832883
}
28842884
return "";
@@ -2896,8 +2896,8 @@ def Target : InheritableAttr {
28962896
for (auto &Feature : AttrFeatures) {
28972897
Feature = Feature.trim();
28982898

2899-
if (!Feature.startswith("no-") && !Feature.startswith("arch=") &&
2900-
!Feature.startswith("fpmath=") && !Feature.startswith("tune="))
2899+
if (!Feature.starts_with("no-") && !Feature.starts_with("arch=") &&
2900+
!Feature.starts_with("fpmath=") && !Feature.starts_with("tune="))
29012901
Out.push_back(Feature);
29022902
}
29032903
}

‎clang/include/clang/Basic/IdentifierTable.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
511511
/// function(<#int x#>);
512512
/// \endcode
513513
bool isEditorPlaceholder() const {
514-
return getName().startswith("<#") && getName().endswith("#>");
514+
return getName().starts_with("<#") && getName().ends_with("#>");
515515
}
516516

517517
/// Determine whether \p this is a name reserved for the implementation (C99

0 commit comments

Comments
 (0)