[libcxx] r293193 - Merging r293154:
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 26 09:55:47 PST 2017
Author: hans
Date: Thu Jan 26 11:55:46 2017
New Revision: 293193
URL: http://llvm.org/viewvc/llvm-project?rev=293193&view=rev
Log:
Merging r293154:
------------------------------------------------------------------------
r293154 | marshall | 2017-01-25 22:58:29 -0800 (Wed, 25 Jan 2017) | 1 line
Use the new __has_feature(cxx_constexpr_string_builtins) for detection of the C-string intrinsics for constexpr support in std::char_traits. Thanks to Richard for the intrisic support.
------------------------------------------------------------------------
Modified:
libcxx/branches/release_40/ (props changed)
libcxx/branches/release_40/include/__config
libcxx/branches/release_40/include/__string
Propchange: libcxx/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 26 11:55:46 2017
@@ -1,2 +1,2 @@
/libcxx/branches/apple:136569-137939
-/libcxx/trunk:292013,292091,292990
+/libcxx/trunk:292013,292091,292990,293154
Modified: libcxx/branches/release_40/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/__config?rev=293193&r1=293192&r2=293193&view=diff
==============================================================================
--- libcxx/branches/release_40/include/__config (original)
+++ libcxx/branches/release_40/include/__config Thu Jan 26 11:55:46 2017
@@ -403,15 +403,6 @@ namespace std {
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
#endif
-// A constexpr version of __builtin_memcmp was added in clang 4.0
-#if __has_builtin(__builtin_memcmp)
-# ifdef __apple_build_version__
-// No shipping version of Apple's clang has constexpr __builtin_memcmp
-# elif __clang_major__ > 3
-# define _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR
-# endif
-#endif
-
#elif defined(_LIBCPP_COMPILER_GCC)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
Modified: libcxx/branches/release_40/include/__string
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/release_40/include/__string?rev=293193&r1=293192&r2=293193&view=diff
==============================================================================
--- libcxx/branches/release_40/include/__string (original)
+++ libcxx/branches/release_40/include/__string Thu Jan 26 11:55:46 2017
@@ -243,7 +243,7 @@ char_traits<char>::compare(const char_ty
{
if (__n == 0)
return 0;
-#ifdef _LIBCPP_BUILTIN_MEMCMP_ISCONSTEXPR
+#if __has_feature(cxx_constexpr_string_builtins)
return __builtin_memcmp(__s1, __s2, __n);
#elif _LIBCPP_STD_VER <= 14
return memcmp(__s1, __s2, __n);
@@ -265,7 +265,9 @@ char_traits<char>::find(const char_type*
{
if (__n == 0)
return NULL;
-#if _LIBCPP_STD_VER <= 14
+#if __has_feature(cxx_constexpr_string_builtins)
+ return __builtin_char_memchr(__s, to_int_type(__a), __n);
+#elif _LIBCPP_STD_VER <= 14
return (const char_type*) memchr(__s, to_int_type(__a), __n);
#else
for (; __n; --__n)
@@ -331,7 +333,7 @@ char_traits<wchar_t>::compare(const char
{
if (__n == 0)
return 0;
-#if __has_builtin(__builtin_wmemcmp)
+#if __has_feature(cxx_constexpr_string_builtins)
return __builtin_wmemcmp(__s1, __s2, __n);
#elif _LIBCPP_STD_VER <= 14
return wmemcmp(__s1, __s2, __n);
@@ -351,7 +353,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX14
size_t
char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
{
-#if __has_builtin(__builtin_wcslen)
+#if __has_feature(cxx_constexpr_string_builtins)
return __builtin_wcslen(__s);
#elif _LIBCPP_STD_VER <= 14
return wcslen(__s);
@@ -369,7 +371,7 @@ char_traits<wchar_t>::find(const char_ty
{
if (__n == 0)
return NULL;
-#if __has_builtin(__builtin_wmemchr)
+#if __has_feature(cxx_constexpr_string_builtins)
return __builtin_wmemchr(__s, __a, __n);
#elif _LIBCPP_STD_VER <= 14
return wmemchr(__s, __a, __n);
More information about the cfe-commits
mailing list