-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADT] Deprecate StringRef::{starts,ends}with #75491
[ADT] Deprecate StringRef::{starts,ends}with #75491
Conversation
This patch deprecates StringRef::{starts,ends}with. Note that I've replaced all known uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20.
@llvm/pr-subscribers-llvm-adt Author: Kazu Hirata (kazutakahirata) ChangesThis patch deprecates StringRef::{starts,ends}with. Note that I've Full diff: https://github.com/llvm/llvm-project/pull/75491.diff 1 Files Affected:
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
index 4e69d5b633546d..d892333de391ce 100644
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -258,7 +258,9 @@ namespace llvm {
return Length >= Prefix.Length &&
compareMemory(Data, Prefix.Data, Prefix.Length) == 0;
}
- [[nodiscard]] bool startswith(StringRef Prefix) const {
+ [[nodiscard]] LLVM_DEPRECATED(
+ "Use starts_with instead",
+ "starts_with") bool startswith(StringRef Prefix) const {
return starts_with(Prefix);
}
@@ -271,7 +273,9 @@ namespace llvm {
compareMemory(end() - Suffix.Length, Suffix.Data, Suffix.Length) ==
0;
}
- [[nodiscard]] bool endswith(StringRef Suffix) const {
+ [[nodiscard]] LLVM_DEPRECATED(
+ "Use ends_with instead",
+ "ends_with") bool endswith(StringRef Suffix) const {
return ends_with(Suffix);
}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming CI doesn't produce any warnings
This matches the change to upstream `llvm::StringRef`, see llvm/llvm-project#75491 .
The method was deprecated in favor of `StringRef::starts_with` in llvm/llvm-project#75491
The method was deprecated in favor of `StringRef::starts_with` in llvm/llvm-project#75491
This patch deprecates StringRef::{starts,ends}with. Note that I've
replaced all known uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.