llvm-project/libcxx/include
Mark de Wever 555214cbcc [libc++][format][2/6] Adds a __output_iterator.
Instead of using a temporary `string` in `__vformat_to_wrapped` use a new
generic iterator. This aids to reduce the number of template instantions
and avoids using a `string` to buffer the entire formatted output.

This changes the type of `format_context` and `wformat_context`, this can
still be done since the code isn't ABI stable yet.

Several approaches have been evaluated:
- Using a __output_buffer base class with:
  - a put function to store the buffer in its internal buffer
  - a virtual flush function to copy the internal buffer to the output
- Using a `function` to forward the output operation to the output buffer,
  much like the next method.
- Using a type erased function point to store the data in the buffer.
The last version resulted in the best performance. For some cases there's
still a loss of speed over the original method. This loss many becomes
apparent when large strings are copied to a pointer like iterator, before
the compiler optimized this using `memcpy`.

Reviewed By: ldionne, vitaut, #libc

Differential Revision: https://reviews.llvm.org/D110495
2022-03-26 16:48:01 +01:00
..
__algorithm [libc++][ranges] Implement ranges::min 2022-03-18 12:52:21 +01:00
__bit [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
__charconv [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__chrono [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__compare [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
__concepts [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
__coroutine [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__filesystem [libc++] Make __dir_stream visibility declaration consistent 2022-03-15 19:30:35 +01:00
__format [libc++][format][2/6] Adds a __output_iterator. 2022-03-26 16:48:01 +01:00
__functional [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
__ios [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__iterator [libc++][ranges] Implement changes to reverse_iterator from One Ranges Proposal. 2022-03-17 19:58:03 -07:00
__memory [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
__numeric [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__random [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite 2022-03-15 17:17:54 -04:00
__ranges [libc++][NFC] Use struct instead of class for ranges::end 2022-03-22 15:36:47 -04:00
__support [libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode 2022-02-07 17:51:05 -05:00
__thread [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__utility [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
__variant [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
experimental [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
ext [libc++] Use -I instead of -isystem to include headers in the test suite 2022-03-03 13:19:47 +01:00
CMakeLists.txt [libc++][format][2/6] Adds a __output_iterator. 2022-03-26 16:48:01 +01:00
__assert [libc++] Add a lightweight overridable assertion handler 2022-03-23 15:35:46 -04:00
__availability [libc++] Add a lightweight overridable assertion handler 2022-03-23 15:35:46 -04:00
__bit_reference [libc++] Add `explicit` to a bunch of internal detail ctors. 2022-03-01 14:37:06 -05:00
__bits [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__bsd_locale_defaults.h [libc++][NFC] Fix include guards and add a missing license header 2022-03-23 13:14:19 -04:00
__bsd_locale_fallbacks.h [libc++][NFC] Fix include guards and add a missing license header 2022-03-23 13:14:19 -04:00
__config [libc++][NFC] Fix include guards and add a missing license header 2022-03-23 13:14:19 -04:00
__config_site.in [libc++] Add a lightweight overridable assertion handler 2022-03-23 15:35:46 -04:00
__debug [libc++][NFC] Fix include guards and add a missing license header 2022-03-23 13:14:19 -04:00
__errc [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
__hash_table [libc++] Audit all uses of _LIBCPP_ASSERT and _LIBCPP_DEBUG_ASSERT 2022-03-24 13:13:21 -04:00
__libcpp_version Bump the trunk major version to 15 2022-02-01 23:54:52 -08:00
__locale [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
__mbstate_t.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
__mutex_base [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__node_handle [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__split_buffer [libc++][NFC] Fix include guards and add a missing license header 2022-03-23 13:14:19 -04:00
__std_stream [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__string [libc++] Remove raw call to debug handler from __char_traits_length_checked 2022-03-11 09:05:29 -05:00
__threading_support [libc++][NFC] Fix include guards and add a missing license header 2022-03-23 13:14:19 -04:00
__tree [libc++] Granularize <utility> includes 2022-03-05 19:31:46 +01:00
__tuple [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
__undef_macros [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
algorithm [libc++][ranges] Implement ranges::min 2022-03-18 12:52:21 +01:00
any [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite 2022-03-15 17:17:54 -04:00
array [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
atomic [libc++] Granularize chrono includes 2022-02-23 23:06:26 +01:00
barrier [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite 2022-03-15 17:17:54 -04:00
bit [libc++] [LWG3656] Update the return type of std::bit_width. 2022-03-04 17:31:09 -05:00
bitset [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite 2022-03-15 17:17:54 -04:00
cassert [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
ccomplex [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cctype [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cerrno [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cfenv [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cfloat [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
charconv [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite 2022-03-15 17:17:54 -04:00
chrono [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cinttypes [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
ciso646 [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
climits [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
clocale [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cmath [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
codecvt [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
compare [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
complex [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
complex.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
concepts [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
condition_variable [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
coroutine [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
csetjmp [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
csignal [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cstdarg [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cstdbool [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cstddef [libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode 2022-02-07 17:51:05 -05:00
cstdint [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cstdio [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cstdlib [libc++] Remove workaround for missing declarations on Windows store apps 2022-03-11 09:08:30 -05:00
cstring [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
ctgmath [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
ctime [libc++] Remove workaround for C11 features on compilers that don't support using_if_exists 2022-03-11 09:06:43 -05:00
ctype.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cuchar [libc++] Add missing header <cuchar> 2022-03-07 08:48:50 -05:00
cwchar [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
cwctype [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
deque [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
errno.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
exception [libc++] Remove the _LIBCPP_BOOL_CONSTANT macro 2022-03-25 08:46:14 -04:00
execution [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
fenv.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
filesystem [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
float.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
format [libc++][format][2/6] Adds a __output_iterator. 2022-03-26 16:48:01 +01:00
forward_list [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
fstream [libc++] Granularize <utility> includes 2022-03-05 19:31:46 +01:00
functional [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
future [libc++] Granularize <utility> includes 2022-03-05 19:31:46 +01:00
initializer_list [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
inttypes.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
iomanip [libc++] Overhaul std::quoted; fix its relationship to character traits. 2022-03-07 13:28:58 -05:00
ios [libc++] Granularize <utility> includes 2022-03-05 19:31:46 +01:00
iosfwd [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
iostream [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
istream [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite 2022-03-15 17:17:54 -04:00
iterator [libc++][ranges] Implement changes to reverse_iterator from One Ranges Proposal. 2022-03-17 19:58:03 -07:00
latch [libc++] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER whenever we enable warnings in the test suite 2022-03-15 17:17:54 -04:00
limits Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms. 2022-02-22 15:49:21 -08:00
limits.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
list [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
locale [libc++] Enable modernize-loop-convert 2022-03-18 20:34:19 +01:00
locale.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
map [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
math.h [libc++][AIX] Use C++ overloads from libc++'s math.h 2022-03-01 15:53:41 -05:00
memory [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
module.modulemap [libc++][format][2/6] Adds a __output_iterator. 2022-03-26 16:48:01 +01:00
mutex [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
new [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
numbers [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
numeric [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
optional [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
ostream [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
queue [libc++] Granularize algorithm includes 2022-02-16 04:12:22 +01:00
random [libc++] Explicitly reject `uniform_int_distribution<bool>` and `<char>`. 2022-02-28 14:57:53 -05:00
ranges [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
ratio [libc++] Remove the _LIBCPP_BOOL_CONSTANT macro 2022-03-25 08:46:14 -04:00
regex [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
scoped_allocator [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
semaphore [libc++] Granularize chrono includes 2022-02-23 23:06:26 +01:00
set [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
setjmp.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
shared_mutex [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
span [libc++] Re-enable workaround for pre-ranges CTAD in std::span 2022-03-21 21:56:42 -04:00
sstream [libc++] Granularize <utility> includes 2022-03-05 19:31:46 +01:00
stack [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
stdbool.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
stddef.h [libc++] Remove the ability to use the std::nullptr_t emulation in C++03 mode 2022-02-07 17:51:05 -05:00
stdexcept [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
stdint.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
stdio.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
stdlib.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
streambuf [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
string [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
string.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
string_view [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
strstream [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
system_error [libc++] Remove _LIBCPP_HAS_NO_STRONG_ENUMS. 2022-03-01 20:27:20 +01:00
tgmath.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
thread [libc++] Granularize chrono includes 2022-02-23 23:06:26 +01:00
tuple [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
type_traits [libc++] Remove the _LIBCPP_BOOL_CONSTANT macro 2022-03-25 08:46:14 -04:00
typeindex [libc++] Remove <utility> includes 2022-03-17 00:12:33 +01:00
typeinfo [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
uchar.h [libc++] Add missing header <cuchar> 2022-03-07 08:48:50 -05:00
unordered_map [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
unordered_set [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
utility [libc++] Implement P0627R6 (Function to mark unreachable code) 2022-02-14 20:52:51 +01:00
valarray [libc++] Make sure calls to std::move are always qualified 2022-02-24 19:58:08 -05:00
variant [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
vector [libc++] Rename __identity to __type_identity 2022-03-25 01:01:28 +01:00
version [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
wchar.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00
wctype.h [libc++] Normalize all our '#pragma GCC system_header', and regression-test. 2022-02-04 12:27:19 -05:00