[libcxx-commits] [libcxx] 911cb60 - [libc++] Use __array_rank in Clang versions without any known bugs (#136103)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 25 01:36:35 PDT 2025
Author: Nikolas Klauser
Date: 2025-04-25T10:36:31+02:00
New Revision: 911cb60975b1b8d2dc695e3e57c2e4c0db303e12
URL: https://github.com/llvm/llvm-project/commit/911cb60975b1b8d2dc695e3e57c2e4c0db303e12
DIFF: https://github.com/llvm/llvm-project/commit/911cb60975b1b8d2dc695e3e57c2e4c0db303e12.diff
LOG: [libc++] Use __array_rank in Clang versions without any known bugs (#136103)
There was a bug in the implementation of `__array_rank` until LLVM 20
which prevented us from using the builtin. Since the bug has been fixed
now we can enable the use and remove the generic implementation in a few
releases.
Added:
Modified:
libcxx/include/__type_traits/rank.h
Removed:
################################################################################
diff --git a/libcxx/include/__type_traits/rank.h b/libcxx/include/__type_traits/rank.h
index 55c78ea044b37..5196b62949fa2 100644
--- a/libcxx/include/__type_traits/rank.h
+++ b/libcxx/include/__type_traits/rank.h
@@ -19,11 +19,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-// TODO: Enable using the builtin __array_rank when https://llvm.org/PR57133 is resolved
-#if __has_builtin(__array_rank) && 0
+#if __has_builtin(__array_rank) && !defined(_LIBCPP_COMPILER_CLANG_BASED) || \
+ (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 2001)
template <class _Tp>
-struct rank : integral_constant<size_t, __array_rank(_Tp)> {};
+struct _LIBCPP_NO_SPECIALIZATIONS rank : integral_constant<size_t, __array_rank(_Tp)> {};
#else
More information about the libcxx-commits
mailing list