diff options
author | Krzysztof Parzyszek <kparzysz@quicinc.com> | 2022-12-06 09:53:37 -0800 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@quicinc.com> | 2022-12-06 09:56:14 -0800 |
commit | 3c255f679c90e332fe0b38b09d5811a64db3f0f6 (patch) | |
tree | 824a5b686ddb65c32accffd5e60b394700d61947 /clang/lib/Driver/Driver.cpp | |
parent | aa6ea6009fc50b02dbf3788ee9fe605081b154f6 (diff) | |
download | llvm-3c255f679c90e332fe0b38b09d5811a64db3f0f6.zip llvm-3c255f679c90e332fe0b38b09d5811a64db3f0f6.tar.gz llvm-3c255f679c90e332fe0b38b09d5811a64db3f0f6.tar.bz2 |
Process: convert Optional to std::optional
This applies to GetEnv and FindInEnvPath.
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 05cc68e..cf0a596 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -97,6 +97,7 @@ #include <cstdlib> // ::getenv #include <map> #include <memory> +#include <optional> #include <utility> #if LLVM_ON_UNIX #include <unistd.h> // getpid @@ -575,7 +576,7 @@ static llvm::Triple computeTargetTriple(const Driver &D, // On AIX, the env OBJECT_MODE may affect the resulting arch variant. if (Target.isOSAIX()) { - if (Optional<std::string> ObjectModeValue = + if (std::optional<std::string> ObjectModeValue = llvm::sys::Process::GetEnv("OBJECT_MODE")) { StringRef ObjectMode = *ObjectModeValue; llvm::Triple::ArchType AT = llvm::Triple::UnknownArch; @@ -1277,7 +1278,7 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) { A->claim(); PrefixDirs.push_back(A->getValue(0)); } - if (Optional<std::string> CompilerPathValue = + if (std::optional<std::string> CompilerPathValue = llvm::sys::Process::GetEnv("COMPILER_PATH")) { StringRef CompilerPath = *CompilerPathValue; while (!CompilerPath.empty()) { @@ -5460,7 +5461,7 @@ const char *Driver::CreateTempFile(Compilation &C, StringRef Prefix, StringRef BoundArch) const { SmallString<128> TmpName; Arg *A = C.getArgs().getLastArg(options::OPT_fcrash_diagnostics_dir); - Optional<std::string> CrashDirectory = + std::optional<std::string> CrashDirectory = CCGenDiagnostics && A ? std::string(A->getValue()) : llvm::sys::Process::GetEnv("CLANG_CRASH_DIAGNOSTICS_DIR"); |