13 #ifndef LLVM_SUPPORT_TYPE_TRAITS_H 14 #define LLVM_SUPPORT_TYPE_TRAITS_H 17 #include <type_traits> 31 using UnderlyingT =
typename std::remove_reference<T>::type;
35 !std::is_class<UnderlyingT>::value &&
36 !std::is_pointer<UnderlyingT>::value &&
37 !std::is_floating_point<UnderlyingT>::value &&
38 (std::is_enum<UnderlyingT>::value ||
39 std::is_convertible<UnderlyingT, unsigned long long>::value);
43 template<
typename T,
typename Enable =
void>
48 T, typename
std::enable_if<std::is_pointer<T>::value>
::type> {
54 template<
typename T,
typename Enable =
void>
59 T, typename
std::enable_if<std::is_pointer<T>::value>
::type> {
60 using type =
const typename std::remove_pointer<T>::type *;
63 template <
typename T,
typename Enable =
void>
69 T, typename
std::enable_if<std::is_pointer<T>::value>
::type> {
100 : std::is_copy_constructible<
101 ::llvm::detail::copy_construction_triviality_helper<T>> {};
102 template <
typename T>
104 template <
typename T>
109 template <
typename T>
111 : std::is_move_constructible<
112 ::llvm::detail::move_construction_triviality_helper<T>> {};
113 template <
typename T>
115 template <
typename T>
119 template <
typename T>
122 static auto get(
F*) -> decltype(std::declval<F &>() = std::declval<const F &>(), std::true_type{});
123 static std::false_type
get(...);
124 static constexpr
bool value = decltype(
get((
T*)
nullptr))::value;
127 template <
typename T>
130 static auto get(
F*) -> decltype(std::declval<F &>() = std::declval<F &&>(), std::true_type{});
131 static std::false_type
get(...);
132 static constexpr
bool value = decltype(
get((
T*)
nullptr))::value;
140 template <
typename T>
144 static constexpr
bool has_trivial_copy_constructor =
145 std::is_copy_constructible<detail::trivial_helper<T>>
::value;
146 static constexpr
bool has_deleted_copy_constructor =
147 !std::is_copy_constructible<T>::value;
150 static constexpr
bool has_trivial_move_constructor =
151 std::is_move_constructible<detail::trivial_helper<T>>
::value;
152 static constexpr
bool has_deleted_move_constructor =
153 !std::is_move_constructible<T>::value;
156 static constexpr
bool has_trivial_copy_assign =
158 static constexpr
bool has_deleted_copy_assign =
162 static constexpr
bool has_trivial_move_assign =
164 static constexpr
bool has_deleted_move_assign =
168 static constexpr
bool has_trivial_destructor =
169 std::is_destructible<detail::trivial_helper<T>>
::value;
173 static constexpr
bool value =
174 has_trivial_destructor &&
175 (has_deleted_move_assign || has_trivial_move_assign) &&
176 (has_deleted_move_constructor || has_trivial_move_constructor) &&
177 (has_deleted_copy_assign || has_trivial_copy_assign) &&
178 (has_deleted_copy_constructor || has_trivial_copy_constructor);
180 #ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE 181 static_assert(value == std::is_trivially_copyable<T>::value,
182 "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
185 template <
typename T>
192 #endif // LLVM_SUPPORT_TYPE_TRAITS_H This class represents lattice values for constants.
Metafunction that determines whether the given type is either an integral type or an enumeration type...
An implementation of std::is_trivially_move_constructible since we have users with STLs that don't ye...
An implementation of std::is_trivially_copy_constructible since we have users with STLs that don't ye...
If T is a pointer to X, return a pointer to const X.
Internal utility to detect trivial copy construction.
If T is a pointer, just return it. If it is not, return T&.
typename add_const_past_pointer< T >::type type
const typename std::remove_pointer< T >::type * type
Internal utility to detect trivial move construction.