[cfe-commits] r99894 - in /cfe/trunk: lib/Frontend/CompilerInstance.cpp tools/driver/cc1_main.cpp

Douglas Gregor dgregor at apple.com
Tue Mar 30 10:33:59 PDT 2010


Author: dgregor
Date: Tue Mar 30 12:33:59 2010
New Revision: 99894

URL: http://llvm.org/viewvc/llvm-project?rev=99894&view=rev
Log:
Teach Clang's -cc1 option -print-stats to print LLVM statistics.

Modified:
    cfe/trunk/lib/Frontend/CompilerInstance.cpp
    cfe/trunk/tools/driver/cc1_main.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=99894&r1=99893&r2=99894&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Tue Mar 30 12:33:59 2010
@@ -29,6 +29,7 @@
 #include "llvm/LLVMContext.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/System/Host.h"
 #include "llvm/System/Path.h"
@@ -479,6 +480,9 @@
   if (getFrontendOpts().ShowTimers)
     createFrontendTimer();
 
+  if (getFrontendOpts().ShowStats)
+    llvm::EnableStatistics();
+    
   for (unsigned i = 0, e = getFrontendOpts().Inputs.size(); i != e; ++i) {
     const std::string &InFile = getFrontendOpts().Inputs[i].second;
 

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=99894&r1=99893&r2=99894&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Tue Mar 30 12:33:59 2010
@@ -29,6 +29,7 @@
 #include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "llvm/LLVMContext.h"
 #include "llvm/ADT/OwningPtr.h"
+#include "llvm/ADT/Statistic.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Timer.h"
@@ -279,6 +280,8 @@
   
   // When running with -disable-free, don't do any destruction or shutdown.
   if (Clang->getFrontendOpts().DisableFree) {
+    if (Clang->getFrontendOpts().ShowStats)
+      llvm::PrintStatistics();
     Clang.take();
     return !Success;
   }





More information about the cfe-commits mailing list