[llvm] [ADT] Deprecate StringRef::equals (PR #92351)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 22:37:16 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
This patch deprecates StringRef::equals. Note that I've migrated all
known users to operator==(StringRef, StringRef).
---
Full diff: https://github.com/llvm/llvm-project/pull/92351.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/StringRef.h (+3-1)
``````````diff
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
index 8ed8e424cfe13..641de5dcef280 100644
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -161,7 +161,9 @@ namespace llvm {
/// equals - Check for string equality, this is more efficient than
/// compare() when the relative ordering of inequal strings isn't needed.
- [[nodiscard]] bool equals(StringRef RHS) const {
+ [[nodiscard]] LLVM_DEPRECATED(
+ "Use operator==(StringRef, StringRef) instead",
+ "==") bool equals(StringRef RHS) const {
return (Length == RHS.Length &&
compareMemory(Data, RHS.Data, RHS.Length) == 0);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/92351
More information about the llvm-commits
mailing list