Add external definitions for commonly-used template specializations and add
[oota-llvm.git] / lib / Support / Statistic.cpp
index 3ac2bf97fbe20fe0bb349d0be77658b444b616a7..d771f4dcfd33bb609dde8fd815f37f0d7cd1266c 100644 (file)
@@ -1,10 +1,10 @@
 //===-- Statistic.cpp - Easy way to expose stats information --------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This file implements the 'Statistic' class, which is designed to be an easy
 //
 //===----------------------------------------------------------------------===//
 
-#include "Support/Statistic.h"
-#include "Support/CommandLine.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/Support/CommandLine.h"
 #include <sstream>
 #include <iostream>
 #include <algorithm>
-
-namespace llvm {
+using namespace llvm;
 
 // GetLibSupportInfoOutputFile - Return a file stream to print our output on...
-extern std::ostream *GetLibSupportInfoOutputFile();
+namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
 
 unsigned StatisticBase::NumStats = 0;
 
@@ -44,7 +43,7 @@ struct StatRecord {
   std::string Value;
   const char *Name, *Desc;
 
-  StatRecord(const std::string V, const char *N, const char *D)
+  StatRecord(const std::string &V, const char *N, const char *D)
     : Value(V), Name(N), Desc(D) {}
 
   bool operator<(const StatRecord &SR) const {
@@ -62,6 +61,10 @@ 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()) {
@@ -79,9 +82,9 @@ void StatisticBase::destroy() const {
     // Figure out how long the biggest Value and Name fields are...
     unsigned MaxNameLen = 0, MaxValLen = 0;
     for (unsigned i = 0, e = AccumStats->size(); i != e; ++i) {
-      MaxValLen = std::max(MaxValLen, 
+      MaxValLen = std::max(MaxValLen,
                            (unsigned)(*AccumStats)[i].Value.length());
-      MaxNameLen = std::max(MaxNameLen, 
+      MaxNameLen = std::max(MaxNameLen,
                             (unsigned)std::strlen((*AccumStats)[i].Name));
     }
 
@@ -106,5 +109,3 @@ void StatisticBase::destroy() const {
       delete OutStream;   // Close the file...
   }
 }
-
-} // End llvm namespace