[llvm-commits] CVS: llvm/lib/Support/Statistic.cpp

Chris Lattner sabre at nondot.org
Wed Dec 6 10:20:59 PST 2006



Changes in directory llvm/lib/Support:

Statistic.cpp updated: 1.19 -> 1.20
---
Log message:

merge the Statistic and StatisticBase classes, eliminating virtual methods
and eliminating #includes from the Statistic.h file.


---
Diffs of the changes:  (+5 -10)

 Statistic.cpp |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)


Index: llvm/lib/Support/Statistic.cpp
diff -u llvm/lib/Support/Statistic.cpp:1.19 llvm/lib/Support/Statistic.cpp:1.20
--- llvm/lib/Support/Statistic.cpp:1.19	Wed Dec  6 11:46:32 2006
+++ llvm/lib/Support/Statistic.cpp	Wed Dec  6 12:20:44 2006
@@ -23,6 +23,7 @@
 
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/ADT/StringExtras.h"
 #include <sstream>
 #include <iostream>
 #include <algorithm>
@@ -31,7 +32,7 @@
 // GetLibSupportInfoOutputFile - Return a file stream to print our output on...
 namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
 
-unsigned StatisticBase::NumStats = 0;
+unsigned Statistic::NumStats = 0;
 
 // -stats - Command line option to cause transformations to emit stats about
 // what they did.
@@ -61,19 +62,13 @@
 
 static std::vector<StatRecord> *AccumStats = 0;
 
-// Out of line virtual dtor, to give the vtable etc a home.
-StatisticBase::~StatisticBase() {
-}
-
 // Print information when destroyed, iff command line option is specified
-void StatisticBase::destroy() const {
-  if (Enabled && hasSomeData()) {
+Statistic::~Statistic() {
+  if (Enabled && Value != 0) {
     if (AccumStats == 0)
       AccumStats = new std::vector<StatRecord>();
 
-    std::ostringstream Out;
-    printValue(Out);
-    AccumStats->push_back(StatRecord(Out.str(), Name, Desc));
+    AccumStats->push_back(StatRecord(utostr(Value), Name, Desc));
   }
 
   if (--NumStats == 0 && AccumStats) {






More information about the llvm-commits mailing list