This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Use concepts in <bit>.
ClosedPublic

Authored by Mordante on Jun 12 2022, 3:41 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rG23b10a4a66fb: [libc++][NFC] Use concepts in <bit>.
Summary

All supported compilers have concepts support so use that in the C++20
functions in <bit>.

s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/ as drive-by fix.

Diff Detail

Event Timeline

Mordante created this revision.Jun 12 2022, 3:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2022, 3:41 AM
Mordante requested review of this revision.Jun 12 2022, 3:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2022, 3:41 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
jloser added a subscriber: jloser.Jun 12 2022, 11:11 AM
jloser added inline comments.
libcxx/include/__bit/bit_cast.h
27

Nit: can we use west const for consistency in a lot of the other places in libcxx? E.g. s/_FromType const&/const _FromType&.

libcxx/include/bit
94

Since we're concept constraining the public functions like std::rotl and friends, should we just remove these static_asserts in the private functions? I don't see these as ever being called from outside this file from the public function.

ldionne accepted this revision.Jun 13 2022, 7:42 AM
ldionne added a subscriber: ldionne.
ldionne added inline comments.
libcxx/include/__bit/bit_cast.h
25–26
This revision is now accepted and ready to land.Jun 13 2022, 7:42 AM
Mordante marked 3 inline comments as done.Jun 13 2022, 9:17 AM

Thanks for the reviews!

libcxx/include/__bit/bit_cast.h
25–26

Fixed, this is clang-format's idea ;-)

27

Nice catch!

libcxx/include/bit
94

I prefer to keep them as-is. These functions are there to allow other parts of the code to use these functions before C++20. When they are unused I think it would make more sense to remove these functions and move the implementation into the public files. We've implemented most of C++17 so there shouldn't be much new pre-C++20 code around.

I'll do that in a separate patch.

This revision was landed with ongoing or failed builds.Jun 13 2022, 9:17 AM
This revision was automatically updated to reflect the committed changes.
Mordante marked 3 inline comments as done.