diff utils/not/not.cpp @ 77:54457678186b LLVM3.6

LLVM 3.6
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 08 Sep 2014 22:06:00 +0900
parents 95c75e76d11b
children 60c9769439b8
line wrap: on
line diff
--- a/utils/not/not.cpp	Thu Dec 12 15:22:36 2013 +0900
+++ b/utils/not/not.cpp	Mon Sep 08 22:06:00 2014 +0900
@@ -30,7 +30,16 @@
   std::string Program = sys::FindProgramByName(argv[0]);
 
   std::string ErrMsg;
-  int Result = sys::ExecuteAndWait(Program, argv, 0, 0, 0, 0, &ErrMsg);
+  int Result = sys::ExecuteAndWait(Program, argv, nullptr, nullptr, 0, 0,
+                                   &ErrMsg);
+#ifdef _WIN32
+  // Handle abort() in msvcrt -- It has exit code as 3.  abort(), aka
+  // unreachable, should be recognized as a crash.  However, some binaries use
+  // exit code 3 on non-crash failure paths, so only do this if we expect a
+  // crash.
+  if (ExpectCrash && Result == 3)
+    Result = -3;
+#endif
   if (Result < 0) {
     errs() << "Error: " << ErrMsg << "\n";
     if (ExpectCrash)