From 24bf6ffe25759cf4a14cbee902ee0ddd43dff589 Mon Sep 17 00:00:00 2001 From: Pierre Moreau Date: Tue, 17 Apr 2018 18:34:34 +0200 Subject: Rename RefCount::m_refCount to Count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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"` --- lib/SPIRV/Mangler/Refcount.h | 30 +++++++++++++++--------------- 1 file 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 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 &other) { cpy(other); } ~RefCount() { - if (m_refCount) + if (Count) dispose(); } RefCount &operator=(const RefCount &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 &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 -- cgit v1.2.3