This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Add makeIntrusiveRefCnt helper function
ClosedPublic

Authored by njames93 on Jan 11 2021, 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.Jan 11 2021, 11:48 AM
njames93 requested review of this revision.Jan 11 2021, 11:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2021, 11:48 AM
njames93 added inline comments.Jan 11 2021, 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.Jan 11 2021, 12:03 PM

Looks good - thanks!

This revision is now accepted and ready to land.Jan 11 2021, 12:03 PM
MaskRay accepted this revision.Jan 11 2021, 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.Jan 11 2021, 12:12 PM

Address comments.

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