diff options
author | Kazu Hirata <kazu@google.com> | 2024-05-04 08:46:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-04 08:46:48 -0700 |
commit | 7ee6288312e8cde8d2e8ee48f87bbab966a89247 (patch) | |
tree | b1a582736229076e31a59e8fb391c31c3279eb05 /llvm/lib/Support/VirtualFileSystem.cpp | |
parent | 76aa042dde6ba9ba57c680950f5818259ee02690 (diff) | |
download | llvm-7ee6288312e8cde8d2e8ee48f87bbab966a89247.zip llvm-7ee6288312e8cde8d2e8ee48f87bbab966a89247.tar.gz llvm-7ee6288312e8cde8d2e8ee48f87bbab966a89247.tar.bz2 |
[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".
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
-rw-r--r-- | llvm/lib/Support/VirtualFileSystem.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |