[llvm] [ADT] Deprecate StringRef::equals (PR #92351)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 22:36:46 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/92351
This patch deprecates StringRef::equals. Note that I've migrated all
known users to operator==(StringRef, StringRef).
>From 8afd75e69facff9c06da911aec5d9c3b03786d68 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 26 Jan 2024 00:05:21 -0800
Subject: [PATCH] [ADT] Deprecate StringRef::equals
This patch deprecates StringRef::equals. Note that I've migrated all
known users to operator==(StringRef, StringRef).
---
llvm/include/llvm/ADT/StringRef.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
}
More information about the llvm-commits
mailing list