[libc++][format] Adds string formatter.
authorMark de Wever <koraq@xs4all.nl>
Mon, 14 Dec 2020 16:39:15 +0000 (17:39 +0100)
committerMark de Wever <koraq@xs4all.nl>
Thu, 7 Oct 2021 15:03:04 +0000 (17:03 +0200)
commitd550930afcbb84740681c219ab13efd133143f88
treec8db5b823ad03619803daacca7a7b3e0f4a79a35
parent9072183cb6346926fefa0c0d24cdc31cf028dcc8
[libc++][format] Adds string formatter.

Implements the formatter for all string types.
[format.formatter.spec]/2.2
For each charT, the string type specializations
```
  template<> struct formatter<charT*, charT>;
  template<> struct formatter<const charT*, charT>;
  template<size_t N> struct formatter<const charT[N], charT>;
  template<class traits, class Allocator>
    struct formatter<basic_string<charT, traits, Allocator>, charT>;
  template<class traits>
    struct formatter<basic_string_view<charT, traits>, charT>;
```
This removes the stub implemented in D96664.

Implements parts of:
- P0645 Text Formatting
- P1868 width: clarifying units of width and precision in std::format

Reviewed By: #libc, ldionne, vitaut

Differential Revision: https://reviews.llvm.org/D103425
15 files changed:
libcxx/include/CMakeLists.txt
libcxx/include/__format/format_string.h
libcxx/include/__format/formatter.h
libcxx/include/__format/formatter_string.h [new file with mode: 0644]
libcxx/include/__format/parser_std_format_spec.h
libcxx/include/format
libcxx/include/module.modulemap
libcxx/test/libcxx/diagnostics/detail.headers/format/formatter_string.module.verify.cpp [new file with mode: 0644]
libcxx/test/std/utilities/format/format.formatter/format.context/format.formatter.spec/formatter.c_string.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.context/format.formatter.spec/formatter.const_char_array.pass.cpp
libcxx/test/std/utilities/format/format.formatter/format.context/format.formatter.spec/formatter.string.pass.cpp
libcxx/test/std/utilities/format/format.functions/format.pass.cpp
libcxx/test/std/utilities/format/format.functions/format_tests.h
libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp
libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp