This is an archive of the discontinued LLVM Phabricator instance.

[libc++][doc] Extended integral type support
ClosedPublic

Authored by Mordante on Jul 7 2022, 11:04 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rG77ccf63ef0c4: [libc++][doc] Extended integral type support
Summary

This addresses a request during the review of D128929.

Diff Detail

Event Timeline

Mordante created this revision.Jul 7 2022, 11:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 11:04 AM
Mordante requested review of this revision.Jul 7 2022, 11:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 11:04 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
philnik added inline comments.
libcxx/docs/UsingLibcxx.rst
453–454

Could you maybe add a TODO somewhere to update the function names to match the standard ones?

Thanks for the review!

libcxx/docs/UsingLibcxx.rst
453–454

I'm not sure whether we want to update these names. On one hand it's nice to use the C++20 name on the other hand I like to use the intrinsic's name. But I have no strong preference in either direction.
@lidonne What's your preference?

I'm not going to add a TODO. If we want to use the C++20 names I'll do the renaming in a separate patch as a parent of this one and adjust this one to the new names.

philnik added inline comments.Jul 10 2022, 5:53 AM
libcxx/docs/UsingLibcxx.rst
453–454

Normally we mirror the names of the standard ones. This makes a lot of sense IMO, since people are much more likely to be familiar with the standard names than with intrinsics. Personally I also find the names countl_zero and countr_zero a lot more intuitive than ctz and clz. Unless you already know that ctz is count trailing zeros you would never guess that.

Mordante added inline comments.Jul 10 2022, 7:52 AM
libcxx/docs/UsingLibcxx.rst
453–454

I don't object, but let's agree on the rename before doing the work.
(In this case I think the Standard library names aren't great either ;-) countr looks like a typo of counter.)

ldionne requested changes to this revision.Jul 12 2022, 9:50 AM
ldionne added inline comments.
libcxx/docs/UsingLibcxx.rst
440

My comment in https://reviews.llvm.org/D128929#inline-1241329 was asking to document the fact that __uint128_t can be used with *public* functions in <bits> (and also in a few other places like <random>, <charconv>, <type_traits>, etc). I don't think we should document internal-only functions and headers, since this is asking for trouble when users start depending on them.

I'm sorry if my comment in the other review was not clear enough.

453–454

I'm mostly neutral on this, but I guess it would be more consistent to name them after their standardized names. However, note that this is only beneficial for libc++ developers themselves, since we never expect users to use these names.

This revision now requires changes to proceed.Jul 12 2022, 9:50 AM
Mordante updated this revision to Diff 445014.Jul 15 2022, 9:17 AM
Mordante marked 3 inline comments as done.

Addresses review comments, this basically changes the entire patch.

ldionne accepted this revision.Jul 26 2022, 9:41 AM

LGTM, but you'll have to rebase on top of the changes I made in 07e984bc52014a8565033be10f7e80982e974b99.

This revision is now accepted and ready to land.Jul 26 2022, 9:41 AM

Also, the commit message and review summary/title probably need to change now.

Mordante retitled this revision from [libc++][doc] Documents the header __bits. to [libc++][doc] Extended integral type support.Jul 27 2022, 9:19 AM
This revision was automatically updated to reflect the committed changes.