From a2e405cb35ad2631e32ae96e57747605f35de7dc Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Fri, 13 Jun 2014 12:23:56 +0000 Subject: [PATCH] [Win32] Let utils/not aware of abort(), aka llvm_unreachable(), in msvcrt. It has exit code as 3. abort(), aka unreachable, may be handled as crash. FIXME: Could we move this into Win32/Program.inc? llvm-svn: 210895 --- llvm/utils/not/not.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/llvm/utils/not/not.cpp b/llvm/utils/not/not.cpp index 546f989..af94250 100644 --- a/llvm/utils/not/not.cpp +++ b/llvm/utils/not/not.cpp @@ -32,6 +32,13 @@ int main(int argc, const char **argv) { std::string ErrMsg; int Result = sys::ExecuteAndWait(Program, argv, nullptr, nullptr, 0, 0, &ErrMsg); +#ifdef _WIN32 + // Handle abort() in msvcrt -- It has exit code as 3. + // abort(), aka unreachable, may be handled as crash. + // FIXME: Could we move this into Win32/Program.inc? + if (Result == 3) + Result = -3; +#endif if (Result < 0) { errs() << "Error: " << ErrMsg << "\n"; if (ExpectCrash) -- 2.7.4