Author: Kazu Hirata Date: 2022-12-09T23:16:32-08:00 New Revision: 8d83867dc913bb1b40571c8b36726e22ff824a0d
URL: https://github.com/llvm/llvm-project/commit/8d83867dc913bb1b40571c8b36726e22ff824a0d DIFF: https://github.com/llvm/llvm-project/commit/8d83867dc913bb1b40571c8b36726e22ff824a0d.diff LOG: [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 Added: Modified: clang/lib/Frontend/CompilerInstance.cpp Removed: ################################################################################ diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index c039169ff150..b3ec8e48be82 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 == "-") _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits