aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/StringRefTest.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-05-08 10:33:53 -0700
committerGitHub <noreply@github.com>2024-05-08 10:33:53 -0700
commitbb6df0804ba0a0b0581aec4156138f5144dbcee2 (patch)
tree9f1bf9618fd27b9941c88b59f5790dc9049eda7f /llvm/unittests/ADT/StringRefTest.cpp
parent46435ac19e09039fb146fa6c12da0e640a66d435 (diff)
downloadllvm-bb6df0804ba0a0b0581aec4156138f5144dbcee2.zip
llvm-bb6df0804ba0a0b0581aec4156138f5144dbcee2.tar.gz
llvm-bb6df0804ba0a0b0581aec4156138f5144dbcee2.tar.bz2
[llvm] Use StringRef::operator== instead of StringRef::equals (NFC) (#91441)
I'm planning to remove StringRef::equals in favor of StringRef::operator==. - StringRef::operator==/!= outnumber StringRef::equals by a factor of 70 under llvm/ in terms of their usage. - The elimination of StringRef::equals brings StringRef closer to std::string_view, which has operator== but not equals. - S == "foo" is more readable than S.equals("foo"), especially for !Long.Expression.equals("str") vs Long.Expression != "str".
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
-rw-r--r--llvm/unittests/ADT/StringRefTest.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp
index fa537e8..b3c206a 100644
--- a/llvm/unittests/ADT/StringRefTest.cpp
+++ b/llvm/unittests/ADT/StringRefTest.cpp
@@ -998,7 +998,7 @@ TEST(StringRefTest, AllocatorCopy) {
// allocator.
StringRef StrEmpty = "";
StringRef StrEmptyc = StrEmpty.copy(Alloc);
- EXPECT_TRUE(StrEmpty.equals(StrEmptyc));
+ EXPECT_TRUE(StrEmpty == StrEmptyc);
EXPECT_EQ(StrEmptyc.data(), nullptr);
EXPECT_EQ(StrEmptyc.size(), 0u);
EXPECT_EQ(Alloc.getTotalMemory(), 0u);
@@ -1007,9 +1007,9 @@ TEST(StringRefTest, AllocatorCopy) {
StringRef Str2 = "bye";
StringRef Str1c = Str1.copy(Alloc);
StringRef Str2c = Str2.copy(Alloc);
- EXPECT_TRUE(Str1.equals(Str1c));
+ EXPECT_TRUE(Str1 == Str1c);
EXPECT_NE(Str1.data(), Str1c.data());
- EXPECT_TRUE(Str2.equals(Str2c));
+ EXPECT_TRUE(Str2 == Str2c);
EXPECT_NE(Str2.data(), Str2c.data());
}