diff options
author | Kazu Hirata <kazu@google.com> | 2024-05-08 10:33:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 10:33:53 -0700 |
commit | bb6df0804ba0a0b0581aec4156138f5144dbcee2 (patch) | |
tree | 9f1bf9618fd27b9941c88b59f5790dc9049eda7f /llvm/lib/Support/VirtualFileSystem.cpp | |
parent | 46435ac19e09039fb146fa6c12da0e640a66d435 (diff) | |
download | llvm-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/lib/Support/VirtualFileSystem.cpp')
-rw-r--r-- | llvm/lib/Support/VirtualFileSystem.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index 54b9c38..fcefdef9 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -1725,7 +1725,7 @@ public: RedirectingFileSystem::Entry *ParentEntry = nullptr) { if (!ParentEntry) { // Look for a existent root for (const auto &Root : FS->Roots) { - if (Name.equals(Root->getName())) { + if (Name == Root->getName()) { ParentEntry = Root.get(); return ParentEntry; } @@ -1736,7 +1736,7 @@ public: llvm::make_range(DE->contents_begin(), DE->contents_end())) { auto *DirContent = dyn_cast<RedirectingFileSystem::DirectoryEntry>(Content.get()); - if (DirContent && Name.equals(Content->getName())) + if (DirContent && Name == Content->getName()) return DirContent; } } |