diff options
author | Kazu Hirata <kazu@google.com> | 2024-08-28 01:13:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-28 01:13:46 -0700 |
commit | 22e55ba3293f72df84de509db821b4d8a2c4c55e (patch) | |
tree | 16afbe92c0c6513e07f19c767aec28bb9124ecb8 /llvm/unittests/Support/VirtualFileSystemTest.cpp | |
parent | 6332c36bc846e7cba5c8cc1f865ca506539692fc (diff) | |
download | llvm-22e55ba3293f72df84de509db821b4d8a2c4c55e.zip llvm-22e55ba3293f72df84de509db821b4d8a2c4c55e.tar.gz llvm-22e55ba3293f72df84de509db821b4d8a2c4c55e.tar.bz2 |
[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#106330)
S.substr(N) is simpler than S.slice(N, StringRef::npos). Also, substr
is probably better recognizable than slice thanks to
std::string_view::substr.
Diffstat (limited to 'llvm/unittests/Support/VirtualFileSystemTest.cpp')
-rw-r--r-- | llvm/unittests/Support/VirtualFileSystemTest.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp index d4717ce..60649e9 100644 --- a/llvm/unittests/Support/VirtualFileSystemTest.cpp +++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp @@ -1583,7 +1583,7 @@ public: IntrusiveRefCntPtr<vfs::FileSystem> ExternalFS = new DummyFileSystem(), StringRef YAMLFilePath = "") { std::string VersionPlusContent("{\n 'version':0,\n"); - VersionPlusContent += Content.slice(Content.find('{') + 1, StringRef::npos); + VersionPlusContent += Content.substr(Content.find('{') + 1); return getFromYAMLRawString(VersionPlusContent, ExternalFS, YAMLFilePath); } |