diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-04-14 21:41:27 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-07-23 17:38:08 +0000 |
commit | 320d4fb58b6b1c6a0c7ffeab3d4672d1479d5e17 (patch) | |
tree | 4b5e279a6f091bb6bdc639752cf4139dfd7053a4 /contrib/llvm-project/llvm/lib/Support/Process.cpp | |
parent | 814cfa6ad43c73de9b8030f241f516dad3f669ef (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/Process.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Support/Process.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/Process.cpp b/contrib/llvm-project/llvm/lib/Support/Process.cpp index 5476becc2945..30c64d3ed9ed 100644 --- a/contrib/llvm-project/llvm/lib/Support/Process.cpp +++ b/contrib/llvm-project/llvm/lib/Support/Process.cpp @@ -20,6 +20,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" +#include <optional> #include <stdlib.h> // for _Exit using namespace llvm; @@ -30,24 +31,23 @@ using namespace sys; //=== independent code. //===----------------------------------------------------------------------===// -Optional<std::string> +std::optional<std::string> Process::FindInEnvPath(StringRef EnvName, StringRef FileName, char Separator) { return FindInEnvPath(EnvName, FileName, {}, Separator); } -Optional<std::string> Process::FindInEnvPath(StringRef EnvName, - StringRef FileName, - ArrayRef<std::string> IgnoreList, - char Separator) { +std::optional<std::string> +Process::FindInEnvPath(StringRef EnvName, StringRef FileName, + ArrayRef<std::string> IgnoreList, char Separator) { assert(!path::is_absolute(FileName)); - Optional<std::string> FoundPath; - Optional<std::string> OptPath = Process::GetEnv(EnvName); + std::optional<std::string> FoundPath; + std::optional<std::string> OptPath = Process::GetEnv(EnvName); if (!OptPath) return FoundPath; const char EnvPathSeparatorStr[] = {Separator, '\0'}; SmallVector<StringRef, 8> Dirs; - SplitString(OptPath.value(), Dirs, EnvPathSeparatorStr); + SplitString(*OptPath, Dirs, EnvPathSeparatorStr); for (StringRef Dir : Dirs) { if (Dir.empty()) |