[libcxx-commits] [PATCH] D138052: [libc++][format] Fixes visit_format_arg.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 15 11:38:04 PST 2022


Mordante created this revision.
Mordante added reviewers: ldionne, vitaut.
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++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138052

Files:
  libcxx/include/__format/format_arg.h
  libcxx/include/__format/format_functions.h
  libcxx/include/__format/parser_std_format_spec.h
  libcxx/test/libcxx/utilities/format/format.arguments/format.arg/visit_format_arg.pass.cpp
  libcxx/test/libcxx/utilities/format/format.arguments/format.args/get.pass.cpp
  libcxx/test/std/utilities/format/format.arguments/format.arg/visit_format_arg.pass.cpp
  libcxx/test/std/utilities/format/format.arguments/format.args/get.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138052.475542.patch
Type: text/x-patch
Size: 12106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221115/94e8d6b6/attachment-0001.bin>


More information about the libcxx-commits mailing list