llvm.org GIT mirror llvm / 3d3a429
Added operator methods to the Statistic class; some LLVM projects depend on these. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32701 91177308-0d34-0410-b5e6-96231b3b80d8 John Criswell 13 years ago
1 changed file(s) with 13 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5050 const StatisticBase &operator*=(const unsigned &V) {Value *= V;return init();}
5151 const StatisticBase &operator/=(const unsigned &V) {Value /= V;return init();}
5252
53 private:
53 protected:
5454 StatisticBase &init() {
5555 if (!Initialized) RegisterStatistic();
5656 return *this;
6262 Statistic(const char *name, const char *desc) {
6363 Name = name; Desc = desc; Value = 0; Initialized = 0;
6464 }
65
66 // Allow use of this class as the value itself.
67 operator unsigned() const { return Value; }
68 const Statistic &operator=(unsigned Val) { Value = Val; init(); return *this;}
69 const Statistic &operator++() { ++Value; init(); return *this;}
70 unsigned operator++(int) { init(); return Value++; }
71 const Statistic &operator--() { --Value; init(); return *this;}
72 unsigned operator--(int) { init(); return Value--; }
73 const Statistic &operator+=(const unsigned &V) {Value += V;init();return *this;}
74 const Statistic &operator-=(const unsigned &V) {Value -= V;init();return *this;}
75 const Statistic &operator*=(const unsigned &V) {Value *= V;init();return *this;}
76 const Statistic &operator/=(const unsigned &V) {Value /= V;init();return *this;}
6577 };
6678
6779