diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-09 23:16:32 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-09 23:16:32 -0800 |
commit | 8d83867dc913bb1b40571c8b36726e22ff824a0d (patch) | |
tree | 5056be4369ef47e40a082138d60f4f493124bf09 /clang/lib | |
parent | e90e8487dce37ace5cfabb5b27cb0dc0ba5b566f (diff) | |
download | llvm-8d83867dc913bb1b40571c8b36726e22ff824a0d.zip llvm-8d83867dc913bb1b40571c8b36726e22ff824a0d.tar.gz llvm-8d83867dc913bb1b40571c8b36726e22ff824a0d.tar.bz2 |
[Frontend] Use std::optional in CompilerInstance.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index c039169..b3ec8e4 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -55,6 +55,7 @@ #include "llvm/Support/TimeProfiler.h" #include "llvm/Support/Timer.h" #include "llvm/Support/raw_ostream.h" +#include <optional> #include <time.h> #include <utility> @@ -804,7 +805,7 @@ std::unique_ptr<raw_pwrite_stream> CompilerInstance::createDefaultOutputFile( bool Binary, StringRef InFile, StringRef Extension, bool RemoveFileOnSignal, bool CreateMissingDirectories, bool ForceUseTemporary) { StringRef OutputPath = getFrontendOpts().OutputFile; - Optional<SmallString<128>> PathStorage; + std::optional<SmallString<128>> PathStorage; if (OutputPath.empty()) { if (InFile == "-" || Extension.empty()) { OutputPath = "-"; @@ -848,7 +849,7 @@ CompilerInstance::createOutputFileImpl(StringRef OutputPath, bool Binary, // If '-working-directory' was passed, the output filename should be // relative to that. - Optional<SmallString<128>> AbsPath; + std::optional<SmallString<128>> AbsPath; if (OutputPath != "-" && !llvm::sys::path::is_absolute(OutputPath)) { AbsPath.emplace(OutputPath); FileMgr->FixupRelativePath(*AbsPath); @@ -856,7 +857,7 @@ CompilerInstance::createOutputFileImpl(StringRef OutputPath, bool Binary, } std::unique_ptr<llvm::raw_fd_ostream> OS; - Optional<StringRef> OSFile; + std::optional<StringRef> OSFile; if (UseTemporary) { if (OutputPath == "-") |