aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Windows/Program.inc
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2011-11-29 07:47:04 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2011-11-29 07:47:04 +0000
commit64404a3b2c62db01c3a4459a2c15c37496ed9f65 (patch)
tree0664df2b6417bce6b732ed39710270acc70c0f26 /llvm/lib/Support/Windows/Program.inc
parent0e5bae71917ad2f66b57c5adcfea3cb083a7b986 (diff)
downloadllvm-64404a3b2c62db01c3a4459a2c15c37496ed9f65.zip
llvm-64404a3b2c62db01c3a4459a2c15c37496ed9f65.tar.gz
llvm-64404a3b2c62db01c3a4459a2c15c37496ed9f65.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Support/Windows/Program.inc')
-rw-r--r--llvm/lib/Support/Windows/Program.inc12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Support/Windows/Program.inc b/llvm/lib/Support/Windows/Program.inc
index 7e38168..80cb7cc 100644
--- a/llvm/lib/Support/Windows/Program.inc
+++ b/llvm/lib/Support/Windows/Program.inc
@@ -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