[llvm] de483ad - [ADT] Deprecate StringRef::equals (#92351)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 00:38:41 PDT 2024


Author: Kazu Hirata
Date: 2024-05-16T00:38:37-07:00
New Revision: de483ad513895c0adf7f21c7001c30f031998ea3

URL: https://github.com/llvm/llvm-project/commit/de483ad513895c0adf7f21c7001c30f031998ea3
DIFF: https://github.com/llvm/llvm-project/commit/de483ad513895c0adf7f21c7001c30f031998ea3.diff

LOG: [ADT] Deprecate StringRef::equals (#92351)

This patch deprecates StringRef::equals.  Note that I've migrated all
known users to operator==(StringRef, StringRef).

Added: 
    

Modified: 
    llvm/include/llvm/ADT/StringRef.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
index 8ed8e424cfe13..2120c04530b23 100644
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -161,7 +161,8 @@ 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 == 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