[libcxx-commits] [PATCH] D139555: [libc++] Refactor char_traits

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 7 11:52:56 PST 2022


philnik marked an inline comment as done.
philnik added inline comments.


================
Comment at: libcxx/include/__string/char_traits.h:362
     _LIBCPP_INLINE_VISIBILITY static constexpr
     const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
 
----------------
Mordante wrote:
> Why is this function and length not changed? Do the builtins not work with them?
Yes, `__builtin_char_memchr` only works with `char`: https://godbolt.org/z/YvzMdzc1x


================
Comment at: libcxx/include/cstring:102
 
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR size_t __constexpr_strlen(const char* __str) {
+  return __builtin_strlen(__str);
----------------
Mordante wrote:
> Are these used except in the traits?
> I really like to see some private tests for these functions.
Not currently, but I'm working on a patch that uses `__constexpr_memcmp` to optimize `std{,::ranges}::equal()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139555/new/

https://reviews.llvm.org/D139555



More information about the libcxx-commits mailing list