Teach Clang's -cc1 option -print-stats to print LLVM statistics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99894 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp
index 5770a1a..35854be 100644
--- a/tools/driver/cc1_main.cpp
+++ b/tools/driver/cc1_main.cpp
@@ -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;
   }