From 7ee6288312e8cde8d2e8ee48f87bbab966a89247 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 4 May 2024 08:46:48 -0700 Subject: [Support] Use StringRef::operator== instead of StringRef::equals (NFC) (#91042) I'm planning to remove StringRef::equals in favor of StringRef::operator==. - StringRef::operator== outnumbers StringRef::equals by a factor of 25 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/Support/VirtualFileSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Support/VirtualFileSystem.cpp') diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index 921af30..152fcfe 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -157,7 +157,7 @@ void FileSystem::dump() const { print(dbgs(), PrintType::RecursiveContents); } #ifndef NDEBUG static bool isTraversalComponent(StringRef Component) { - return Component.equals("..") || Component.equals("."); + return Component == ".." || Component == "."; } static bool pathHasTraversal(StringRef Path) { -- cgit v1.1