This is an archive of the discontinued LLVM Phabricator instance.

[libc++][NFC] Merges unused functions in callers.
ClosedPublic

Authored by Mordante on Jun 14 2022, 9:21 AM.

Details

Reviewers
jloser
EricWF
Group Reviewers
Restricted Project
Commits
rG21ba9d0b62c1: [libc++][NFC] Merges unused functions in callers.
Summary

This is a follow up based on a request of @jloser in D127594.

As drive-by qualified the function calls in the <bit> header.

Diff Detail

Event Timeline

Mordante created this revision.Jun 14 2022, 9:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2022, 9:21 AM
Mordante requested review of this revision.Jun 14 2022, 9:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2022, 9:21 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante updated this revision to Diff 437559.Jun 16 2022, 8:52 AM

Attempt to fix CI and improve a unit test.

jloser added inline comments.Jun 21 2022, 7:25 AM
libcxx/test/libcxx/numerics/bit.ops.pass.cpp
34 ↗(On Diff #437559)

This is a drop in test coverage - I think we should keep this one for __bit_log2. In general, I think we should:

  • Keep existing test coverage for the private functions kept (i.e. ones that had two or more call sites used by public functions).
  • Verify existing coverage for public functions where we removed the private function it delegated to if we removed the private function (since it only had one call site).

How does that sound? If you're up for it, we could go one step further and verify the noexcept properties.

EricWF accepted this revision.Jun 21 2022, 8:16 AM
This revision is now accepted and ready to land.Jun 21 2022, 8:16 AM
Mordante marked an inline comment as done.Jun 22 2022, 8:58 AM

Thanks for the reviews!

libcxx/test/libcxx/numerics/bit.ops.pass.cpp
34 ↗(On Diff #437559)

I disagree it's a drop in test coverage. The function is indirectly tested by its callers.
But I don't mind to restore the test, so I'll add it back.

This is the only function "dropped" the other two remaining functions are still tested.
There is test coverage for the public functions, I didn't verify all, but I trust our contributors and reviewers. These tests are more detailed than the sanity checks in this file. For example test/std/numerics/bit/bitops.count/countl_one.pass.cpp.

I think it's useful to validate the noexcept status when it's not mandated by the Standard.

Mordante updated this revision to Diff 439050.Jun 22 2022, 9:12 AM
Mordante marked an inline comment as done.

Rebased and addresses review comments.

This revision was automatically updated to reflect the committed changes.
jloser added inline comments.Jun 22 2022, 11:29 AM
libcxx/test/libcxx/numerics/bit.ops.pass.cpp
34 ↗(On Diff #437559)

Valid point. It is indirectly tested with bit_floor and bit_width, though I do like the direct testing of it - thanks for adding that back.

Appreciate the added tests in general - LGTM!