diff options
author | Krzysztof Parzyszek <kparzysz@quicinc.com> | 2022-12-18 11:19:40 -0800 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@quicinc.com> | 2022-12-18 11:23:54 -0800 |
commit | 205c0589f918f95d2f2c586a01bea2716d73d603 (patch) | |
tree | 38b2227ab6d17d7d189f32a23e5498404d45b634 /clang/lib/Basic | |
parent | a538f7cfb1d71cd1a71b5b6d9fe8672a8b6d973e (diff) | |
download | llvm-205c0589f918f95d2f2c586a01bea2716d73d603.zip llvm-205c0589f918f95d2f2c586a01bea2716d73d603.tar.gz llvm-205c0589f918f95d2f2c586a01bea2716d73d603.tar.bz2 |
Revert "[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to std::optional"
This reverts commit 8f0df9f3bbc6d7f3d5cbfd955c5ee4404c53a75d.
The Optional*RefDegradesTo*EntryPtr types want to keep the same size as
the underlying type, which std::optional doesn't guarantee. For use with
llvm::Optional, they define their own storage class, and there is no way
to do that in std::optional.
On top of that, that commit broke builds with older GCCs, where
std::optional was not trivially copyable (static_assert in the clang
sources was failing).
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r-- | clang/lib/Basic/FileManager.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index 1d96093..4fefbaa 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -471,7 +471,7 @@ FileEntryRef FileManager::getVirtualFileRef(StringRef Filename, off_t Size, return FileEntryRef(NamedFileEnt); } -std::optional<FileEntryRef> FileManager::getBypassFile(FileEntryRef VF) { +llvm::Optional<FileEntryRef> FileManager::getBypassFile(FileEntryRef VF) { // Stat of the file and return nullptr if it doesn't exist. llvm::vfs::Status Status; if (getStatValue(VF.getName(), Status, /*isFile=*/true, /*F=*/nullptr)) diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index c9312c6..8eca151 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -38,7 +38,6 @@ #include <cstddef> #include <cstdint> #include <memory> -#include <optional> #include <tuple> #include <utility> #include <vector> @@ -713,10 +712,10 @@ void SourceManager::overrideFileContents(const FileEntry *SourceFile, Pair.first->second = NewFile; } -std::optional<FileEntryRef> +Optional<FileEntryRef> SourceManager::bypassFileContentsOverride(FileEntryRef File) { assert(isFileOverridden(&File.getFileEntry())); - std::optional<FileEntryRef> BypassFile = FileMgr.getBypassFile(File); + llvm::Optional<FileEntryRef> BypassFile = FileMgr.getBypassFile(File); // If the file can't be found in the FS, give up. if (!BypassFile) |