[libcxx-commits] [libcxx] cd34e89 - [libc++][NFC] Remove __has_keyword

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 19 15:46:20 PDT 2023


Author: Nikolas Klauser
Date: 2023-08-19T15:46:13-07:00
New Revision: cd34e89cfabbc43a89bac5f0e4e84ebee0e4e167

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

LOG: [libc++][NFC] Remove __has_keyword

__has_keyword is almost not used anymore. There are only two cases. One can be replaced by __has_builtin and the other seems entirely redundant, so we can remove the definition.

Reviewed By: #libc, Mordante

Spies: Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D158215

Added: 
    

Modified: 
    libcxx/include/__config
    libcxx/include/tuple

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index df2d88fb5417b7..b503e1d01b10ed 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -362,8 +362,6 @@
 #    define __has_declspec_attribute(__x) 0
 #  endif
 
-#  define __has_keyword(__x) !(__is_identifier(__x))
-
 #  ifndef __has_include
 #    define __has_include(...) 0
 #  endif
@@ -1154,7 +1152,7 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
 #    define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #  endif
 
-#  if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
+#  if __has_feature(cxx_atomic) || __has_extension(c_atomic)
 #    define _LIBCPP_HAS_C_ATOMIC_IMP
 #  elif defined(_LIBCPP_COMPILER_GCC)
 #    define _LIBCPP_HAS_GCC_ATOMIC_IMP

diff  --git a/libcxx/include/tuple b/libcxx/include/tuple
index 3542fafd4fb815..02998a4e2b4a92 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -308,7 +308,7 @@ class __tuple_leaf
 
     template <class _Tp>
     static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
-#if __has_keyword(__reference_binds_to_temporary)
+#if __has_builtin(__reference_binds_to_temporary)
       return !__reference_binds_to_temporary(_Hp, _Tp);
 #else
       return true;


        


More information about the libcxx-commits mailing list