[llvm] r290719 - [ADT] Rename RefCountedBase::ref_cnt to RefCount. NFC
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 29 11:59:34 PST 2016
Author: jlebar
Date: Thu Dec 29 13:59:34 2016
New Revision: 290719
URL: http://llvm.org/viewvc/llvm-project?rev=290719&view=rev
Log:
[ADT] Rename RefCountedBase::ref_cnt to RefCount. NFC
This makes it comply with the LLVM style guide, and also makes it
consistent with ThreadSafeRefCountedBase below.
Modified:
llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
Modified: llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h?rev=290719&r1=290718&r2=290719&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h (original)
+++ llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h Thu Dec 29 13:59:34 2016
@@ -38,16 +38,16 @@ namespace llvm {
/// reference count hits 0) on such objects is an error.
//===----------------------------------------------------------------------===//
template <class Derived> class RefCountedBase {
- mutable unsigned ref_cnt = 0;
+ mutable unsigned RefCount = 0;
public:
RefCountedBase() = default;
- RefCountedBase(const RefCountedBase &) : ref_cnt(0) {}
+ RefCountedBase(const RefCountedBase &) : RefCount(0) {}
- void Retain() const { ++ref_cnt; }
+ void Retain() const { ++RefCount; }
void Release() const {
- assert(ref_cnt > 0 && "Reference count is already zero.");
- if (--ref_cnt == 0)
+ assert(RefCount > 0 && "Reference count is already zero.");
+ if (--RefCount == 0)
delete static_cast<const Derived *>(this);
}
};
More information about the llvm-commits
mailing list