[driver] Do not generate crash diagnostics if the compilation command failed
authorChad Rosier <mcrosier@apple.com>
Tue, 26 Mar 2013 23:41:30 +0000 (23:41 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 26 Mar 2013 23:41:30 +0000 (23:41 +0000)
to execute as the crash will surely reoccur while generating the diagnostics.
rdar://13362359

llvm-svn: 178089

clang/lib/Driver/Compilation.cpp

index db948a5..1bff4a3 100644 (file)
@@ -290,11 +290,12 @@ int Compilation::ExecuteCommand(const Command &C,
   }
 
   std::string Error;
+  bool ExecutionFailed;
   int Res =
     llvm::sys::Program::ExecuteAndWait(Prog, Argv,
                                        /*env*/0, Redirects,
                                        /*secondsToWait*/0, /*memoryLimit*/0,
-                                       &Error);
+                                       &Error, &ExecutionFailed);
   if (!Error.empty()) {
     assert(Res && "Error string set with 0 result code!");
     getDriver().Diag(clang::diag::err_drv_command_failure) << Error;
@@ -304,7 +305,7 @@ int Compilation::ExecuteCommand(const Command &C,
     FailingCommand = &C;
 
   delete[] Argv;
-  return Res;
+  return ExecutionFailed ? 1 : Res;
 }
 
 typedef SmallVectorImpl< std::pair<int, const Command *> > FailingCommandList;