TTobias Hieta[libc++][format] Fixes out of bounds access.
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[libc++][print] Adds FILE functions. Drive-by fix to make sure the __retarget_buffer works correctly whan using a hint of 1. This was discovered in one of the new tests. Drive-by fixes __retarget_buffer when initialized with size 1. Implements parts of - P2093R14 Formatted output - P2539R4 Should the output of std::print to a terminal be synchronized with the underlying stream? Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D150044 | 2 年前 | |
[libc++][format] Adds formattable-with concept. This change has a few additional effects: - Abstract classes are now formattable. - Volatile objects are no longer formattable. Implements - LWG3631 basic_format_arg(T&&) should use remove_cvref_t<T> throughout - LWG3925 Concept formattable's definition is incorrect Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D152092 | 3 年前 | |
[libc++][format] Removes unneeded includes. I did a manual review after the post-review comments in D149543 Reviewed By: #libc, philnik, ldionne Differential Revision: https://reviews.llvm.org/D154122 | 2 年前 | |
[libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x This change is almost fully mechanical. The only interesting change is in generate_feature_test_macro_components.py to generate _LIBCPP_STD_VER >= instead. To avoid churn in the git-blame this commit should be added to the .git-blame-ignore-revs once committed. Reviewed By: ldionne, var-const, #libc Spies: jloser, libcxx-commits, arichardson, arphaman, wenlei Differential Revision: https://reviews.llvm.org/D143962 | 3 年前 | |
[libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x This change is almost fully mechanical. The only interesting change is in generate_feature_test_macro_components.py to generate _LIBCPP_STD_VER >= instead. To avoid churn in the git-blame this commit should be added to the .git-blame-ignore-revs once committed. Reviewed By: ldionne, var-const, #libc Spies: jloser, libcxx-commits, arichardson, arphaman, wenlei Differential Revision: https://reviews.llvm.org/D143962 | 3 年前 | |
[libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x This change is almost fully mechanical. The only interesting change is in generate_feature_test_macro_components.py to generate _LIBCPP_STD_VER >= instead. To avoid churn in the git-blame this commit should be added to the .git-blame-ignore-revs once committed. Reviewed By: ldionne, var-const, #libc Spies: jloser, libcxx-commits, arichardson, arphaman, wenlei Differential Revision: https://reviews.llvm.org/D143962 | 3 年前 | |
[libc++][format] Removes unneeded includes. I did a manual review after the post-review comments in D149543 Reviewed By: #libc, philnik, ldionne Differential Revision: https://reviews.llvm.org/D154122 | 2 年前 | |
[libc++][format] Removes unneeded includes. I did a manual review after the post-review comments in D149543 Reviewed By: #libc, philnik, ldionne Differential Revision: https://reviews.llvm.org/D154122 | 2 年前 | |
[libc++] Add hide_from_abi check for classes We already have a clang-tidy check for making sure that _LIBCPP_HIDE_FROM_ABI is on free functions. This patch extends this to class members. The places where we don't check for _LIBCPP_HIDE_FROM_ABI are classes for which we have an instantiation in the library. Reviewed By: ldionne, Mordante, #libc Spies: jplehr, mikhail.ramalho, sstefan1, libcxx-commits, krytarowski, miyuki, smeenai Differential Revision: https://reviews.llvm.org/D142332 | 3 年前 | |
[libc++] Fix template parameter naming and enforce it through readability-identifier-naming Reviewed By: #libc, Mordante Spies: Mordante, aheejin, libcxx-commits Differential Revision: https://reviews.llvm.org/D156059 | 2 年前 | |
[libc++] Use _LIBCPP_VERBOSE_ABORT in a few remaining __throw_FOO functions This provides better error messages when the program terminates due to an exception being thrown in -fno-exceptions mode. Those seem to have been missed in https://reviews.llvm.org/D141222. Differential Revision: https://reviews.llvm.org/D154995 | 2 年前 | |
[libc++][format] Fixes out of bounds access. Fixes https://llvm.org/PR65011 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D158940 (cherry picked from commit 8930d04d5580c6a2cf04545c87387cd150cd7b46) | 2 年前 | |
[libc++] Remove availability markup for std::format std::format is currently experimental, so there is technically no deployment target requirement for it (since the only symbols required for it are in libc++experimental.a). However, some parts of std::format depend indirectly on the floating point std::to_chars implementation, which does have deployment target requirements. This patch removes all the availability format for std::format and updates the XFAILs in the tests to properly explain why they fail on old deployment targets, when they do. It also changes a couple of tests to avoid depending on floating-point std::to_chars when it isn't fundamental to the test. Finally, some tests are marked as XFAIL but I added a comment saying TODO FMT This test should not require std::to_chars(floating-point) These tests do not fundamentally depend on floating-point std::to_chars, however they end up failing because calling std::format even without a floating-point argument to format will end up requiring floating-point std::to_chars. I believe this is an implementation artifact that could be avoided in all cases where we know the format string at compile-time. In the tests, I added the TODO comment only to the places where we could do better and actually avoid relying on floating-point std::to_chars because we know the format string at compile-time. Differential Revision: https://reviews.llvm.org/D134598 | 3 年前 | |
[libc++] Remove availability markup for std::format std::format is currently experimental, so there is technically no deployment target requirement for it (since the only symbols required for it are in libc++experimental.a). However, some parts of std::format depend indirectly on the floating point std::to_chars implementation, which does have deployment target requirements. This patch removes all the availability format for std::format and updates the XFAILs in the tests to properly explain why they fail on old deployment targets, when they do. It also changes a couple of tests to avoid depending on floating-point std::to_chars when it isn't fundamental to the test. Finally, some tests are marked as XFAIL but I added a comment saying TODO FMT This test should not require std::to_chars(floating-point) These tests do not fundamentally depend on floating-point std::to_chars, however they end up failing because calling std::format even without a floating-point argument to format will end up requiring floating-point std::to_chars. I believe this is an implementation artifact that could be avoided in all cases where we know the format string at compile-time. In the tests, I added the TODO comment only to the places where we could do better and actually avoid relying on floating-point std::to_chars because we know the format string at compile-time. Differential Revision: https://reviews.llvm.org/D134598 | 3 年前 | |
[libc++][format] Improves diagnostics. Improves both the compile-time and run-time errors. At compile-time it does a bit more work to get more specific errors. This could be done at run-time too, but that has a performance penalty. Since it's expected most use-cases use format* instead of vformat* the compile-time errors are more common. For example when using std::format_to("{:-c}", 42); Before compile output would contain std::__throw_format_error("The format-spec should consume the input or end with a '}'"); Now it contains std::__throw_format_error("The format specifier does not allow the sign option"); Given a better indication the sign option is not allowed. Note the output is still not user-friendly; C++ doesn't have good facilities to generate nice messages from the library. In general all messages have been reviewed and improved, using a more consistent style and using less terms used in the standard. For example format-spec -> format specifier arg-id -> argument index Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D152624 | 2 年前 | |
[libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x This change is almost fully mechanical. The only interesting change is in generate_feature_test_macro_components.py to generate _LIBCPP_STD_VER >= instead. To avoid churn in the git-blame this commit should be added to the .git-blame-ignore-revs once committed. Reviewed By: ldionne, var-const, #libc Spies: jloser, libcxx-commits, arichardson, arphaman, wenlei Differential Revision: https://reviews.llvm.org/D143962 | 3 年前 | |
[libc++] Remove availability markup for std::format std::format is currently experimental, so there is technically no deployment target requirement for it (since the only symbols required for it are in libc++experimental.a). However, some parts of std::format depend indirectly on the floating point std::to_chars implementation, which does have deployment target requirements. This patch removes all the availability format for std::format and updates the XFAILs in the tests to properly explain why they fail on old deployment targets, when they do. It also changes a couple of tests to avoid depending on floating-point std::to_chars when it isn't fundamental to the test. Finally, some tests are marked as XFAIL but I added a comment saying TODO FMT This test should not require std::to_chars(floating-point) These tests do not fundamentally depend on floating-point std::to_chars, however they end up failing because calling std::format even without a floating-point argument to format will end up requiring floating-point std::to_chars. I believe this is an implementation artifact that could be avoided in all cases where we know the format string at compile-time. In the tests, I added the TODO comment only to the places where we could do better and actually avoid relying on floating-point std::to_chars because we know the format string at compile-time. Differential Revision: https://reviews.llvm.org/D134598 | 3 年前 | |
[libc++][format] Improves run-time diagnostics. After parsing a std-format-spec it's validated, depending on the type used some format options are not allowed. This improves the error messages in the exceptions thrown upon failure. Depends on D155364 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D155366 | 2 年前 | |
[libc++][format] Improves run-time diagnostics. After parsing a std-format-spec it's validated, depending on the type used some format options are not allowed. This improves the error messages in the exceptions thrown upon failure. Depends on D155364 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D155366 | 2 年前 | |
[libc++][format] Improves run-time diagnostics. After parsing a std-format-spec it's validated, depending on the type used some format options are not allowed. This improves the error messages in the exceptions thrown upon failure. Depends on D155364 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D155366 | 2 年前 | |
[libc++][format] Improves run-time diagnostics. After parsing a std-format-spec it's validated, depending on the type used some format options are not allowed. This improves the error messages in the exceptions thrown upon failure. Depends on D155364 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D155366 | 2 年前 | |
[libc++][format] Granularize formatter_output. This should reduce the size of the transitive includes for the vector header. Note the header still quite large so the difference may be small. Depends on D154122 Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D154286 | 2 年前 | |
[libc++][format] Granularize formatter_output. This should reduce the size of the transitive includes for the vector header. Note the header still quite large so the difference may be small. Depends on D154122 Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D154286 | 2 年前 | |
[libc++][format] Improves run-time diagnostics. After parsing a std-format-spec it's validated, depending on the type used some format options are not allowed. This improves the error messages in the exceptions thrown upon failure. Depends on D155364 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D155366 | 2 年前 | |
[libc++][format] Granularize formatter_output. This should reduce the size of the transitive includes for the vector header. Note the header still quite large so the difference may be small. Depends on D154122 Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D154286 | 2 年前 | |
[libc++][format] Improves diagnostics. Improves both the compile-time and run-time errors. At compile-time it does a bit more work to get more specific errors. This could be done at run-time too, but that has a performance penalty. Since it's expected most use-cases use format* instead of vformat* the compile-time errors are more common. For example when using std::format_to("{:-c}", 42); Before compile output would contain std::__throw_format_error("The format-spec should consume the input or end with a '}'"); Now it contains std::__throw_format_error("The format specifier does not allow the sign option"); Given a better indication the sign option is not allowed. Note the output is still not user-friendly; C++ doesn't have good facilities to generate nice messages from the library. In general all messages have been reviewed and improved, using a more consistent style and using less terms used in the standard. For example format-spec -> format specifier arg-id -> argument index Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D152624 | 2 年前 | |
[libc++][format] Improves diagnostics. Improves both the compile-time and run-time errors. At compile-time it does a bit more work to get more specific errors. This could be done at run-time too, but that has a performance penalty. Since it's expected most use-cases use format* instead of vformat* the compile-time errors are more common. For example when using std::format_to("{:-c}", 42); Before compile output would contain std::__throw_format_error("The format-spec should consume the input or end with a '}'"); Now it contains std::__throw_format_error("The format specifier does not allow the sign option"); Given a better indication the sign option is not allowed. Note the output is still not user-friendly; C++ doesn't have good facilities to generate nice messages from the library. In general all messages have been reviewed and improved, using a more consistent style and using less terms used in the standard. For example format-spec -> format specifier arg-id -> argument index Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D152624 | 2 年前 | |
[libc++] Fix template parameter naming and enforce it through readability-identifier-naming Reviewed By: #libc, Mordante Spies: Mordante, aheejin, libcxx-commits Differential Revision: https://reviews.llvm.org/D156059 | 2 年前 | |
[libc++][format] Improves diagnostics. Improves both the compile-time and run-time errors. At compile-time it does a bit more work to get more specific errors. This could be done at run-time too, but that has a performance penalty. Since it's expected most use-cases use format* instead of vformat* the compile-time errors are more common. For example when using std::format_to("{:-c}", 42); Before compile output would contain std::__throw_format_error("The format-spec should consume the input or end with a '}'"); Now it contains std::__throw_format_error("The format specifier does not allow the sign option"); Given a better indication the sign option is not allowed. Note the output is still not user-friendly; C++ doesn't have good facilities to generate nice messages from the library. In general all messages have been reviewed and improved, using a more consistent style and using less terms used in the standard. For example format-spec -> format specifier arg-id -> argument index Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D152624 | 2 年前 | |
[libc++][format] Removes unneeded includes. I did a manual review after the post-review comments in D149543 Reviewed By: #libc, philnik, ldionne Differential Revision: https://reviews.llvm.org/D154122 | 2 年前 | |
[libc++][format] Improves width estimate. As obvious from the paper's title this is an LWG issue and thus retroactively applied to C++20. This change may the output for certain code points: 1 Considers 8477 extra codepoints as having a width 2 (as of Unicode 15) (mostly Tangut Ideographs) 2 Change the width of 85 unassigned code points from 2 to 1 3 Change the width of 8 codepoints (in the range U+3248 CIRCLED NUMBER TEN ON BLACK SQUARE ... U+324F CIRCLED NUMBER EIGHTY ON BLACK SQUARE) from 2 to 1, because it seems questionable to make an exception for those without input from Unicode Note that libc++ already uses Unicode 15, while the Standard requires Unicode 12. (The last time I checked MSVC STL used Unicode 14.) So in practice the only notable change is item 3. Implements P2675 LWG3780: The Paper format's width estimation is too approximate and not forward compatible Benchmark before these changes -------------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------------- BM_ascii_text<char> 3928 ns 3928 ns 178131 BM_unicode_text<char> 75231 ns 75230 ns 9158 BM_cyrillic_text<char> 59837 ns 59834 ns 11529 BM_japanese_text<char> 39842 ns 39832 ns 17501 BM_emoji_text<char> 3931 ns 3930 ns 177750 BM_ascii_text<wchar_t> 4024 ns 4024 ns 174190 BM_unicode_text<wchar_t> 63756 ns 63751 ns 11136 BM_cyrillic_text<wchar_t> 44639 ns 44638 ns 15597 BM_japanese_text<wchar_t> 34425 ns 34424 ns 20283 BM_emoji_text<wchar_t> 3937 ns 3937 ns 177684 Benchmark after these changes -------------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------------- BM_ascii_text<char> 3914 ns 3913 ns 178814 BM_unicode_text<char> 70380 ns 70378 ns 9694 BM_cyrillic_text<char> 51889 ns 51877 ns 13488 BM_japanese_text<char> 41707 ns 41705 ns 16723 BM_emoji_text<char> 3908 ns 3907 ns 177912 BM_ascii_text<wchar_t> 3949 ns 3948 ns 177525 BM_unicode_text<wchar_t> 64591 ns 64587 ns 10649 BM_cyrillic_text<wchar_t> 44089 ns 44078 ns 15721 BM_japanese_text<wchar_t> 39369 ns 39367 ns 17779 BM_emoji_text<wchar_t> 3936 ns 3934 ns 177821 Benchmarks without "if(__code_point < (__entries[0] >> 14))" -------------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------------- BM_ascii_text<char> 3922 ns 3922 ns 178587 BM_unicode_text<char> 94474 ns 94474 ns 7351 BM_cyrillic_text<char> 69202 ns 69200 ns 10157 BM_japanese_text<char> 42735 ns 42692 ns 16382 BM_emoji_text<char> 3920 ns 3919 ns 178704 BM_ascii_text<wchar_t> 3951 ns 3950 ns 177224 BM_unicode_text<wchar_t> 81003 ns 80988 ns 8668 BM_cyrillic_text<wchar_t> 57020 ns 57018 ns 12048 BM_japanese_text<wchar_t> 39695 ns 39687 ns 17582 BM_emoji_text<wchar_t> 3977 ns 3976 ns 176479 This optimization does carry its weight for the Unicode and Cyrillic test. For the Japanese tests the gains are minor and for emoji it seems to have no effect. Reviewed By: ldionne, tahonermann, #libc Differential Revision: https://reviews.llvm.org/D144499 | 3 年前 | |
[libc++][format] Granularize formatter_output. This should reduce the size of the transitive includes for the vector header. Note the header still quite large so the difference may be small. Depends on D154122 Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D154286 | 2 年前 |