]> granicus.if.org Git - clang/commitdiff
[Win32] Catch exceptions (eg. segfault) on waiting for invoked clang from the driver.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 29 Nov 2011 07:47:04 +0000 (07:47 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 29 Nov 2011 07:47:04 +0000 (07:47 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145389 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp

index 086e3a411f35916fc6e7d59759008a5b74fb8684..ec344e0c788455d05c685abff12564444ee80191 100644 (file)
@@ -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.