diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-02 22:10:37 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-02 22:10:37 -0800 |
commit | b6a01caa64aaac2e5db8d7953a81cbe1a139b81f (patch) | |
tree | 1e03e63b8c985d3b1ca515ac811a87e31e6afef0 /llvm/unittests/Support/VirtualFileSystemTest.cpp | |
parent | b25362816d731ca2283b3b21ca7343a64c05d85c (diff) | |
download | llvm-b6a01caa64aaac2e5db8d7953a81cbe1a139b81f.zip llvm-b6a01caa64aaac2e5db8d7953a81cbe1a139b81f.tar.gz llvm-b6a01caa64aaac2e5db8d7953a81cbe1a139b81f.tar.bz2 |
[llvm/unittests] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Diffstat (limited to 'llvm/unittests/Support/VirtualFileSystemTest.cpp')
-rw-r--r-- | llvm/unittests/Support/VirtualFileSystemTest.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp index 1e300ee..e4f93ca 100644 --- a/llvm/unittests/Support/VirtualFileSystemTest.cpp +++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp @@ -1129,7 +1129,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithUser) { } TEST_F(InMemoryFileSystemTest, AddFileWithGroup) { - FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, 0xDABBAD00); + FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt, + 0xDABBAD00); auto Stat = FS.status("/a"); ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString(); ASSERT_TRUE(Stat->isDirectory()); @@ -1146,8 +1147,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithGroup) { } TEST_F(InMemoryFileSystemTest, AddFileWithFileType) { - FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, None, - sys::fs::file_type::socket_file); + FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt, + std::nullopt, sys::fs::file_type::socket_file); auto Stat = FS.status("/a"); ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString(); ASSERT_TRUE(Stat->isDirectory()); @@ -1161,7 +1162,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithFileType) { } TEST_F(InMemoryFileSystemTest, AddFileWithPerms) { - FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, None, None, + FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt, + std::nullopt, std::nullopt, sys::fs::perms::owner_read | sys::fs::perms::owner_write); auto Stat = FS.status("/a"); ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString(); @@ -1183,10 +1185,11 @@ TEST_F(InMemoryFileSystemTest, AddFileWithPerms) { } TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) { - FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""), /*User=*/None, - /*Group=*/None, sys::fs::file_type::directory_file); - FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("abc"), /*User=*/None, - /*Group=*/None, sys::fs::file_type::regular_file); + FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""), /*User=*/std::nullopt, + /*Group=*/std::nullopt, sys::fs::file_type::directory_file); + FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("abc"), + /*User=*/std::nullopt, + /*Group=*/std::nullopt, sys::fs::file_type::regular_file); auto Stat = FS.status("/a"); ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString(); ASSERT_TRUE(Stat->isDirectory()); @@ -1199,8 +1202,9 @@ TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) { // was requested (to match the behavior of RealFileSystem). TEST_F(InMemoryFileSystemTest, StatusName) { NormalizedFS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), - /*User=*/None, - /*Group=*/None, sys::fs::file_type::regular_file); + /*User=*/std::nullopt, + /*Group=*/std::nullopt, + sys::fs::file_type::regular_file); NormalizedFS.setCurrentWorkingDirectory("/a/b"); // Access using InMemoryFileSystem::status. |