[all-commits] [llvm/llvm-project] e948ca: [libc++][format] Fixes visit_format_arg.

mordante via All-commits all-commits at lists.llvm.org
Tue Nov 22 08:48:47 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e948cab07d68c240723a12cdc151d09c5cef87ba
      https://github.com/llvm/llvm-project/commit/e948cab07d68c240723a12cdc151d09c5cef87ba
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2022-11-22 (Tue, 22 Nov 2022)

  Changed paths:
    M libcxx/include/__format/format_arg.h
    M libcxx/include/__format/format_functions.h
    M libcxx/include/__format/parser_std_format_spec.h
    R libcxx/test/libcxx/utilities/format/format.arguments/format.arg/visit_format_arg.pass.cpp
    R libcxx/test/libcxx/utilities/format/format.arguments/format.args/get.pass.cpp
    A libcxx/test/std/utilities/format/format.arguments/format.arg/visit_format_arg.pass.cpp
    A libcxx/test/std/utilities/format/format.arguments/format.args/get.pass.cpp

  Log Message:
  -----------
  [libc++][format] Fixes visit_format_arg.

The Standard specifies which types are stored in the basic_format_arg
"variant" and which types are stored as a handle. Libc++ stores
additional types in the "variant". During a reflector discussion
@jwakely mention this is user observable; visit_format_arg uses the type
instead of a handle as argument.

This optimization is useful and will probably be used for other small
types in the future. To be conferment the visitor creates a handle and
uses that as argument. There is a second visitor so the formatter can
still directly access the 128-bit integrals.

The test for the visitor and get has been made public too, there is no
reason not too. The 128-bit integral types are required by the Standard,
when they are available.

Reviewed By: ldionne, #libc

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




More information about the All-commits mailing list