| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[libc++][NFC] Use [[__nodiscard__]] unconditionally (#80454) __has_cpp_attribute(__nodiscard__) is always true now, so we might as well replace _LIBCPP_NODISCARD. It's one less macro that can result in bad diagnostics. | 1 年前 | |
[libc++] Refactor signed/unsigned integer traits (#142750) This patch does a few things: - __libcpp_is_signed_integer and __libcpp_is_unsigned_integer are refactored to be variable templates instead of class templates. - the two traits are merged into a single header <__type_traits/integer_traits.h>. - __libcpp_signed_integer, __libcpp_unsigned_integer and __libcpp_integer are moved into the same header. - The above mentioned concepts are renamed to __signed_integer, __unsigned_integer and __signed_or_unsigned_integer respectively. | 1 年前 | |
[libc++] Refactor signed/unsigned integer traits (#142750) This patch does a few things: - __libcpp_is_signed_integer and __libcpp_is_unsigned_integer are refactored to be variable templates instead of class templates. - the two traits are merged into a single header <__type_traits/integer_traits.h>. - __libcpp_signed_integer, __libcpp_unsigned_integer and __libcpp_integer are moved into the same header. - The above mentioned concepts are renamed to __signed_integer, __unsigned_integer and __signed_or_unsigned_integer respectively. | 1 年前 | |
[libc++] Fix broken precondition of __bit_log2 (#155476) In #135303, we started using __bit_log2 instead of __log2i inside std::sort. However, __bit_log2 has a precondition that __log2i didn't have, which is that the input is non-zero. While it technically makes no sense to request the logarithm of 0, __log2i handled that case and returned 0 without issues. After switching to __bit_log2, passing 0 as an input results in an unsigned integer overflow which can trigger -fsanitize=unsigned-integer-overflow. While not technically UB in itself, it's clearly not intended either. To fix this, we add an internal assertion to __bit_log2 which catches the issue in our test suite, and we make sure not to violate __bit_log2's preconditions before we call it from std::sort. | 10 个月前 | |
[libc++] Refactor signed/unsigned integer traits (#142750) This patch does a few things: - __libcpp_is_signed_integer and __libcpp_is_unsigned_integer are refactored to be variable templates instead of class templates. - the two traits are merged into a single header <__type_traits/integer_traits.h>. - __libcpp_signed_integer, __libcpp_unsigned_integer and __libcpp_integer are moved into the same header. - The above mentioned concepts are renamed to __signed_integer, __unsigned_integer and __signed_or_unsigned_integer respectively. | 1 年前 | |
[libc++] Rename _LIBCPP_INLINE_VISIBILITY to _LIBCPP_HIDE_FROM_ABI (#74095) In preparation for running clang-format on the whole code base, we are also removing mentions of the legacy _LIBCPP_INLINE_VISIBILITY macro in favor of the newer _LIBCPP_HIDE_FROM_ABI. We're still leaving the definition of _LIBCPP_INLINE_VISIBILITY to avoid creating needless breakage in case some older patches are checked-in with mentions of the old macro. After we branch for LLVM 18, we can do another pass to clean up remaining uses of the macro that might have gotten introduced by mistake (if any) and remove the macro itself at the same time. This is just a minor convenience to smooth out the transition as much as possible. See https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all for the clang-format proposal. | 2 年前 | |
[libc++][RFC] Always define internal feature test macros (#89178) Currently, the library-internal feature test macros are only defined if the feature is not available, and always have the prefix _LIBCPP_HAS_NO_. This patch changes that, so that they are always defined and have the prefix _LIBCPP_HAS_ instead. This changes the canonical use of these macros to #if _LIBCPP_HAS_FEATURE, which means that using an undefined macro (e.g. due to a missing include) is diagnosed now. While this is rather unlikely currently, a similar change in <__configuration/availability.h> caught a few bugs. This also improves readability, since it removes the double-negation of #ifndef _LIBCPP_HAS_NO_FEATURE. The current patch only touches the macros defined in <__config>. If people are happy with this approach, I'll make a follow-up PR to also change the macros defined in <__config_site>. | 1 年前 | |
[libc++] Don't bother asserting that <bit> functions get unsigned types (#161487) The builtins already diagnose types other than unsigned integers, so there is no point in static_asserting that again. | 9 个月前 | |
[libc++] Don't bother asserting that <bit> functions get unsigned types (#161487) The builtins already diagnose types other than unsigned integers, so there is no point in static_asserting that again. | 9 个月前 | |
[libc++] Format the code base (#74334) This patch runs clang-format on all of libcxx/include and libcxx/src, in accordance with the RFC discussed at [1]. Follow-up patches will format the benchmarks, the test suite and remaining parts of the code. I'm splitting this one into its own patch so the diff is a bit easier to review. This patch was generated with: find libcxx/include libcxx/src -type f \ | grep -v 'module.modulemap.in' \ | grep -v 'CMakeLists.txt' \ | grep -v 'README.txt' \ | grep -v 'libcxx.imp' \ | grep -v '__config_site.in' \ | xargs clang-format -i A Git merge driver is available in libcxx/utils/clang-format-merge-driver.sh to help resolve merge and rebase issues across these formatting changes. [1]: https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all | 2 年前 | |
[libc++] Optimize std::has_single_bit (#133063) Clang translates most implementations of has_single_bit to (v ^ (v-1)) > v-1 - except the one definition libc++ actually uses. Proof of correctness: https://godbolt.org/z/d61bxW4r1 (Could also be fixed by teaching Clang to optimize better, but making source match output feels clearer to me. And it improves unoptimized performance.) | 8 个月前 | |
[libc++] Optimize ranges::find for vector<bool> Benchmark results: ---------------------------------------------------------------- Benchmark old new ---------------------------------------------------------------- bm_vector_bool_ranges_find/1 5.64 ns 6.08 ns bm_vector_bool_ranges_find/2 16.5 ns 6.03 ns bm_vector_bool_ranges_find/3 20.3 ns 6.07 ns bm_vector_bool_ranges_find/4 22.2 ns 6.08 ns bm_vector_bool_ranges_find/5 23.5 ns 6.05 ns bm_vector_bool_ranges_find/6 24.4 ns 6.10 ns bm_vector_bool_ranges_find/7 26.7 ns 6.10 ns bm_vector_bool_ranges_find/8 25.0 ns 6.08 ns bm_vector_bool_ranges_find/16 27.9 ns 6.07 ns bm_vector_bool_ranges_find/64 44.5 ns 5.35 ns bm_vector_bool_ranges_find/512 243 ns 25.7 ns bm_vector_bool_ranges_find/4096 1858 ns 35.6 ns bm_vector_bool_ranges_find/32768 15461 ns 93.5 ns bm_vector_bool_ranges_find/262144 126462 ns 571 ns bm_vector_bool_ranges_find/1048576 497736 ns 2272 ns Reviewed By: #libc, Mordante Spies: var-const, Mordante, libcxx-commits Differential Revision: https://reviews.llvm.org/D156039 | 2 年前 | |
[libc++] Don't bother asserting that <bit> functions get unsigned types (#161487) The builtins already diagnose types other than unsigned integers, so there is no point in static_asserting that again. | 9 个月前 | |
[libc++] Simplify some of the <bit> functions (#160267) | 10 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 9 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 9 个月前 | ||
| 10 个月前 |