[llvm] 0af53df - [Support] Use std::optional in VirtualFileSystem.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 21:53:05 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T21:53:00-08:00
New Revision: 0af53df8838fd0a48d8649522ac3fddef065358d

URL: https://github.com/llvm/llvm-project/commit/0af53df8838fd0a48d8649522ac3fddef065358d
DIFF: https://github.com/llvm/llvm-project/commit/0af53df8838fd0a48d8649522ac3fddef065358d.diff

LOG: [Support] Use std::optional in VirtualFileSystem.cpp (NFC)

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

Added: 
    

Modified: 
    llvm/lib/Support/VirtualFileSystem.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp
index 14742f727411..3c4ce947b872 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -46,6 +46,7 @@
 #include <iterator>
 #include <limits>
 #include <memory>
+#include <optional>
 #include <string>
 #include <system_error>
 #include <utility>
@@ -298,7 +299,7 @@ class RealFileSystem : public FileSystem {
     // The current working directory, with links resolved. (readlink .).
     SmallString<128> Resolved;
   };
-  Optional<WorkingDirectory> WD;
+  std::optional<WorkingDirectory> WD;
 };
 
 } // namespace
@@ -1604,7 +1605,7 @@ class llvm::vfs::RedirectingFileSystemParser {
     return false;
   }
 
-  Optional<RedirectingFileSystem::RedirectKind>
+  std::optional<RedirectingFileSystem::RedirectKind>
   parseRedirectKind(yaml::Node *N) {
     SmallString<12> Storage;
     StringRef Value;


        


More information about the llvm-commits mailing list