From 205c0589f918f95d2f2c586a01bea2716d73d603 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Sun, 18 Dec 2022 11:19:40 -0800 Subject: 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). --- clang/lib/Lex/ModuleMap.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'clang/lib/Lex/ModuleMap.cpp') diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index c061790..f5a7f51 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -1259,7 +1258,7 @@ void ModuleMap::addHeader(Module *Mod, Module::Header Header, Cb->moduleMapAddHeader(Header.Entry->getName()); } -std::optional +Optional ModuleMap::getContainingModuleMapFile(const Module *Module) const { if (Module->DefinitionLoc.isInvalid()) return std::nullopt; @@ -1268,7 +1267,7 @@ ModuleMap::getContainingModuleMapFile(const Module *Module) const { SourceMgr.getFileID(Module->DefinitionLoc)); } -std::optional +Optional ModuleMap::getModuleMapFileForUniquing(const Module *M) const { if (M->IsInferred) { assert(InferredModuleAllowedBy.count(M) && "missing inferred module map"); -- cgit v1.1