Teach the driver about failure result files, which are compilation
output files that are valid regardless of whether the compilation
succeeded or failed (but not if we crash).  Add depfiles to the
failure result file list.

llvm-svn: 145018
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index feeeb04..086e3a4 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -507,9 +507,14 @@
     return Res;
 
   // Otherwise, remove result files as well.
-  if (!C.getArgs().hasArg(options::OPT_save_temps))
+  if (!C.getArgs().hasArg(options::OPT_save_temps)) {
     C.CleanupFileList(C.getResultFiles(), true);
 
+    // Failure result files are valid unless we crashed.
+    if (Res < 0)
+      C.CleanupFileList(C.getFailureResultFiles(), true);
+  }
+
   // Print extra information about abnormal failures, if possible.
   //
   // This is ad-hoc, but we don't want to be excessively noisy. If the result