This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Implement shared_ptr methods inline in the class
ClosedPublic

Authored by ldionne on Oct 25 2021, 12:27 PM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Commits
rGb2d25ef2d1e5: [libc++] Implement shared_ptr methods inline in the class
Summary

This patch refactors the shared_ptr methods from being defined out-of-line
to being defined inline in the class, like what we do for all new code in
the library. The benefits of doing that are that code is not as scattered
around and is hence easier to understand, and it avoids a ton of duplication
due to SFINAE checks. Defining the method where it is declared also removes
the possibility for mismatched attributes.

As a fly-by change, this also:

  • Adds a few _LIBCPP_HIDE_FROM_ABI attributes
  • Uses __enable_if_t instead of enable_if as a function argument, to match the style that we use everywhere else.

Diff Detail

Event Timeline

ldionne requested review of this revision.Oct 25 2021, 12:27 PM
ldionne created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2021, 12:27 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne updated this revision to Diff 382082.Oct 25 2021, 12:31 PM

Remove now unused __nat type.

ldionne updated this revision to Diff 382314.Oct 26 2021, 7:42 AM

Fix C++03 failure. The issue was with how I changed one of the enable_ifs to __enable_if_t.

ldionne accepted this revision as: Restricted Project.Oct 26 2021, 10:10 AM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 26 2021, 10:11 AM
This revision was automatically updated to reflect the committed changes.