[all-commits] [llvm/llvm-project] 4e6f6f: [IR] Use StringRef::operator== instead of StringRe...

Kazu Hirata via All-commits all-commits at lists.llvm.org
Tue Apr 30 12:23:53 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6
      https://github.com/llvm/llvm-project/commit/4e6f6fda8b05524ccdb5a3e42c6c15ddef2454b6
  Author: Kazu Hirata <kazu at google.com>
  Date:   2024-04-30 (Tue, 30 Apr 2024)

  Changed paths:
    M llvm/lib/IR/Attributes.cpp
    M llvm/lib/IR/AutoUpgrade.cpp
    M llvm/lib/IR/BasicBlock.cpp
    M llvm/lib/IR/Function.cpp
    M llvm/lib/IR/Metadata.cpp
    M llvm/lib/IR/ProfDataUtils.cpp
    M llvm/lib/IR/ProfileSummary.cpp
    M llvm/lib/IR/Type.cpp
    M llvm/lib/IR/Verifier.cpp

  Log Message:
  -----------
  [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".



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list