[llvm-branch-commits] [llvm] c98a7ab - IntrusiveRefCntPtr: Ensure RefCount is initialized during ThreadSafeRefCountedBase copy construction
David Blaikie via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 3 18:47:38 PST 2020
Author: David Blaikie
Date: 2020-12-03T18:43:01-08:00
New Revision: c98a7ab1b1d647492554872e395b2ae5763fd23e
URL: https://github.com/llvm/llvm-project/commit/c98a7ab1b1d647492554872e395b2ae5763fd23e
DIFF: https://github.com/llvm/llvm-project/commit/c98a7ab1b1d647492554872e395b2ae5763fd23e.diff
LOG: IntrusiveRefCntPtr: Ensure RefCount is initialized during ThreadSafeRefCountedBase copy construction
Post commit feedback on 2e83ccc2ee33 from Nathan James!
Added:
Modified:
llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
index 42486d1616a8..41e5e6b9f8ed 100644
--- a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
+++ b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
@@ -86,10 +86,10 @@ template <class Derived> class RefCountedBase {
/// A thread-safe version of \c RefCountedBase.
template <class Derived> class ThreadSafeRefCountedBase {
- mutable std::atomic<int> RefCount;
+ mutable std::atomic<int> RefCount{0};
protected:
- ThreadSafeRefCountedBase() : RefCount(0) {}
+ ThreadSafeRefCountedBase() = default;
ThreadSafeRefCountedBase(const ThreadSafeRefCountedBase &) {}
ThreadSafeRefCountedBase &
operator=(const ThreadSafeRefCountedBase &) = delete;
More information about the llvm-branch-commits
mailing list