Page MenuHomePhabricator

[libc++][format] Adds char formatter.
Needs ReviewPublic

Authored by Mordante on Jun 1 2021, 9:20 AM.

Details

Reviewers
curdeius
ldionne
miscco
vitaut
Group Reviewers
Restricted Project
Summary

Implements the formatter for all fundamental integer types.
[format.formatter.spec]/2.1
The specializations

template<> struct formatter<char, char>;
template<> struct formatter<char, wchar_t>;
template<> struct formatter<wchar_t, wchar_t>;

This removes the stub implemented in D96664.

Implements parts of:

  • P0645 Text Formatting

Diff Detail

Event Timeline

Mordante created this revision.Jun 1 2021, 9:20 AM
Mordante requested review of this revision.Jun 1 2021, 9:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2021, 9:20 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante updated this revision to Diff 349770.Jun 3 2021, 10:50 PM

Rebase.
Disable a failing test on Windows.

Mordante edited the summary of this revision. (Show Details)Jun 5 2021, 4:17 AM
Mordante added reviewers: curdeius, ldionne, miscco, vitaut.
Mordante planned changes to this revision.Jun 27 2021, 5:38 AM

This patch will be updated due to changes in other patches in the series.

Mordante updated this revision to Diff 355558.Wed, Jun 30, 8:15 AM
Mordante edited the summary of this revision. (Show Details)

Rebased and updated:

  • Address some changes from previous patches
  • Minor cleanups and comment improvements
  • Added a module map
vitaut added inline comments.Sat, Jul 17, 8:59 AM
libcxx/test/std/utilities/format/format.functions/tests.inc
113

This should probably be fixed in a different diff but . alone is not a prevision field at all: http://eel.is/c++draft/format.string.std.

vitaut added inline comments.Sat, Jul 17, 9:09 AM
libcxx/test/std/utilities/format/format.functions/tests.inc
113

AFAICS this should give "The format-spec precision field doesn't contain a value or arg-id" according to the parsing logic in https://reviews.llvm.org/D103368.

Mordante added inline comments.Sun, Jul 18, 10:30 AM
libcxx/test/std/utilities/format/format.functions/tests.inc
113

Due to https://reviews.llvm.org/D103368#inline-990725 this will no longer mention precision in the exception message. I was still addressing other review comments so haven't gotten around to update this patch.

Mordante updated this revision to Diff 359636.Sun, Jul 18, 10:32 AM

Rebase
Use private module headers
Guard unit tests for implementation details

Mordante added inline comments.Tue, Jul 20, 10:14 AM
libcxx/include/__format/formatter_char.h
46

s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/ here and all other occurrences in this patch.