aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@quicinc.com>2022-12-18 11:19:40 -0800
committerKrzysztof Parzyszek <kparzysz@quicinc.com>2022-12-18 11:23:54 -0800
commit205c0589f918f95d2f2c586a01bea2716d73d603 (patch)
tree38b2227ab6d17d7d189f32a23e5498404d45b634 /clang/lib/Frontend/CompilerInstance.cpp
parenta538f7cfb1d71cd1a71b5b6d9fe8672a8b6d973e (diff)
downloadllvm-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/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 8238779..acb3cb8 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -426,7 +426,7 @@ static void InitializeFileRemapping(DiagnosticsEngine &Diags,
// Remap files in the source manager (with other files).
for (const auto &RF : InitOpts.RemappedFiles) {
// Find the file that we're mapping to.
- std::optional<FileEntryRef> ToFile = FileMgr.getOptionalFileRef(RF.second);
+ Optional<FileEntryRef> ToFile = FileMgr.getOptionalFileRef(RF.second);
if (!ToFile) {
Diags.Report(diag::err_fe_remap_missing_to_file) << RF.first << RF.second;
continue;
@@ -1281,8 +1281,8 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
Instance.getFrontendOpts().AllowPCMWithCompilerErrors;
}
-static std::optional<FileEntryRef> getPublicModuleMap(FileEntryRef File,
- FileManager &FileMgr) {
+static Optional<FileEntryRef> getPublicModuleMap(FileEntryRef File,
+ FileManager &FileMgr) {
StringRef Filename = llvm::sys::path::filename(File.getName());
SmallString<128> PublicFilename(File.getDir().getName());
if (Filename == "module_private.map")
@@ -1307,12 +1307,12 @@ static bool compileModule(CompilerInstance &ImportingInstance,
ModuleMap &ModMap
= ImportingInstance.getPreprocessor().getHeaderSearchInfo().getModuleMap();
bool Result;
- if (std::optional<FileEntryRef> ModuleMapFile =
+ if (Optional<FileEntryRef> ModuleMapFile =
ModMap.getContainingModuleMapFile(Module)) {
// Canonicalize compilation to start with the public module map. This is
// vital for submodules declarations in the private module maps to be
// correctly parsed when depending on a top level module in the public one.
- if (std::optional<FileEntryRef> PublicMMFile = getPublicModuleMap(
+ if (Optional<FileEntryRef> PublicMMFile = getPublicModuleMap(
*ModuleMapFile, ImportingInstance.getFileManager()))
ModuleMapFile = PublicMMFile;