Skip to content

Commit 190826c

Browse files
[ADT, Support] Drop extraneous std::bool_constant (NFC) (#161478)
This patch drops extraneous std::bool_constant, replacing: std::bool_constant<std::is_foo_v<...>> with: std::is_foo<...>
1 parent 0e124b9 commit 190826c

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

llvm/include/llvm/ADT/IntervalTree.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ template <typename PointT, typename ValueT> class IntervalData {
236236
//===----------------------------------------------------------------------===//
237237
// Helper class template that is used by the IntervalTree to ensure that one
238238
// does instantiate using only fundamental and/or pointer types.
239-
template <typename T>
240-
using PointTypeIsValid = std::bool_constant<std::is_fundamental<T>::value>;
239+
template <typename T> using PointTypeIsValid = std::is_fundamental<T>;
241240

242241
template <typename T>
243242
using ValueTypeIsValid = std::bool_constant<std::is_fundamental<T>::value ||

llvm/include/llvm/Support/FormatProviders.h

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,26 @@ namespace support {
2929
namespace detail {
3030
template <typename T>
3131
struct use_integral_formatter
32-
: public std::bool_constant<
33-
is_one_of<T, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t,
34-
uint64_t, int, unsigned, long, unsigned long, long long,
35-
unsigned long long>::value> {};
32+
: public is_one_of<T, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
33+
int64_t, uint64_t, int, unsigned, long, unsigned long,
34+
long long, unsigned long long> {};
3635

3736
template <typename T>
38-
struct use_char_formatter : public std::bool_constant<std::is_same_v<T, char>> {
39-
};
37+
struct use_char_formatter : public std::is_same<T, char> {};
4038

4139
template <typename T>
42-
struct is_cstring
43-
: public std::bool_constant<is_one_of<T, char *, const char *>::value> {};
40+
struct is_cstring : public is_one_of<T, char *, const char *> {};
4441

4542
template <typename T>
46-
struct use_string_formatter
47-
: public std::bool_constant<std::is_convertible_v<T, llvm::StringRef>> {};
43+
struct use_string_formatter : public std::is_convertible<T, llvm::StringRef> {};
4844

4945
template <typename T>
5046
struct use_pointer_formatter
5147
: public std::bool_constant<std::is_pointer_v<T> && !is_cstring<T>::value> {
5248
};
5349

5450
template <typename T>
55-
struct use_double_formatter
56-
: public std::bool_constant<std::is_floating_point_v<T>> {};
51+
struct use_double_formatter : public std::is_floating_point<T> {};
5752

5853
class HelperFunctions {
5954
protected:

llvm/include/llvm/Support/FormatVariadicDetails.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ template <class T> class has_StreamOperator {
9292
// based format() invocation.
9393
template <typename T>
9494
struct uses_format_member
95-
: public std::bool_constant<
96-
std::is_base_of_v<format_adapter, std::remove_reference_t<T>>> {};
95+
: public std::is_base_of<format_adapter, std::remove_reference_t<T>> {};
9796

9897
// Simple template that decides whether a type T should use the format_provider
9998
// based format() invocation. The member function takes priority, so this test

llvm/include/llvm/Support/HashBuilder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ namespace llvm {
3131
namespace hashbuilder_detail {
3232
/// Trait to indicate whether a type's bits can be hashed directly (after
3333
/// endianness correction).
34-
template <typename U>
35-
struct IsHashableData : std::bool_constant<is_integral_or_enum<U>::value> {};
34+
template <typename U> struct IsHashableData : is_integral_or_enum<U> {};
3635

3736
} // namespace hashbuilder_detail
3837

0 commit comments

Comments
 (0)