NNikolas Klauser[libc++] Granularize some more type_traits
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[libc++] Make the Debug mode a configuration-time only option The debug mode has been broken pretty much ever since it was shipped because it was possible to enable the debug mode in user code without actually enabling it in the dylib, leading to ODR violations that caused various kinds of failures. This commit makes the debug mode a knob that is configured when building the library and which can't be changed afterwards. This is less flexible for users, however it will actually work as intended and it will allow us, in the future, to add various kinds of checks that do not assume the same ABI as the normal library. Furthermore, this will make the debug mode more robust, which means that vendors might be more tempted to support it properly, which hasn't been the case with the current debug mode. This patch shouldn't break any user code, except folks who are building against a library that doesn't have the debug mode enabled and who try to enable the debug mode in their code. Such users will get a compile-time error explaining that this configuration isn't supported anymore. In the future, we should further increase the granularity of the debug mode checks so that we can cherry-pick which checks to enable, like we do for unspecified behavior randomization. Differential Revision: https://reviews.llvm.org/D122941 | 4 年前 | |
[libc++][format] Adds a formattable concept. The concept is based on P2286R2 Formatting Ranges. It will be used to optimise the storage of __format_arg_store as required by LWG-3473. Depends on D120916 Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D120921 | 4 年前 | |
[libc++][format][3/6] Adds a __container_buffer. Instead of writing every character directly into the container by using a back_insert_iterator the data is buffered in an array. This buffer is then inserted to the container by calling its insert member function. Since there's no guarantee every container's insert behaves properly containers need to opt-in to this behaviour. The appropriate standard containers opt-in to this behaviour. This change improves the performance of the format functions that use a back_insert_iterator. Depends on D110495 Reviewed By: ldionne, vitaut, #libc Differential Revision: https://reviews.llvm.org/D110497 | 4 年前 | |
[libc++] Implements Unicode grapheme clustering This implements the Grapheme clustering as required by P1868R2 width: clarifying units of width and precision in std::format This was omitted in the initial patch, but the paper was marked as completed. This really completes the paper. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D126971 | 3 年前 | |
[libc++][format] Use forwarding references. This implements a not accepted LWG issue. Not doing so would require integral types to use the handle class instead of being directly stored in the basic_format_arg. The previous code used std::forward in places where it wasn't required by the Standard. These are now removed. Implements: - P2418R2 Add support for std::generator-like types to std::format - LWG 3631 basic_format_arg(T&&) should use remove_cvref_t<T> throughout Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D127570 | 3 年前 | |
[libc++][format] Use forwarding references. This implements a not accepted LWG issue. Not doing so would require integral types to use the handle class instead of being directly stored in the basic_format_arg. The previous code used std::forward in places where it wasn't required by the Standard. These are now removed. Implements: - P2418R2 Add support for std::generator-like types to std::format - LWG 3631 basic_format_arg(T&&) should use remove_cvref_t<T> throughout Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D127570 | 3 年前 | |
[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 | 4 年前 | |
[libc++][NFC] Add missing includes | 4 年前 | |
[libc++] Revert "Protect users from relying on detail headers" & related changes This commit reverts 5aaefa51 (and also partly 7f285f48e77 and b6d75682f9, which were related to the original commit). As landed, 5aaefa51 had unintended consequences on some downstream bots and didn't have proper coverage upstream due to a few subtle things. Implementing this is something we should do in libc++, however we'll first need to address a few issues listed in https://reviews.llvm.org/D106124#3349710. Differential Revision: https://reviews.llvm.org/D120683 | 4 年前 | |
[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 | 4 年前 | |
[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. All supported compilers that support C++20 now support concepts. So, remove _LIB_LIBCPP_HAS_NO_CONCEPTS in favor of _LIBCPP_STD_VER > 17. Similarly in the tests, remove // UNSUPPORTED: libcpp-no-concepts. Differential Revision: https://reviews.llvm.org/D121528 | 4 年前 | |
[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. All supported compilers that support C++20 now support concepts. So, remove _LIB_LIBCPP_HAS_NO_CONCEPTS in favor of _LIBCPP_STD_VER > 17. Similarly in the tests, remove // UNSUPPORTED: libcpp-no-concepts. Differential Revision: https://reviews.llvm.org/D121528 | 4 年前 | |
[libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. All supported compilers that support C++20 now support concepts. So, remove _LIB_LIBCPP_HAS_NO_CONCEPTS in favor of _LIBCPP_STD_VER > 17. Similarly in the tests, remove // UNSUPPORTED: libcpp-no-concepts. Differential Revision: https://reviews.llvm.org/D121528 | 4 年前 | |
[libc++[format][NFC] Removes dead code. This removes a part of the now obsolete formater code. The removal also removes the _v2 suffix where it's no longer needed. Depends on D128785 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D128846 | 3 年前 | |
[libc++][format] Improves parsing speed. A format string like "{}" is quite common. In this case avoid parsing the format-spec when it's not present. Before the parsing was always called, therefore some refactoring is done to make sure the formatters work properly when their parse member isn't called. From the wording it's not entirely clear whether this optimization is allowed [tab:formatter] and the range [pc.begin(), pc.end()) from the last call to f.parse(pc). Implies there's always a call to f.parse even when the format-spec isn't present. Therefore this optimization isn't done for handle classes; it's unclear whether that would break user defined formatters. The improvements give a small reduciton is code size: 719408 12472 488 732368 b2cd0 before 718824 12472 488 731784 b2a88 after The performance benefits when not using a format-spec are: Comparing ./formatter_int.libcxx.out-baseline to ./formatter_int.libcxx.out Benchmark Time CPU Time Old Time New CPU Old CPU New ---------------------------------------------------------------------------------------------------------------------------------------------------- BM_Basic<uint32_t> -0.0688 -0.0687 67 62 67 62 BM_Basic<int32_t> -0.1105 -0.1107 73 65 73 65 BM_Basic<uint64_t> -0.1053 -0.1049 95 85 95 85 BM_Basic<int64_t> -0.0889 -0.0888 93 85 93 85 BM_BasicLow<__uint128_t> -0.0655 -0.0655 96 90 96 90 BM_BasicLow<__int128_t> -0.0693 -0.0694 97 90 97 90 BM_Basic<__uint128_t> -0.0359 -0.0359 256 247 256 247 BM_Basic<__int128_t> -0.0414 -0.0414 239 229 239 229 For the cases where a format-spec is used the results remain similar, some are faster some are slower, differing per run. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D129426 | 3 年前 | |
[libc++][format] Improves parsing speed. A format string like "{}" is quite common. In this case avoid parsing the format-spec when it's not present. Before the parsing was always called, therefore some refactoring is done to make sure the formatters work properly when their parse member isn't called. From the wording it's not entirely clear whether this optimization is allowed [tab:formatter] and the range [pc.begin(), pc.end()) from the last call to f.parse(pc). Implies there's always a call to f.parse even when the format-spec isn't present. Therefore this optimization isn't done for handle classes; it's unclear whether that would break user defined formatters. The improvements give a small reduciton is code size: 719408 12472 488 732368 b2cd0 before 718824 12472 488 731784 b2a88 after The performance benefits when not using a format-spec are: Comparing ./formatter_int.libcxx.out-baseline to ./formatter_int.libcxx.out Benchmark Time CPU Time Old Time New CPU Old CPU New ---------------------------------------------------------------------------------------------------------------------------------------------------- BM_Basic<uint32_t> -0.0688 -0.0687 67 62 67 62 BM_Basic<int32_t> -0.1105 -0.1107 73 65 73 65 BM_Basic<uint64_t> -0.1053 -0.1049 95 85 95 85 BM_Basic<int64_t> -0.0889 -0.0888 93 85 93 85 BM_BasicLow<__uint128_t> -0.0655 -0.0655 96 90 96 90 BM_BasicLow<__int128_t> -0.0693 -0.0694 97 90 97 90 BM_Basic<__uint128_t> -0.0359 -0.0359 256 247 256 247 BM_Basic<__int128_t> -0.0414 -0.0414 239 229 239 229 For the cases where a format-spec is used the results remain similar, some are faster some are slower, differing per run. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D129426 | 3 年前 | |
[libc++[format][NFC] Removes dead code. This removes a part of the now obsolete formater code. The removal also removes the _v2 suffix where it's no longer needed. Depends on D128785 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D128846 | 3 年前 | |
[libc++] Granularize some more type_traits Reviewed By: ldionne, #libc Spies: libcxx-commits, mgorny Differential Revision: https://reviews.llvm.org/D128948 | 3 年前 | |
[libc++] Implements Unicode grapheme clustering This implements the Grapheme clustering as required by P1868R2 width: clarifying units of width and precision in std::format This was omitted in the initial patch, but the paper was marked as completed. This really completes the paper. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D126971 | 3 年前 | |
[libc++][format] Adhere to clang-tidy style. D126971 broke the CI due to recent changes in the clang-tidy settings. This fixes them. | 3 年前 | |
[libc++][format] Improve pointer formatters. This changes the implementation of the formatter. Instead of inheriting from a specialized parser all formatters will use the same generic parser. This reduces the binary size. The new parser contains some additional fields only used in the chrono formatting. Since this doesn't change the size of the parser the fields are in the generic parser. The parser is designed to fit in 128-bit, making it cheap to pass by value. The new format function is a const member function. This isn't required by the Standard yet, but it will be after LWG-3636 is accepted. Additionally P2286 adds a formattable concept which requires the member function to be const qualified in C++23. This paper is likely to be accepted in the 2022 July plenary. This is based on D125606. That commit did the groundwork and did similar changes for the string formatters. Depends on D128139. Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D128671 | 3 年前 | |
[libc++] Implements Unicode grapheme clustering This implements the Grapheme clustering as required by P1868R2 width: clarifying units of width and precision in std::format This was omitted in the initial patch, but the paper was marked as completed. This really completes the paper. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D126971 | 3 年前 | |
[libc++] Implements Unicode grapheme clustering This implements the Grapheme clustering as required by P1868R2 width: clarifying units of width and precision in std::format This was omitted in the initial patch, but the paper was marked as completed. This really completes the paper. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D126971 | 3 年前 | |
[libc++][format] Adhere to clang-tidy style. D126971 broke the CI due to recent changes in the clang-tidy settings. This fixes them. | 3 年前 |