mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
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
This commit is contained in:
parent
36343735cb
commit
3d3a429acb
@ -51,7 +51,7 @@ public:
|
||||
const StatisticBase &operator*=(const unsigned &V) {Value *= V;return init();}
|
||||
const StatisticBase &operator/=(const unsigned &V) {Value /= V;return init();}
|
||||
|
||||
private:
|
||||
protected:
|
||||
StatisticBase &init() {
|
||||
if (!Initialized) RegisterStatistic();
|
||||
return *this;
|
||||
@ -63,6 +63,18 @@ struct Statistic : public StatisticBase {
|
||||
Statistic(const char *name, const char *desc) {
|
||||
Name = name; Desc = desc; Value = 0; Initialized = 0;
|
||||
}
|
||||
|
||||
// Allow use of this class as the value itself.
|
||||
operator unsigned() const { return Value; }
|
||||
const Statistic &operator=(unsigned Val) { Value = Val; init(); return *this;}
|
||||
const Statistic &operator++() { ++Value; init(); return *this;}
|
||||
unsigned operator++(int) { init(); return Value++; }
|
||||
const Statistic &operator--() { --Value; init(); return *this;}
|
||||
unsigned operator--(int) { init(); return Value--; }
|
||||
const Statistic &operator+=(const unsigned &V) {Value += V;init();return *this;}
|
||||
const Statistic &operator-=(const unsigned &V) {Value -= V;init();return *this;}
|
||||
const Statistic &operator*=(const unsigned &V) {Value *= V;init();return *this;}
|
||||
const Statistic &operator/=(const unsigned &V) {Value /= V;init();return *this;}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user