diff options
author | Kazu Hirata <kazu@google.com> | 2024-04-30 12:23:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-30 12:23:31 -0700 |
commit | 4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6 (patch) | |
tree | d20291dc8d954226853ad152356fe0c7f7d57caf /llvm/lib/IR/Attributes.cpp | |
parent | 9b07a035f1802e826d2186eae1875d010048618a (diff) | |
download | llvm-4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6.zip llvm-4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6.tar.gz llvm-4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6.tar.bz2 |
[IR] Use StringRef::operator== instead of StringRef::equals (NFC) (#90550)
I'm planning to remove StringRef::equals in favor of
StringRef::operator==.
- StringRef::operator== outnumbers StringRef::equals by a factor of 22
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/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 9f27f17..c6e511b 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -2282,7 +2282,7 @@ struct StrBoolAttr { static bool isSet(const Function &Fn, StringRef Kind) { auto A = Fn.getFnAttribute(Kind); - return A.getValueAsString().equals("true"); + return A.getValueAsString() == "true"; } static void set(Function &Fn, |