Allow stat += 0 without activating the stat.

For me, this is a nice convenience. We generally want grep to match
stats output only when the event has occurred.

llvm-svn: 141574
This commit is contained in:
Andrew Trick 2011-10-10 19:48:56 +00:00
parent fe8c38a61e
commit 4c8a7dc833

View File

@ -84,11 +84,13 @@ public:
}
const Statistic &operator+=(const unsigned &V) {
if (!V) return *this;
sys::AtomicAdd(&Value, V);
return init();
}
const Statistic &operator-=(const unsigned &V) {
if (!V) return *this;
sys::AtomicAdd(&Value, -V);
return init();
}