From bb6df0804ba0a0b0581aec4156138f5144dbcee2 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 8 May 2024 10:33:53 -0700 Subject: [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". --- llvm/lib/Object/MachOObjectFile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 1cfd0a0..06186ad 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -399,7 +399,7 @@ static Error parseSegmentLoadCommand( return malformedError("load command " + Twine(LoadCommandIndex) + " filesize field in " + CmdName + " greater than vmsize field"); - IsPageZeroSegment |= StringRef("__PAGEZERO").equals(S.segname); + IsPageZeroSegment |= StringRef("__PAGEZERO") == S.segname; } else return SegOrErr.takeError(); @@ -4364,7 +4364,7 @@ BindRebaseSegInfo::BindRebaseSegInfo(const object::MachOObjectFile *Obj) { Info.Size = Section.getSize(); Info.SegmentName = Obj->getSectionFinalSegmentName(Section.getRawDataRefImpl()); - if (!Info.SegmentName.equals(CurSegName)) { + if (Info.SegmentName != CurSegName) { ++CurSegIndex; CurSegName = Info.SegmentName; CurSegAddress = Info.Address; -- cgit v1.1