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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 8 10:11:04 PST 2022


ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

It seems to me that _LIBCPP_ASSERT is sufficient here -- although CI might
tell me why I'm wrong.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121231

Files:
  libcxx/include/__string


Index: libcxx/include/__string
===================================================================
--- libcxx/include/__string
+++ libcxx/include/__string
@@ -563,11 +563,8 @@
 _LIBCPP_INLINE_VISIBILITY
 _LIBCPP_CONSTEXPR
 inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
-#if _LIBCPP_DEBUG_LEVEL >= 1
-  return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0);
-#else
+  _LIBCPP_ASSERT(__s != nullptr, "null pointer passed to non-null argument of char_traits<...>::length");
   return _Traits::length(__s);
-#endif
 }
 
 #ifndef _LIBCPP_HAS_NO_CHAR8_T


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121231.413860.patch
Type: text/x-patch
Size: 749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220308/e802038b/attachment.bin>


More information about the libcxx-commits mailing list