[libcxx-commits] [PATCH] D127226: [libc++] Simplify type_traits and use more builtins
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 9 08:46:58 PDT 2022
ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.
================
Comment at: libcxx/include/__type_traits/is_arithmetic.h:23
+#if __has_keyword(__is_arithmetic)
+
----------------
On what compilers is this not supported?
================
Comment at: libcxx/include/__type_traits/is_compound.h:22
-// >= 11 because in C++03 nullptr isn't actually nullptr
-#if __has_keyword(__is_compound) && !defined(_LIBCPP_CXX03_LANG)
+#if __has_keyword(__is_compound)
----------------
On what compilers is `__is_compound` not supported?
================
Comment at: libcxx/include/__type_traits/is_floating_point.h:22
+#if __has_keyword(__is_floating_point)
+
----------------
Same question!
================
Comment at: libcxx/include/__type_traits/is_function.h:23
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_function
- : public _BoolConstant<
-#ifdef __clang__
- __is_function(_Tp)
+#if __has_keyword(__is_function)
+
----------------
Ditto.
================
Comment at: libcxx/include/__type_traits/is_fundamental.h:23-25
// Before Clang 10, __is_fundamental didn't work for nullptr_t.
// In C++03 nullptr_t is library-provided but must still count as "fundamental."
+#if __has_keyword(__is_fundamental)
----------------
The comments are now stale. Also, can we simply assume that we have `__is_fundamental`?
================
Comment at: libcxx/include/__type_traits/is_unsigned.h:23
// Before Clang 13, __is_unsigned returned true for enums with signed underlying type.
// No currently-released version of AppleClang contains the fixed intrinsic.
----------------
================
Comment at: libcxx/include/__type_traits/is_unsigned.h:24-25
// Before Clang 13, __is_unsigned returned true for enums with signed underlying type.
// No currently-released version of AppleClang contains the fixed intrinsic.
-#if __has_keyword(__is_unsigned) && \
- !(defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1300) && \
- !defined(_LIBCPP_APPLE_CLANG_VER)
+#if __has_keyword(__is_unsigned) && !defined(_LIBCPP_APPLE_CLANG_VER)
----------------
I'm pretty sure the latest AppleClang 14 beta is fixed. Once it's out of the beta, we can even drop this conditional altogether since it'll be the only AppleClang version we support (per our policy).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127226/new/
https://reviews.llvm.org/D127226
More information about the libcxx-commits
mailing list