[PATCH] D92888: ADT: Allow IntrusiveRefCntPtr construction from std::unique_ptr, NFC

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 15:34:08 PST 2020


dexonsmith added a comment.

Thanks for the review!



================
Comment at: llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180
+  template <class X>
+  IntrusiveRefCntPtr(std::unique_ptr<X> &&S) : Obj(S.release()) {
+    retain();
----------------
dblaikie wrote:
> Pass 'S' by value here - that's the usual way to pass ownership of unique_ptr, and unlike the IntrusiveRefCntPtr's copy/move ctors there's no issue with invoking the operation in its implementation (infinitely recursively).
Right, thanks; I'll update it that way before pushing the commit.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92888/new/

https://reviews.llvm.org/D92888



More information about the cfe-commits mailing list