[all-commits] [llvm/llvm-project] 38adfa: [libc++][format] Improve integral formatters.

mordante via All-commits all-commits at lists.llvm.org
Tue Jun 28 22:25:17 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 38adfa91a1f3b0b930f09f961aec64d0d71f395f
      https://github.com/llvm/llvm-project/commit/38adfa91a1f3b0b930f09f961aec64d0d71f395f
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2022-06-29 (Wed, 29 Jun 2022)

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

  Log Message:
  -----------
  [libc++][format] Improve integral formatters.

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 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. That commit did the groundwork and did similar
changes for the string formatters.

Depends on D125606

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D128139




More information about the All-commits mailing list