10
10
#define LLVM_LIBC_SRC_SUPPORT_CPP_TYPETRAITS_H
11
11
12
12
#include " src/__support/macros/attributes.h"
13
+ #include " src/__support/macros/config.h"
13
14
14
15
#include < stddef.h> // For size_t.
15
16
@@ -219,16 +220,17 @@ constexpr bool
219
220
declval<F>()))>> = true ;
220
221
221
222
namespace details {
222
- #if __has_builtin(__is_lvalue_reference) && \
223
- __has_builtin (__is_rvalue_reference) && __has_builtin(__is_reference)
223
+ #if LIBC_HAS_BUILTIN(__is_lvalue_reference) && \
224
+ LIBC_HAS_BUILTIN (__is_rvalue_reference) && \
225
+ LIBC_HAS_BUILTIN(__is_reference)
224
226
225
227
template <typename T>
226
228
struct is_lvalue_reference : bool_constant<__is_lvalue_reference(T)> {};
227
229
template <typename T>
228
230
struct is_rvalue_reference : bool_constant<__is_rvalue_reference(T)> {};
229
231
template <typename T> struct is_reference : bool_constant<__is_reference(T)> {};
230
232
231
- #else // __has_builtin (__is_lvalue_reference) && etc...
233
+ #else // LIBC_HAS_BUILTIN (__is_lvalue_reference) && etc...
232
234
233
235
template <typename T> struct is_lvalue_reference : public false_type {};
234
236
template <typename T> struct is_lvalue_reference <T &> : public true_type {};
@@ -240,9 +242,9 @@ template <typename T> struct is_reference : public false_type {};
240
242
template <typename T> struct is_reference <T &> : public true_type {};
241
243
template <typename T> struct is_reference <T &&> : public true_type {};
242
244
243
- #endif // __has_builtin (__is_lvalue_reference) && etc...
245
+ #endif // LIBC_HAS_BUILTIN (__is_lvalue_reference) && etc...
244
246
245
- #if __has_builtin (__remove_all_extents)
247
+ #if LIBC_HAS_BUILTIN (__remove_all_extents)
246
248
template <typename T> using __remove_all_extents_t = __remove_all_extents(T);
247
249
#else
248
250
template <typename T> struct remove_all_extents {
@@ -257,9 +259,9 @@ template <typename T, size_t _Np> struct remove_all_extents<T[_Np]> {
257
259
258
260
template <typename T>
259
261
using __remove_all_extents_t = typename remove_all_extents<T>::type;
260
- #endif // __has_builtin (__remove_all_extents)
262
+ #endif // LIBC_HAS_BUILTIN (__remove_all_extents)
261
263
262
- #if __has_builtin (__is_function)
264
+ #if LIBC_HAS_BUILTIN (__is_function)
263
265
264
266
template <typename T>
265
267
struct is_function : integral_constant<bool , __is_function(T)> {};
@@ -271,14 +273,14 @@ struct is_function
271
273
: public integral_constant<bool , !(is_reference<T>::value ||
272
274
is_const<const T>::value)> {};
273
275
274
- #endif // __has_builtin (__is_function)
276
+ #endif // LIBC_HAS_BUILTIN (__is_function)
275
277
276
- #if __has_builtin (__is_destructible)
278
+ #if LIBC_HAS_BUILTIN (__is_destructible)
277
279
278
280
template <typename T>
279
281
struct is_destructible : bool_constant<__is_destructible(T)> {};
280
282
281
- #else // __has_builtin (__is_destructible)
283
+ #else // LIBC_HAS_BUILTIN (__is_destructible)
282
284
283
285
// if it's a reference, return true
284
286
// if it's a function, return false
@@ -324,24 +326,22 @@ struct is_destructible : public __destructible_false<T, is_function<T>::value> {
324
326
template <typename T> struct is_destructible <T[]> : public false_type {};
325
327
template <> struct is_destructible <void > : public false_type {};
326
328
327
- #endif // __has_builtin (__is_destructible)
329
+ #endif // LIBC_HAS_BUILTIN (__is_destructible)
328
330
} // namespace details
329
331
330
- #if __has_builtin (__is_trivially_destructible)
332
+ #if LIBC_HAS_BUILTIN (__is_trivially_destructible)
331
333
332
334
template <typename T>
333
335
struct is_trivially_destructible
334
336
: public integral_constant<bool , __is_trivially_destructible(T)> {};
335
337
336
- #elif __has_builtin(__has_trivial_destructor)
337
-
338
+ #else
338
339
template <typename T>
339
340
struct is_trivially_destructible
340
341
: public integral_constant<
341
342
bool , __llvm_libc::cpp::details::is_destructible<T>::value
342
343
&&__has_trivial_destructor(T)> {};
343
-
344
- #endif // __has_builtin(__is_trivially_destructible)
344
+ #endif // LIBC_HAS_BUILTIN(__is_trivially_destructible)
345
345
346
346
} // namespace cpp
347
347
} // namespace __llvm_libc
0 commit comments