This is an archive of the discontinued LLVM Phabricator instance.

ADT: Allow IntrusiveRefCntPtr construction from std::unique_ptr, NFC
ClosedPublic

Authored by dexonsmith on Dec 8 2020, 2:56 PM.

Details

Summary

Allow a std::unique_ptr to be moved into the an IntrusiveRefCntPtr,
and remove a couple of now-unnecessary release() calls.

Diff Detail

Event Timeline

dexonsmith created this revision.Dec 8 2020, 2:56 PM
dexonsmith requested review of this revision.Dec 8 2020, 2:56 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 8 2020, 2:56 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dblaikie accepted this revision.Dec 8 2020, 3:20 PM

Looks good with one minor tweak

llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
180

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).

This revision is now accepted and ready to land.Dec 8 2020, 3:20 PM

Thanks for the review!

llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
180

Right, thanks; I'll update it that way before pushing the commit.

This revision was landed with ongoing or failed builds.Dec 8 2020, 5:33 PM
This revision was automatically updated to reflect the committed changes.