Changes in directory llvm/include/llvm/ADT:
Statistic.h updated: 1.18 -> 1.19 --- Log message: merge the Statistic and StatisticBase classes, eliminating virtual methods and eliminating #includes from the Statistic.h file. --- Diffs of the changes: (+6 -37) Statistic.h | 43 ++++++------------------------------------- 1 files changed, 6 insertions(+), 37 deletions(-) Index: llvm/include/llvm/ADT/Statistic.h diff -u llvm/include/llvm/ADT/Statistic.h:1.18 llvm/include/llvm/ADT/Statistic.h:1.19 --- llvm/include/llvm/ADT/Statistic.h:1.18 Wed Dec 6 11:46:31 2006 +++ llvm/include/llvm/ADT/Statistic.h Wed Dec 6 12:20:44 2006 @@ -26,53 +26,22 @@ #ifndef LLVM_ADT_STATISTIC_H #define LLVM_ADT_STATISTIC_H -#include <ostream> -#include "llvm/Support/Compiler.h" - namespace llvm { -// StatisticBase - Nontemplated base class for Statistic class... -class StatisticBase { +class Statistic { const char *Name; const char *Desc; - static unsigned NumStats; -protected: - StatisticBase(const char *name, const char *desc) : Name(name), Desc(desc) { - ++NumStats; // Keep track of how many stats are created... - } - // Out of line virtual dtor, to give the vtable etc a home. - virtual ~StatisticBase(); - - // destroy - Called by subclass dtor so that we can still invoke virtual - // functions on the subclass. - void destroy() const; - - // printValue - Overridden by template class to print out the value type... - virtual void printValue(std::ostream &o) const = 0; - - // hasSomeData - Return true if some data has been aquired. Avoid printing - // lots of zero counts. - // - virtual bool hasSomeData() const = 0; -}; - -// Statistic Class - templated on the data type we are monitoring... -class Statistic : private StatisticBase { unsigned Value; - - virtual void printValue(std::ostream &o) const { o << Value; } - virtual bool hasSomeData() const { return Value != 0; } + static unsigned NumStats; public: // Normal constructor, default initialize data item... Statistic(const char *name, const char *desc) - : StatisticBase(name, desc), Value(0) {} - - // Constructor to provide an initial value... - Statistic(const unsigned &Val, const char *name, const char *desc) - : StatisticBase(name, desc), Value(Val) {} + : Name(name), Desc(desc), Value(0) { + ++NumStats; // Keep track of how many stats are created... + } // Print information when destroyed, iff command line option is specified - ~Statistic() { destroy(); } + ~Statistic(); // Allow use of this class as the value itself... operator unsigned() const { return Value; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits