[cfe-commits] r99878 - in /cfe/trunk/tools/driver: cc1_main.cpp driver.cpp

Chris Lattner sabre at nondot.org
Mon Mar 29 22:39:52 PDT 2010


Author: lattner
Date: Tue Mar 30 00:39:52 2010
New Revision: 99878

URL: http://llvm.org/viewvc/llvm-project?rev=99878&view=rev
Log:
make -ftime-report work even in -disable-free mode.  Woo, finally.

rdar://7781603

Modified:
    cfe/trunk/tools/driver/cc1_main.cpp
    cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=99878&r1=99877&r2=99878&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Tue Mar 30 00:39:52 2010
@@ -31,6 +31,7 @@
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/Timer.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/System/DynamicLibrary.h"
 #include "llvm/Target/TargetSelect.h"
@@ -272,6 +273,10 @@
     }
   }
 
+  // If any timers were active but haven't been destroyed yet, print their
+  // results now.  This happens in -disable-free mode.
+  llvm::TimerGroup::printAll(llvm::errs());
+  
   // When running with -disable-free, don't do any destruction or shutdown.
   if (Clang->getFrontendOpts().DisableFree) {
     Clang.take();

Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=99878&r1=99877&r2=99878&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Tue Mar 30 00:39:52 2010
@@ -24,6 +24,7 @@
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Regex.h"
+#include "llvm/Support/Timer.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Host.h"
 #include "llvm/System/Path.h"
@@ -73,10 +74,10 @@
 /// \param Args - The vector of command line arguments.
 /// \param Edit - The override command to perform.
 /// \param SavedStrings - Set to use for storing string representations.
-void ApplyOneQAOverride(llvm::raw_ostream &OS,
-                        std::vector<const char*> &Args,
-                        llvm::StringRef Edit,
-                        std::set<std::string> &SavedStrings) {
+static void ApplyOneQAOverride(llvm::raw_ostream &OS,
+                               std::vector<const char*> &Args,
+                               llvm::StringRef Edit,
+                               std::set<std::string> &SavedStrings) {
   // This does not need to be efficient.
 
   if (Edit[0] == '^') {
@@ -140,8 +141,9 @@
 
 /// ApplyQAOverride - Apply a comma separate list of edits to the
 /// input argument lists. See ApplyOneQAOverride.
-void ApplyQAOverride(std::vector<const char*> &Args, const char *OverrideStr,
-                     std::set<std::string> &SavedStrings) {
+static void ApplyQAOverride(std::vector<const char*> &Args,
+                            const char *OverrideStr,
+                            std::set<std::string> &SavedStrings) {
   llvm::raw_ostream *OS = &llvm::errs();
 
   if (OverrideStr[0] == '#') {
@@ -265,6 +267,11 @@
   if (C.get())
     Res = TheDriver.ExecuteCompilation(*C);
 
+  
+  // If any timers were active but haven't been destroyed yet, print their
+  // results now.  This happens in -disable-free mode.
+  llvm::TimerGroup::printAll(llvm::errs());
+  
   llvm::llvm_shutdown();
 
   return Res;





More information about the cfe-commits mailing list