forked from OSchip/llvm-project
[Win32] Catch exceptions (eg. segfault) on waiting for invoked clang from the driver.
clang/lib/Driver/Driver.cpp: Don't pass through negative exit status, or parent would be confused. llvm::sys::Program::Wait(): Suppose 0x8000XXXX and 0xC000XXXX as abnormal exit code and pass it as negative value. Win32 Exception Handler: Exit with ExceptionCode on an unhandle exception. llvm-svn: 145389
This commit is contained in:
parent
0e5bae7191
commit
64404a3b2c
|
@ -511,8 +511,14 @@ int Driver::ExecuteCompilation(const Compilation &C,
|
|||
C.CleanupFileList(C.getResultFiles(), true);
|
||||
|
||||
// Failure result files are valid unless we crashed.
|
||||
if (Res < 0)
|
||||
if (Res < 0) {
|
||||
C.CleanupFileList(C.getFailureResultFiles(), true);
|
||||
#ifdef _WIN32
|
||||
// Exit status should not be negative on Win32,
|
||||
// unless abnormal termination.
|
||||
Res = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Print extra information about abnormal failures, if possible.
|
||||
|
|
|
@ -367,7 +367,17 @@ Program::Wait(const Path &path,
|
|||
return -2;
|
||||
}
|
||||
|
||||
return status & 0377;
|
||||
if (!status)
|
||||
return 0;
|
||||
|
||||
// Pass 10(Warning) and 11(Error) to the callee as negative value.
|
||||
if ((status & 0xBFFF0000U) == 0x80000000U)
|
||||
return (int)status;
|
||||
|
||||
if (status & 0xFF)
|
||||
return status & 0x7FFFFFFF;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -446,7 +446,7 @@ static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
|
|||
}
|
||||
|
||||
if (ExitOnUnhandledExceptions)
|
||||
_exit(-3);
|
||||
_exit(ep->ExceptionRecord->ExceptionCode);
|
||||
|
||||
// Allow dialog box to pop up allowing choice to start debugger.
|
||||
if (OldFilter)
|
||||
|
|
Loading…
Reference in New Issue