[cfe-commits] r104417 - /cfe/trunk/lib/Driver/Driver.cpp

Daniel Dunbar daniel at zuster.org
Fri May 21 17:37:20 PDT 2010


Author: ddunbar
Date: Fri May 21 19:37:20 2010
New Revision: 104417

URL: http://llvm.org/viewvc/llvm-project?rev=104417&view=rev
Log:
Driver: When printing a "command was signalled" type of diagnostic, use the
short name of the tool in use, instead of the name of the action that created
the command. The practical impact is we now get:
  clang: error: clang frontend command failed due to signal 6 (use -v to see invocation)
instead of:
  clang: error: assembler command failed due to signal 6 (use -v to see invocation)
when clang crashes on a job that uses the integrated assembler.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=104417&r1=104416&r2=104417&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri May 21 19:37:20 2010
@@ -227,28 +227,31 @@
   // Remove temp files.
   C.CleanupFileList(C.getTempFiles());
 
-  // If the compilation failed, remove result files as well.
-  if (Res != 0 && !C.getArgs().hasArg(options::OPT_save_temps))
+  // If the command succeeded, we are done.
+  if (Res == 0)
+    return Res;
+
+  // Otherwise, remove result files as well.
+  if (!C.getArgs().hasArg(options::OPT_save_temps))
     C.CleanupFileList(C.getResultFiles(), true);
 
   // Print extra information about abnormal failures, if possible.
-  if (Res) {
-    // This is ad-hoc, but we don't want to be excessively noisy. If the result
-    // status was 1, assume the command failed normally. In particular, if it
-    // was the compiler then assume it gave a reasonable error code. Failures in
-    // other tools are less common, and they generally have worse diagnostics,
-    // so always print the diagnostic there.
-    const Action &Source = FailingCommand->getSource();
-
-    if (!FailingCommand->getCreator().hasGoodDiagnostics() || Res != 1) {
-      // FIXME: See FIXME above regarding result code interpretation.
-      if (Res < 0)
-        Diag(clang::diag::err_drv_command_signalled)
-          << Source.getClassName() << -Res;
-      else
-        Diag(clang::diag::err_drv_command_failed)
-          << Source.getClassName() << Res;
-    }
+  //
+  // This is ad-hoc, but we don't want to be excessively noisy. If the result
+  // status was 1, assume the command failed normally. In particular, if it was
+  // the compiler then assume it gave a reasonable error code. Failures in other
+  // tools are less common, and they generally have worse diagnostics, so always
+  // print the diagnostic there.
+  const Tool &FailingTool = FailingCommand->getCreator();
+
+  if (!FailingCommand->getCreator().hasGoodDiagnostics() || Res != 1) {
+    // FIXME: See FIXME above regarding result code interpretation.
+    if (Res < 0)
+      Diag(clang::diag::err_drv_command_signalled)
+        << FailingTool.getShortName() << -Res;
+    else
+      Diag(clang::diag::err_drv_command_failed)
+        << FailingTool.getShortName() << Res;
   }
 
   return Res;





More information about the cfe-commits mailing list