This is an archive of the discontinued LLVM Phabricator instance.

[libc++][format] Adds formatter handle.
ClosedPublic

Authored by Mordante on Dec 18 2021, 7:43 AM.

Details

Reviewers
ldionne
vitaut
Group Reviewers
Restricted Project
Commits
rGade6d0d8fa1d: [libc++][format] Adds formatter handle.
Summary

This implements the handler according to P0645. P2418 changes the wording
in the Standard. That isn't implemented and requires changes in more
places. LWG3631 applies modifications to P2418, but is currently
unresolved.

Implements parts of:

  • P0645 Text Formatting

Depends on D115989

Diff Detail

Event Timeline

Mordante requested review of this revision.Dec 18 2021, 7:43 AM
Mordante created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 18 2021, 7:43 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante updated this revision to Diff 395295.Dec 18 2021, 8:13 AM

Disable failing gcc tests.

Mordante updated this revision to Diff 395304.Dec 18 2021, 11:51 AM

Attempt to fix the no-exception CI builds.

vitaut added inline comments.Dec 19 2021, 8:53 AM
libcxx/include/__format/format_arg.h
51–53

Not directly related to this diff but this seems to make the ABI depend on _LIBCPP_HAS_NO_INT128. A better approach would be to always define these enumerators but only use them conditionally.

libcxx/test/std/utilities/format/format.functions/format_tests.h
72–76

Maybe move error reporting to a function to have _LIBCPP_NO_EXCEPTIONS check in one place?

123

Looks like begin may be unterminated in some cases because buffer is uninitialized and to_chars doesn't nul-terminate.

Mordante marked 2 inline comments as done.Dec 19 2021, 11:58 AM

Thanks for the review.

libcxx/include/__format/format_arg.h
51–53

Thanks for the suggestion! I'll do that in a separate patch.

libcxx/test/std/utilities/format/format.functions/format_tests.h
123

This should be save since this code is only executed when type == 2 and begin is always initialized with a string literal.

Mordante updated this revision to Diff 395349.Dec 19 2021, 11:58 AM
Mordante marked an inline comment as done.

Address review comments.

Mordante marked an inline comment as done.Dec 21 2021, 10:17 AM
Mordante added inline comments.
libcxx/include/__format/format_arg.h
51–53

Applied your suggestion in D116120.

LGTM

libcxx/include/__format/format_arg.h
51–53

Great, thank you!

libcxx/test/std/utilities/format/format.functions/format_tests.h
123

Missed that, sorry for the noise.

ldionne accepted this revision.Jan 24 2022, 7:33 AM
This revision is now accepted and ready to land.Jan 24 2022, 7:33 AM
This revision was automatically updated to reflect the committed changes.