[libcxx-commits] [PATCH] D158215: [libc++][NFC] Remove __has_keyword

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 17 13:49:29 PDT 2023


philnik created this revision.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

__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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158215

Files:
  libcxx/include/__config
  libcxx/include/tuple


Index: libcxx/include/tuple
===================================================================
--- libcxx/include/tuple
+++ libcxx/include/tuple
@@ -308,7 +308,7 @@
 
     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;
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ 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
@@ -1156,7 +1154,7 @@
 #    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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158215.551255.patch
Type: text/x-patch
Size: 1161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230817/d4e31f23/attachment-0001.bin>


More information about the libcxx-commits mailing list