[libcxx-commits] [libcxx] 720b556 - [libc++][NFC] Move __char_traits_length_checked outside of wchar_t definitions

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 9 10:24:14 PDT 2021


Author: Louis Dionne
Date: 2021-09-09T13:24:11-04:00
New Revision: 720b5560364d07a7ea85527f5a700481ece0a3aa

URL: https://github.com/llvm/llvm-project/commit/720b5560364d07a7ea85527f5a700481ece0a3aa
DIFF: https://github.com/llvm/llvm-project/commit/720b5560364d07a7ea85527f5a700481ece0a3aa.diff

LOG: [libc++][NFC] Move __char_traits_length_checked outside of wchar_t definitions

This will simplify an upcoming diff.

Added: 
    

Modified: 
    libcxx/include/__string

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__string b/libcxx/include/__string
index b77a7fb4f8d3..a23e7c95fe44 100644
--- a/libcxx/include/__string
+++ b/libcxx/include/__string
@@ -497,18 +497,6 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size
 #endif
 }
 
-
-template <class _Traits>
-_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
-  return _Traits::length(__s);
-#endif
-}
-
 inline _LIBCPP_CONSTEXPR_AFTER_CXX14
 size_t
 char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
@@ -546,6 +534,16 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __
 #endif
 }
 
+template <class _Traits>
+_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
+  return _Traits::length(__s);
+#endif
+}
 
 #ifndef _LIBCPP_HAS_NO_CHAR8_T
 


        


More information about the libcxx-commits mailing list