[libcxx-commits] [PATCH] D121231: [libc++] Remove raw call to debug handler from __char_traits_length_checked

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 8 10:42:17 PST 2022


Quuxplusone accepted this revision.
Quuxplusone added a comment.
This revision is now accepted and ready to land.

LGTM if CI is green!

This helper is actually called in only one place, and it strikes me that it might be vastly more useful to name it

  template <class _Tp>
  _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
  inline _Tp *__assert_not_null(_Tp *__p) _NOEXCEPT {
    _LIBCPP_ASSERT(__p != nullptr, "pointer must not be null");
    return __p;
  }

as in

  _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
  basic_string_view(const _CharT* __s)
      : __data(_VSTD::__assert_not_null(__s)), __size(_Traits::size(__s)) {}

Also, if you don't generalize it, consider moving it closer to its only call-site, in `<string_view>`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121231



More information about the libcxx-commits mailing list