Migrate llvm::Optional to std::optional

LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
This commit is contained in:
Ben Barham
2024-02-02 22:19:39 -08:00
parent d3d4bd203c
commit ef8825bfe6
810 changed files with 8035 additions and 8718 deletions

View File

@@ -1753,7 +1753,7 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
const ASTContext &Context = Instance.getASTContext();
const IRGenOptions &IRGenOpts = Invocation.getIRGenOptions();
llvm::Optional<BufferIndirectlyCausingDiagnosticRAII> ricd;
std::optional<BufferIndirectlyCausingDiagnosticRAII> ricd;
if (auto *SF = MSF.dyn_cast<SourceFile *>())
ricd.emplace(*SF);
@@ -2252,12 +2252,12 @@ int swift::performFrontend(ArrayRef<const char *> Args,
// dynamically-sized array of optional PrettyStackTraces, which get
// initialized by iterating over the buffers we collected above.
auto configurationFileStackTraces =
std::make_unique<llvm::Optional<PrettyStackTraceFileContents>[]>(
std::make_unique<std::optional<PrettyStackTraceFileContents>[]>(
configurationFileBuffers.size());
for_each(configurationFileBuffers.begin(), configurationFileBuffers.end(),
&configurationFileStackTraces[0],
[](const std::unique_ptr<llvm::MemoryBuffer> &buffer,
llvm::Optional<PrettyStackTraceFileContents> &trace) {
std::optional<PrettyStackTraceFileContents> &trace) {
trace.emplace(*buffer);
});