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

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:25:39 PDT 2007


Author: sabre
Date: Wed Jul 11 11:25:39 2007
New Revision: 38905

URL: http://llvm.org/viewvc/llvm-project?rev=38905&view=rev
Log:
Count the number of diagnostics emitted.

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=38905&r1=38904&r2=38905&view=diff

==============================================================================
--- cfe/cfe/trunk/Driver/clang.cpp (original)
+++ cfe/cfe/trunk/Driver/clang.cpp Wed Jul 11 11:25:39 2007
@@ -35,6 +35,8 @@
 using namespace llvm;
 using namespace clang;
 
+static unsigned NumDiagnostics = 0;
+
 //===----------------------------------------------------------------------===//
 // Global options.
 //===----------------------------------------------------------------------===//
@@ -150,6 +152,7 @@
                                                SourceLocation Pos,
                                                diag::kind ID, 
                                                const std::string &Extra) {
+  ++NumDiagnostics;
   unsigned LineNo = 0, FilePos = 0, FileID = 0, ColNo = 0;
   unsigned LineStart = 0, LineEnd = 0;
   const SourceBuffer *Buffer = 0;
@@ -756,6 +759,9 @@
     break;
   }
   
+  if (NumDiagnostics)
+    std::cerr << NumDiagnostics << " diagnostics generated.\n";
+  
   if (Stats) {
     // Printed from low-to-high level.
     PP.getFileManager().PrintStats();





More information about the cfe-commits mailing list