This is an archive of the discontinued LLVM Phabricator instance.

[NFC][libc++][bitset] Refactors constructors.
ClosedPublic

Authored by Mordante on Jul 10 2023, 9:33 AM.

Details

Reviewers
philnik
ldionne
Group Reviewers
Restricted Project
Commits
rG56ae3568ead3: [NFC][libc++][bitset] Refactors constructors.
Summary

Based on the review comments in D153201 this combines the string and
c-string constructors. The common constructor is using a string_view:

  • it allows propagating the _Traits, which are required to be used for comparison.
  • it avoids allocating
  • libc++ supports it in C++03

Diff Detail

Event Timeline

Mordante created this revision.Jul 10 2023, 9:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 9:33 AM
Mordante requested review of this revision.Jul 10 2023, 9:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 9:33 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Jul 10 2023, 12:18 PM
ldionne added a subscriber: ldionne.

LGTM w/ green CI.

libcxx/include/bitset
117

Commit message typo: commont.

710

Any reason for this being in parens? I'd remove them if we can, while we're at it.

This revision is now accepted and ready to land.Jul 10 2023, 12:18 PM
philnik accepted this revision.Jul 10 2023, 12:49 PM

Thanks for the cleanup. LGTM with comments addressed.

libcxx/include/bitset
796

Could we name this something along the lines of __init_from_string? We have __init in a bunch of places throughout the code base and in many places the overload set is completely impenetrable.

811

We might as well do that now, since the lines are being touched.

Mordante updated this revision to Diff 540668.Jul 15 2023, 3:21 AM

Rebased and addresses review comments.

Mordante edited the summary of this revision. (Show Details)Jul 15 2023, 3:21 AM
Mordante marked 4 inline comments as done.Jul 15 2023, 3:24 AM
Mordante added inline comments.
libcxx/include/bitset
710

No reason, I just copy-pasted it and didn't notice.

Mordante updated this revision to Diff 540669.Jul 15 2023, 3:25 AM
Mordante marked an inline comment as done.

Addresses the last review comment that I forgot to save.

This revision was automatically updated to reflect the committed changes.