summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Statistic.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-12-06 18:20:44 +0000
committerChris Lattner <sabre@nondot.org>2006-12-06 18:20:44 +0000
commit5bbf77076401f7fd5057cdd2dd24589f4306fd56 (patch)
tree6da8600fd7cc35a0b8953b7b55b03a21e23b8727 /llvm/lib/Support/Statistic.cpp
parent7c779fcad46e30d01d5878af9569fa00dc67b0ca (diff)
downloadbcm5719-llvm-5bbf77076401f7fd5057cdd2dd24589f4306fd56.tar.gz
bcm5719-llvm-5bbf77076401f7fd5057cdd2dd24589f4306fd56.zip
merge the Statistic and StatisticBase classes, eliminating virtual methods
and eliminating #includes from the Statistic.h file. llvm-svn: 32282
Diffstat (limited to 'llvm/lib/Support/Statistic.cpp')
-rw-r--r--llvm/lib/Support/Statistic.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp
index cd516626361..19cfff33aac 100644
--- a/llvm/lib/Support/Statistic.cpp
+++ b/llvm/lib/Support/Statistic.cpp
@@ -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 @@ using namespace llvm;
// 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 @@ struct StatRecord {
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) {
OpenPOWER on IntegriCloud