diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h --- a/llvm/include/llvm/Support/Process.h +++ b/llvm/include/llvm/Support/Process.h @@ -216,6 +216,10 @@ /// Use \arg NoCleanup for calling _exit() instead of exit(). LLVM_ATTRIBUTE_NORETURN static void Exit(int RetCode, bool NoCleanup = false); + +private: + LLVM_ATTRIBUTE_NORETURN + static void ExitNoCleanup(int RetCode); }; } diff --git a/llvm/lib/Support/Process.cpp b/llvm/lib/Support/Process.cpp --- a/llvm/lib/Support/Process.cpp +++ b/llvm/lib/Support/Process.cpp @@ -98,7 +98,7 @@ CRC->HandleExit(RetCode); if (NoCleanup) - _Exit(RetCode); + ExitNoCleanup(RetCode); else ::exit(RetCode); } diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc --- a/llvm/lib/Support/Unix/Process.inc +++ b/llvm/lib/Support/Unix/Process.inc @@ -460,3 +460,6 @@ return ::rand(); #endif } + +LLVM_ATTRIBUTE_NORETURN +void Process::ExitNoCleanup(int RetCode) { _Exit(RetCode); } diff --git a/llvm/lib/Support/Windows/Process.inc b/llvm/lib/Support/Windows/Process.inc --- a/llvm/lib/Support/Windows/Process.inc +++ b/llvm/lib/Support/Windows/Process.inc @@ -503,3 +503,9 @@ // Windows 8 is version 6.2, service pack 0. return GetWindowsOSVersion() >= llvm::VersionTuple(6, 2, 0, 0); } + +LLVM_ATTRIBUTE_NORETURN +void Process::ExitNoCleanup(int RetCode) { + TerminateProcess(GetCurrentProcess(), RetCode); + llvm_unreachable("TerminateProcess doesn't return"); +}