From b1df3a2c0b6a42570042934cb79ca0e4359f863b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 16 Dec 2022 08:49:10 +0000 Subject: [Support] llvm::Optional => std::optional https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 --- llvm/lib/Support/VirtualFileSystem.cpp | 52 ++++++++++++++++------------------ 1 file changed, 25 insertions(+), 27 deletions(-) (limited to 'llvm/lib/Support/VirtualFileSystem.cpp') diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index f210143b1204..eac6fc9a9e35 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -814,10 +814,10 @@ std::string InMemoryFileSystem::toString() const { bool InMemoryFileSystem::addFile(const Twine &P, time_t ModificationTime, std::unique_ptr Buffer, - Optional User, - Optional Group, - Optional Type, - Optional Perms, + std::optional User, + std::optional Group, + std::optional Type, + std::optional Perms, MakeNodeFn MakeNode) { SmallString<128> Path; P.toVector(Path); @@ -891,10 +891,10 @@ bool InMemoryFileSystem::addFile(const Twine &P, time_t ModificationTime, bool InMemoryFileSystem::addFile(const Twine &P, time_t ModificationTime, std::unique_ptr Buffer, - Optional User, - Optional Group, - Optional Type, - Optional Perms) { + std::optional User, + std::optional Group, + std::optional Type, + std::optional Perms) { return addFile(P, ModificationTime, std::move(Buffer), User, Group, Type, Perms, [](detail::NewInMemoryNodeInfo NNI) @@ -907,12 +907,11 @@ bool InMemoryFileSystem::addFile(const Twine &P, time_t ModificationTime, }); } -bool InMemoryFileSystem::addFileNoOwn(const Twine &P, time_t ModificationTime, - const llvm::MemoryBufferRef &Buffer, - Optional User, - Optional Group, - Optional Type, - Optional Perms) { +bool InMemoryFileSystem::addFileNoOwn( + const Twine &P, time_t ModificationTime, + const llvm::MemoryBufferRef &Buffer, std::optional User, + std::optional Group, std::optional Type, + std::optional Perms) { return addFile(P, ModificationTime, llvm::MemoryBuffer::getMemBuffer(Buffer), std::move(User), std::move(Group), std::move(Type), std::move(Perms), @@ -1020,12 +1019,10 @@ bool InMemoryFileSystem::addHardLink(const Twine &NewLink, }); } -bool InMemoryFileSystem::addSymbolicLink(const Twine &NewLink, - const Twine &Target, - time_t ModificationTime, - Optional User, - Optional Group, - Optional Perms) { +bool InMemoryFileSystem::addSymbolicLink( + const Twine &NewLink, const Twine &Target, time_t ModificationTime, + std::optional User, std::optional Group, + std::optional Perms) { auto NewLinkNode = lookupNode(NewLink, /*FollowFinalSymlink=*/false); if (NewLinkNode) return false; @@ -2272,7 +2269,7 @@ static Status getRedirectedFileStatus(const Twine &OriginalPath, ErrorOr RedirectingFileSystem::status( const Twine &CanonicalPath, const Twine &OriginalPath, const RedirectingFileSystem::LookupResult &Result) { - if (Optional ExtRedirect = Result.getExternalRedirect()) { + if (std::optional ExtRedirect = Result.getExternalRedirect()) { SmallString<256> CanonicalRemappedPath((*ExtRedirect).str()); if (std::error_code EC = makeCanonical(CanonicalRemappedPath)) return EC; @@ -2603,9 +2600,10 @@ class JSONWriter { public: JSONWriter(llvm::raw_ostream &OS) : OS(OS) {} - void write(ArrayRef Entries, Optional UseExternalNames, - Optional IsCaseSensitive, Optional IsOverlayRelative, - StringRef OverlayDir); + void write(ArrayRef Entries, + std::optional UseExternalNames, + std::optional IsCaseSensitive, + std::optional IsOverlayRelative, StringRef OverlayDir); }; } // namespace @@ -2660,9 +2658,9 @@ void JSONWriter::writeEntry(StringRef VPath, StringRef RPath) { } void JSONWriter::write(ArrayRef Entries, - Optional UseExternalNames, - Optional IsCaseSensitive, - Optional IsOverlayRelative, + std::optional UseExternalNames, + std::optional IsCaseSensitive, + std::optional IsOverlayRelative, StringRef OverlayDir) { using namespace llvm::sys; -- cgit v1.2.3