[cfe-commits] r39041 - /cfe/cfe/trunk/Driver/clang.cpp

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:27:03 PDT 2007


Author: sabre
Date: Wed Jul 11 11:27:03 2007
New Revision: 39041

URL: http://llvm.org/viewvc/llvm-project?rev=39041&view=rev
Log:
Return an error code if an error occurs.

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

Modified: cfe/cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/clang.cpp?rev=39041&r1=39040&r2=39041&view=diff

==============================================================================
--- cfe/cfe/trunk/Driver/clang.cpp (original)
+++ cfe/cfe/trunk/Driver/clang.cpp Wed Jul 11 11:27:03 2007
@@ -38,6 +38,7 @@
 using namespace clang;
 
 static unsigned NumDiagnostics = 0;
+static unsigned NumErrors = 0;
 
 //===----------------------------------------------------------------------===//
 // Global options.
@@ -398,11 +399,12 @@
   
   switch (Level) {
   default: assert(0 && "Unknown diagnostic type!");
-  case Diagnostic::Note: std::cerr << "note: "; break;
-  case Diagnostic::Warning: std::cerr << "warning: "; break;
-  case Diagnostic::Error: std::cerr << "error: "; break;
-  case Diagnostic::Fatal: std::cerr << "fatal error: "; break;
-  case Diagnostic::Sorry: std::cerr << "sorry, unimplemented: "; break;
+  case Diagnostic::Note:                 std::cerr << "note: "; break;
+  case Diagnostic::Warning:              std::cerr << "warning: "; break;
+  case Diagnostic::Error:   ++NumErrors; std::cerr << "error: "; break;
+  case Diagnostic::Fatal:   ++NumErrors; std::cerr << "fatal error: "; break;
+  case Diagnostic::Sorry:   ++NumErrors; std::cerr << "sorry, unimplemented: ";
+    break;
   }
   
   std::string Msg = Diagnostic::getDescription(ID);
@@ -947,4 +949,6 @@
     PP.PrintStats();
     std::cerr << "\n";
   }
+  
+  return NumErrors != 0;
 }





More information about the cfe-commits mailing list