This is an archive of the discontinued LLVM Phabricator instance.

[libc++][format] Implements formattable concept.
ClosedPublic

Authored by Mordante on Sep 17 2022, 5:35 AM.

Details

Reviewers
ldionne
vitaut
Group Reviewers
Restricted Project
Commits
rGa1beb0a38262: [libc++][format] Implements formattable concept.
Summary

This concept is introduced in P2286, but was implemented in libc++
before. This implementation was used in the library internally. This
implementation lacked the resolution of LWG3636. The original formatter
had a non-const member function that wasn't trivial to make a const
member. The recent parser improvements made this member a const member
in preparation of LWG3636.

Note LWG3636 isn't voted in. Its status is Ready. P2286's concept has
been written as-if LWG3636 is accepted and refers to that LWG issue.

Updates some tests make format a const member function and removes a
tests that's mainly a duplicate of the formattable concept test.

Implements

  • LWG3636 formatter<T>::format should be const-qualified

Implements parts of

  • P2286R8 Formatting Ranges

Diff Detail

Event Timeline

Mordante created this revision.Sep 17 2022, 5:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2022, 5:35 AM
Mordante requested review of this revision.Sep 17 2022, 5:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2022, 5:35 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Oct 4 2022, 9:25 AM
ldionne added inline comments.
libcxx/docs/Status/Cxx2bIssues.csv
184

Commit message typo:

has be written as-if LWG3636 is accepted and refers to that LWG issue.

should be

has been written as-if LWG3636 is accepted and refers to that LWG issue.

libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp
8–9

As a general rule, we only test public APIs. If there's a problem with __formattable in C++20, we should have a C++20 test using public facing APIs that fails.

54–58
This revision is now accepted and ready to land.Oct 4 2022, 9:25 AM
Mordante updated this revision to Diff 465442.Oct 5 2022, 9:38 AM

Rebased and addresses review comments.

Mordante edited the summary of this revision. (Show Details)Oct 5 2022, 9:39 AM
This revision was automatically updated to reflect the committed changes.
Mordante marked 2 inline comments as done.
libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp