[libcxx-commits] [PATCH] D128139: [libc++][format] Improve integral formatters.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 19 06:04:00 PDT 2022


Mordante created this revision.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

This changes the implementation of the formatter. Instead of inheriting
from a specialized parser all formatters will use the same generic
parser. This reduces the binary size.

The new parser contains some additional fields only used in the chrono
formatting. Since this doesn't change the size of the parser the fields
are in the generic parser. The parser is designed to fit in 128-bit,
making it cheap to pass by value.

The new format function is a const member function. This isn't required
by the Standard yet, but it will be after LWG-3636 is accepted.
Additionally P2286 <https://reviews.llvm.org/P2286> adds a formattable concept which requires the member
function to be const qualified in C++23. This paper is likely to be
accepted in the 2022 July plenary.

This is based on D125606 <https://reviews.llvm.org/D125606>. That commit did the groundwork and did similar
changes for the string formatters.

Depends on D125606 <https://reviews.llvm.org/D125606>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128139

Files:
  libcxx/include/__format/formatter_bool.h
  libcxx/include/__format/formatter_char.h
  libcxx/include/__format/formatter_floating_point.h
  libcxx/include/__format/formatter_integer.h
  libcxx/include/__format/formatter_integral.h
  libcxx/include/__format/formatter_output.h
  libcxx/include/__format/formatter_pointer.h
  libcxx/include/__format/parser_std_format_spec.h
  libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp
  libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_char.pass.cpp
  libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_integer.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128139.438191.patch
Type: text/x-patch
Size: 109269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220619/ccd38bc3/attachment-0001.bin>


More information about the libcxx-commits mailing list