diff options
author | Pierre Moreau <dev@pmoreau.org> | 2018-04-17 18:34:34 +0200 |
---|---|---|
committer | Alexey Sotkin <alexey.sotkin@intel.com> | 2018-04-24 12:21:49 +0300 |
commit | 24bf6ffe25759cf4a14cbee902ee0ddd43dff589 (patch) | |
tree | 8af395b7a078c2b2ee0c75ddba43f4884faef02a | |
parent | ab08aa8849abab7f9d8d942f98b2512a2585a64e (diff) |
Rename RefCount::m_refCount to Count
m_refCount does not follow LLVM’s naming guidelines as it uses the “m_”
prefix and does not start with a capital letter. Removing the prefix and
changing the first letter to be a capital letter would result in
“RefCount” which is the class name and causes compilation issues. Hence
why the rename to “Count”.
Command used: sed -i 's/m_refCount/Count/g' `find . -iname "*.cpp"` `find . -iname "*.h"`
-rw-r--r-- | lib/SPIRV/Mangler/Refcount.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/SPIRV/Mangler/Refcount.h b/lib/SPIRV/Mangler/Refcount.h index 95d2299..0ff1d81 100644 --- a/lib/SPIRV/Mangler/Refcount.h +++ b/lib/SPIRV/Mangler/Refcount.h @@ -19,21 +19,21 @@ namespace SPIR { template <typename T> class RefCount { public: - RefCount() : m_refCount(0), m_ptr(0) {} + RefCount() : Count(0), m_ptr(0) {} - RefCount(T *ptr) : m_ptr(ptr) { m_refCount = new int(1); } + RefCount(T *ptr) : m_ptr(ptr) { Count = new int(1); } RefCount(const RefCount<T> &other) { cpy(other); } ~RefCount() { - if (m_refCount) + if (Count) dispose(); } RefCount &operator=(const RefCount<T> &other) { if (this == &other) return *this; - if (m_refCount) + if (Count) dispose(); cpy(other); return *this; @@ -41,8 +41,8 @@ public: void init(T *ptr) { assert(!m_ptr && "overrunning non NULL pointer"); - assert(!m_refCount && "overrunning non NULL pointer"); - m_refCount = new int(1); + assert(!Count && "overrunning non NULL pointer"); + Count = new int(1); m_ptr = ptr; } @@ -70,28 +70,28 @@ public: private: void sanity() const { assert(m_ptr && "NULL pointer"); - assert(m_refCount && "NULL ref counter"); - assert(*m_refCount && "zero ref counter"); + assert(Count && "NULL ref counter"); + assert(*Count && "zero ref counter"); } void cpy(const RefCount<T> &other) { - m_refCount = other.m_refCount; + Count = other.Count; m_ptr = other.m_ptr; - if (m_refCount) - ++*m_refCount; + if (Count) + ++*Count; } void dispose() { sanity(); - if (0 == --*m_refCount) { - delete m_refCount; + if (0 == --*Count) { + delete Count; delete m_ptr; m_ptr = 0; - m_refCount = 0; + Count = 0; } } - int *m_refCount; + int *Count; T *m_ptr; }; // End RefCount |