diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h index ec22fe3a28cf9..41a730e24a6b1 100644 --- a/llvm/include/llvm/ADT/Hashing.h +++ b/llvm/include/llvm/ADT/Hashing.h @@ -333,20 +333,21 @@ inline uint64_t get_execution_seed() { // for equality. For all the platforms we care about, this holds for integers // and pointers, but there are platforms where it doesn't and we would like to // support user-defined types which happen to satisfy this property. -template struct is_hashable_data - : std::integral_constant::value || - std::is_pointer::value) && - 64 % sizeof(T) == 0)> {}; +template +struct is_hashable_data : std::bool_constant<((is_integral_or_enum::value || + std::is_pointer::value) && + 64 % sizeof(T) == 0)> {}; // Special case std::pair to detect when both types are viable and when there // is no alignment-derived padding in the pair. This is a bit of a lie because // std::pair isn't truly POD, but it's close enough in all reasonable // implementations for our use case of hashing the underlying data. -template struct is_hashable_data > - : std::integral_constant::value && - is_hashable_data::value && - (sizeof(T) + sizeof(U)) == - sizeof(std::pair))> {}; +template +struct is_hashable_data> + : std::bool_constant<(is_hashable_data::value && + is_hashable_data::value && + (sizeof(T) + sizeof(U)) == sizeof(std::pair))> { +}; /// Helper to get the hashable data representation for a type. template auto get_hashable_data(const T &value) { diff --git a/llvm/include/llvm/ADT/ilist_node_options.h b/llvm/include/llvm/ADT/ilist_node_options.h index d26e79b925ad1..143195aa9c647 100644 --- a/llvm/include/llvm/ADT/ilist_node_options.h +++ b/llvm/include/llvm/ADT/ilist_node_options.h @@ -82,7 +82,7 @@ template struct extract_sentinel_tracking; template struct extract_sentinel_tracking< ilist_sentinel_tracking, Options...> - : std::integral_constant, is_explicit {}; + : std::bool_constant, is_explicit {}; template struct extract_sentinel_tracking : extract_sentinel_tracking {}; @@ -119,7 +119,7 @@ template struct is_valid_option> : std::true_type {}; template struct extract_iterator_bits; template struct extract_iterator_bits, Options...> - : std::integral_constant {}; + : std::bool_constant {}; template struct extract_iterator_bits : extract_iterator_bits {}; @@ -149,8 +149,8 @@ template struct check_options; template <> struct check_options<> : std::true_type {}; template struct check_options - : std::integral_constant::value && - check_options::value> {}; + : std::bool_constant::value && + check_options::value> {}; /// Traits for options for \a ilist_node. /// diff --git a/llvm/include/llvm/Support/CFGDiff.h b/llvm/include/llvm/Support/CFGDiff.h index 11bb9c0fb8f4d..41004d755a124 100644 --- a/llvm/include/llvm/Support/CFGDiff.h +++ b/llvm/include/llvm/Support/CFGDiff.h @@ -34,18 +34,17 @@ namespace llvm { namespace detail { template -auto reverse_if_helper(Range &&R, std::integral_constant) { +auto reverse_if_helper(Range &&R, std::bool_constant) { return std::forward(R); } template -auto reverse_if_helper(Range &&R, std::integral_constant) { +auto reverse_if_helper(Range &&R, std::bool_constant) { return llvm::reverse(std::forward(R)); } template auto reverse_if(Range &&R) { - return reverse_if_helper(std::forward(R), - std::integral_constant{}); + return reverse_if_helper(std::forward(R), std::bool_constant{}); } } // namespace detail diff --git a/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h index b7d2e2e45f71f..3e0800e1efe6c 100644 --- a/llvm/include/llvm/Support/FormatProviders.h +++ b/llvm/include/llvm/Support/FormatProviders.h @@ -29,35 +29,31 @@ namespace support { namespace detail { template struct use_integral_formatter - : public std::integral_constant< - bool, is_one_of::value> {}; + : public std::bool_constant< + is_one_of::value> {}; template -struct use_char_formatter - : public std::integral_constant> {}; +struct use_char_formatter : public std::bool_constant> { +}; template struct is_cstring - : public std::integral_constant::value> { -}; + : public std::bool_constant::value> {}; template struct use_string_formatter - : public std::integral_constant> { -}; + : public std::bool_constant> {}; template struct use_pointer_formatter - : public std::integral_constant && - !is_cstring::value> {}; + : public std::bool_constant && !is_cstring::value> { +}; template struct use_double_formatter - : public std::integral_constant> {}; + : public std::bool_constant> {}; class HelperFunctions { protected: @@ -330,8 +326,7 @@ using IterValue = typename std::iterator_traits::value_type; template struct range_item_has_provider - : public std::integral_constant< - bool, + : public std::bool_constant< !support::detail::uses_missing_provider>::value> {}; } // namespace detail } // namespace support diff --git a/llvm/include/llvm/Support/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h index b85a4f6065195..aaad226666aa1 100644 --- a/llvm/include/llvm/Support/FormatVariadicDetails.h +++ b/llvm/include/llvm/Support/FormatVariadicDetails.h @@ -96,26 +96,24 @@ template class has_StreamOperator { // based format() invocation. template struct uses_format_member - : public std::integral_constant< - bool, std::is_base_of_v>> { -}; + : public std::bool_constant< + std::is_base_of_v>> {}; // Simple template that decides whether a type T should use the format_provider // based format() invocation. The member function takes priority, so this test // will only be true if there is not ALSO a format member. template struct uses_format_provider - : public std::integral_constant< - bool, !uses_format_member::value && has_FormatProvider::value> { -}; + : public std::bool_constant::value && + has_FormatProvider::value> {}; // Simple template that decides whether a type T should use the operator<< // based format() invocation. This takes last priority. template struct uses_stream_operator - : public std::integral_constant::value && - !uses_format_provider::value && - has_StreamOperator::value> {}; + : public std::bool_constant::value && + !uses_format_provider::value && + has_StreamOperator::value> {}; // Simple template that decides whether a type T has neither a member-function // nor format_provider based implementation that it can use. Mostly used so @@ -123,10 +121,9 @@ struct uses_stream_operator // implementation can be located. template struct uses_missing_provider - : public std::integral_constant::value && - !uses_format_provider::value && - !uses_stream_operator::value> { -}; + : public std::bool_constant::value && + !uses_format_provider::value && + !uses_stream_operator::value> {}; template std::enable_if_t::value, T> diff --git a/llvm/include/llvm/Support/HashBuilder.h b/llvm/include/llvm/Support/HashBuilder.h index 17fbc3f96ed04..ae266d3f19a1a 100644 --- a/llvm/include/llvm/Support/HashBuilder.h +++ b/llvm/include/llvm/Support/HashBuilder.h @@ -32,8 +32,7 @@ namespace hashbuilder_detail { /// Trait to indicate whether a type's bits can be hashed directly (after /// endianness correction). template -struct IsHashableData - : std::integral_constant::value> {}; +struct IsHashableData : std::bool_constant::value> {}; } // namespace hashbuilder_detail diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h index 27af2d60c837f..cce36a253777b 100644 --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -459,8 +459,7 @@ template struct has_FlowTraits { // Test if SequenceTraits is defined on type T template struct has_SequenceTraits - : public std::integral_constant::value> { -}; + : public std::bool_constant::value> {}; // Test if DocumentListTraits is defined on type T template struct has_DocumentListTraits { @@ -683,15 +682,15 @@ struct missingTraits template struct validatedMappingTraits - : public std::integral_constant< - bool, has_MappingTraits::value && - has_MappingValidateTraits::value> {}; + : public std::bool_constant::value && + has_MappingValidateTraits::value> { +}; template struct unvalidatedMappingTraits - : public std::integral_constant< - bool, has_MappingTraits::value && - !has_MappingValidateTraits::value> {}; + : public std::bool_constant::value && + !has_MappingValidateTraits::value> { +}; // Base class for Input and Output. class LLVM_ABI IO {