[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
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 086e3a4..ec344e0 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -511,8 +511,14 @@
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.