[all-commits] [llvm/llvm-project] 4d8268: [libc++][format] Improve format-arg-store.

mordante via All-commits all-commits at lists.llvm.org
Wed May 18 11:11:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d8268fbf4cd30d39530622b7f1dc487122b4f3c
      https://github.com/llvm/llvm-project/commit/4d8268fbf4cd30d39530622b7f1dc487122b4f3c
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2022-05-18 (Wed, 18 May 2022)

  Changed paths:
    M libcxx/docs/Status/Cxx20Papers.csv
    M libcxx/docs/Status/Cxx2bIssues.csv
    M libcxx/include/CMakeLists.txt
    M libcxx/include/__format/format_arg.h
    A libcxx/include/__format/format_arg_store.h
    M libcxx/include/__format/format_args.h
    M libcxx/include/__format/format_fwd.h
    M libcxx/include/format
    M libcxx/include/module.modulemap
    M libcxx/test/libcxx/private_headers.verify.cpp
    M libcxx/test/libcxx/utilities/format/format.arguments/format.arg/visit_format_arg.pass.cpp
    R libcxx/test/std/utilities/format/format.arguments/format.arg.store/class.pass.cpp
    M libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.pass.cpp
    M libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_wformat_args.pass.cpp
    M libcxx/test/std/utilities/format/format.arguments/format.arg/operator_bool.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.context/format.context/arg.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.context/format.context/ctor.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.context/format.context/locale.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.bool.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.c_string.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.handle.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.pointer.pass.cpp
    M libcxx/test/std/utilities/format/format.formatter/format.formatter.spec/formatter.string.pass.cpp
    M libcxx/test/std/utilities/format/format.functions/format_tests.h

  Log Message:
  -----------
  [libc++][format] Improve format-arg-store.

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.
The handle class also has some changes to prepare for P2418. The real
changed for 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 Add support for std::generator-like types to std::format

Completes:
- LWG3473 Normative encouragement in non-normative note

Depends on D121138

Reviewed By: #libc, vitaut, Mordante

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




More information about the All-commits mailing list