[libcxx-commits] [libcxx] 1637921 - [libc++][NFC] Move concepts to a subheader.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 2 10:22:20 PDT 2021


Author: Mark de Wever
Date: 2021-09-02T19:22:15+02:00
New Revision: 163792113400a144eb1d4d83f464399679c47e14

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

LOG: [libc++][NFC] Move concepts to a subheader.

D103357 added some new concepts. Since the header `<concepts>` has moved
all its concepts to a separate header these new concepts feel out of
place. Move them to the appropriate header.

Reviewed By: #libc, Quuxplusone, ldionne

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

Added: 
    

Modified: 
    libcxx/include/__concepts/arithmetic.h
    libcxx/include/__format/format_arg.h
    libcxx/include/concepts
    libcxx/include/type_traits

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__concepts/arithmetic.h b/libcxx/include/__concepts/arithmetic.h
index 4568f79bb7f83..250e7f341ef6a 100644
--- a/libcxx/include/__concepts/arithmetic.h
+++ b/libcxx/include/__concepts/arithmetic.h
@@ -34,6 +34,15 @@ concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
 template<class _Tp>
 concept floating_point = is_floating_point_v<_Tp>;
 
+// Concept helpers for the internal type traits for the fundamental types.
+
+template <class _Tp>
+concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
+template <class _Tp>
+concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
+template <class _Tp>
+concept __libcpp_floating_point = __libcpp_is_floating_point<_Tp>::value;
+
 #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index 35b48c023827e..a9a8c1f0da031 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -10,12 +10,12 @@
 #ifndef _LIBCPP___FORMAT_FORMAT_ARG_H
 #define _LIBCPP___FORMAT_FORMAT_ARG_H
 
+#include <__concepts/arithmetic.h>
 #include <__config>
 #include <__format/format_error.h>
 #include <__format/format_fwd.h>
 #include <__functional_base>
 #include <__variant/monostate.h>
-#include <concepts>
 #include <string>
 #include <string_view>
 

diff  --git a/libcxx/include/concepts b/libcxx/include/concepts
index 99dd85c30f91d..bfa27ddca0d46 100644
--- a/libcxx/include/concepts
+++ b/libcxx/include/concepts
@@ -152,28 +152,10 @@ namespace std {
 #include <__concepts/swappable.h>
 #include <__concepts/totally_ordered.h>
 #include <__config>
-#include <type_traits>
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
 
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
-// Concept helpers for the internal type traits for the fundamental types.
-
-template <class _Tp>
-concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
-template <class _Tp>
-concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
-template <class _Tp>
-concept __libcpp_floating_point = __libcpp_is_floating_point<_Tp>::value;
-
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
-_LIBCPP_END_NAMESPACE_STD
-
 #endif // _LIBCPP_CONCEPTS

diff  --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 63f2d3aa29d64..3f44ee3b2cfe9 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -789,9 +789,6 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_integral_v
 
 #endif // __has_keyword(__is_integral)
 
-// __libcpp_is_signed_integer, __libcpp_is_unsigned_integer
-// <concepts> implements __libcpp_signed_integer, __libcpp_unsigned_integer
-
 // [basic.fundamental] defines five standard signed integer types;
 // __int128_t is an extended signed integer type.
 // The signed and unsigned integer types, plus bool and the


        


More information about the libcxx-commits mailing list