diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/Process.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Support/Process.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/Process.cpp b/contrib/llvm-project/llvm/lib/Support/Process.cpp index 9e6e233b26ac..e0814444876c 100644 --- a/contrib/llvm-project/llvm/lib/Support/Process.cpp +++ b/contrib/llvm-project/llvm/lib/Support/Process.cpp @@ -20,6 +20,8 @@ #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" +#include <stdlib.h> // for _Exit + using namespace llvm; using namespace sys; @@ -28,21 +30,22 @@ using namespace sys; //=== independent code. //===----------------------------------------------------------------------===// -Optional<std::string> Process::FindInEnvPath(StringRef EnvName, - StringRef FileName) { - return FindInEnvPath(EnvName, FileName, {}); +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) { + ArrayRef<std::string> IgnoreList, + char Separator) { assert(!path::is_absolute(FileName)); Optional<std::string> FoundPath; Optional<std::string> OptPath = Process::GetEnv(EnvName); if (!OptPath.hasValue()) return FoundPath; - const char EnvPathSeparatorStr[] = {EnvPathSeparator, '\0'}; + const char EnvPathSeparatorStr[] = {Separator, '\0'}; SmallVector<StringRef, 8> Dirs; SplitString(OptPath.getValue(), Dirs, EnvPathSeparatorStr); @@ -90,10 +93,14 @@ static bool coreFilesPrevented = !LLVM_ENABLE_CRASH_DUMPS; bool Process::AreCoreFilesPrevented() { return coreFilesPrevented; } LLVM_ATTRIBUTE_NORETURN -void Process::Exit(int RetCode) { +void Process::Exit(int RetCode, bool NoCleanup) { if (CrashRecoveryContext *CRC = CrashRecoveryContext::GetCurrent()) CRC->HandleExit(RetCode); - ::exit(RetCode); + + if (NoCleanup) + _Exit(RetCode); + else + ::exit(RetCode); } // Include the platform-specific parts of this class. |