[libcxx-commits] [PATCH] D121514: [libc++][format] Improve format-arg-store.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Mar 12 02:58:27 PST 2022


Mordante created this revision.
Herald added a subscriber: mgorny.
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 optimizes the __format_arg_store type to allow a more efficient
storage of the basic_format_args.

It stores the data in two arrays:

- A struct with the tag of the exposition only variant's type and the offset of the element in the data array. Since this array only depends on the type information it's calculated at compile time and can be shared by different instances of this class.
- The arguments converted to the types used in the exposition only variant of basic_format_arg. This means the packed data can be directly copied to an element of this variant.

The new code uses rvalue reference arguments in preparation for P2418 <https://reviews.llvm.org/P2418>.
The handle class also has some changes to prepare for P2418 <https://reviews.llvm.org/P2418>. The real
changed for P2418 <https://reviews.llvm.org/P2418> will be done separately, but these parts make it
easier to implement that paper.

Some parts of existing test code are removed since they were no longer
valid after the changes, but new tests have been added.

Implements parts of:

- P2418 <https://reviews.llvm.org/P2418> Add support for std::generator-like types to std::format

Completes:

- LWG3473 Normative encouragement in non-normative note

Depends on D118926 <https://reviews.llvm.org/D118926> D121138 <https://reviews.llvm.org/D121138>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121514

Files:
  libcxx/docs/Status/Cxx20Papers.csv
  libcxx/docs/Status/Cxx2bIssues.csv
  libcxx/include/CMakeLists.txt
  libcxx/include/__format/format_arg.h
  libcxx/include/__format/format_arg_store.h
  libcxx/include/__format/format_args.h
  libcxx/include/__format/format_fwd.h
  libcxx/include/format
  libcxx/include/module.modulemap
  libcxx/test/libcxx/diagnostics/detail.headers/format/format_arg_store.module.verify.cpp
  libcxx/test/libcxx/utilities/format/format.arguments/format.arg/format_arg_store.pass.cpp
  libcxx/test/libcxx/utilities/format/format.arguments/format.arg/visit_format_arg.pass.cpp
  libcxx/test/std/utilities/format/format.arguments/format.arg.store/class.pass.cpp
  libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.pass.cpp
  libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_wformat_args.pass.cpp
  libcxx/test/std/utilities/format/format.arguments/format.arg/operator_bool.pass.cpp
  libcxx/test/std/utilities/format/format.formatter/format.context/format.context/arg.pass.cpp
  libcxx/test/std/utilities/format/format.formatter/format.context/format.context/ctor.pass.cpp
  libcxx/test/std/utilities/format/format.formatter/format.context/format.context/locale.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121514.414816.patch
Type: text/x-patch
Size: 62969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220312/ac17be07/attachment-0001.bin>


More information about the libcxx-commits mailing list