Page MenuHomePhabricator

[ADT] Add makeIntrusiveRefCnt helper function
ClosedPublic

Authored by njames93 on Mon, Jan 11, 11:48 AM.

Details

Summary

Works like std::make_unique but for IntrusiveRefCntPtr objects.
See https://lists.llvm.org/pipermail/llvm-dev/2021-January/147729.html

Diff Detail

Event Timeline

njames93 created this revision.Mon, Jan 11, 11:48 AM
njames93 requested review of this revision.Mon, Jan 11, 11:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptMon, Jan 11, 11:48 AM
njames93 added inline comments.Mon, Jan 11, 11:49 AM
llvm/unittests/ADT/IntrusiveRefCntPtrTest.cpp
62–67

Couldn't think how best to test this, but these seem to do a good enough job.

dblaikie accepted this revision.Mon, Jan 11, 12:03 PM

Looks good - thanks!

This revision is now accepted and ready to land.Mon, Jan 11, 12:03 PM
MaskRay accepted this revision.Mon, Jan 11, 12:07 PM

Looks great!

llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
300

s/smart/intrusive/.

Though I guess "smart ref counted pointers" can just be omitted.

njames93 updated this revision to Diff 315903.Mon, Jan 11, 12:12 PM

Address comments.

This revision was landed with ongoing or failed builds.Mon, Jan 11, 12:13 PM
This revision was automatically updated to reflect the committed changes.