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

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 15:20:51 PST 2020


dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Looks good with one minor tweak



================
Comment at: llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:180
+  template <class X>
+  IntrusiveRefCntPtr(std::unique_ptr<X> &&S) : Obj(S.release()) {
+    retain();
----------------
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).


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