[llvm-commits] [llvm] r145389 - in /llvm/trunk/lib/Support/Windows: Program.inc Signals.inc

NAKAMURA Takumi geek4civic at gmail.com
Mon Nov 28 23:47:04 PST 2011


Author: chapuni
Date: Tue Nov 29 01:47:04 2011
New Revision: 145389

URL: http://llvm.org/viewvc/llvm-project?rev=145389&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Support/Windows/Program.inc
    llvm/trunk/lib/Support/Windows/Signals.inc

Modified: llvm/trunk/lib/Support/Windows/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Program.inc?rev=145389&r1=145388&r2=145389&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Program.inc (original)
+++ llvm/trunk/lib/Support/Windows/Program.inc Tue Nov 29 01:47:04 2011
@@ -367,7 +367,17 @@
     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

Modified: llvm/trunk/lib/Support/Windows/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Signals.inc?rev=145389&r1=145388&r2=145389&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Signals.inc (original)
+++ llvm/trunk/lib/Support/Windows/Signals.inc Tue Nov 29 01:47:04 2011
@@ -446,7 +446,7 @@
   }
 
   if (ExitOnUnhandledExceptions)
-    _exit(-3);
+    _exit(ep->ExceptionRecord->ExceptionCode);
 
   // Allow dialog box to pop up allowing choice to start debugger.
   if (OldFilter)





More information about the llvm-commits mailing list