[PATCH] D28245: ADT: IntrusiveRefCntPtr: Broaden the definition of correct usage of RefCountedBase

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 11:08:15 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL290987: ADT: IntrusiveRefCntPtr: Broaden the definition of correct usage of… (authored by dblaikie).

Changed prior to commit:
  https://reviews.llvm.org/D28245?vs=82952&id=83089#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28245

Files:
  llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h


Index: llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
===================================================================
--- llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
+++ llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
@@ -21,8 +21,8 @@
 //   class MyClass : public RefCountedBase<MyClass> {};
 //
 //   void foo() {
-//     // Objects that inherit from RefCountedBase should always be instantiated
-//     // on the heap, never on the stack.
+//     // Constructing an IntrusiveRefCntPtr increases the pointee's refcount by
+//     // 1 (from 0 in this case).
 //     IntrusiveRefCntPtr<MyClass> Ptr1(new MyClass());
 //
 //     // Copying an IntrusiveRefCntPtr increases the pointee's refcount by 1.
@@ -68,9 +68,6 @@
 /// calls to Release() and Retain(), which increment and decrement the object's
 /// refcount, respectively.  When a Release() call decrements the refcount to 0,
 /// the object deletes itself.
-///
-/// Objects that inherit from RefCountedBase should always be allocated with
-/// operator new.
 template <class Derived> class RefCountedBase {
   mutable unsigned RefCount = 0;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28245.83089.patch
Type: text/x-patch
Size: 1113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170104/7cf32389/attachment.bin>


More information about the llvm-commits mailing list