From 6b6a542c1d819b47d26e462ac14b89a951615beb Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 17 Apr 2023 11:26:56 -0700 Subject: [PATCH] Revert "[ADT] Apply fixes from modernize-type-traits (NFC)" This reverts commit 9395cf063a013003704118deccf7633533170a5b because it breaks the modules build: STLFunctionalExtras.h:54:3: error: 'llvm::function_ref> (llvm::StringRef, llvm::StringRef)>::function_ref' from module 'LLVM_Utils.ADT.STLFunctionalExtras' is not present in definition of 'llvm::function_ref> (llvm::StringRef, llvm::StringRef)>' in module 'LLVM_Utils.ADT.STLFunctionalExtras' https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/53806/ --- llvm/include/llvm/ADT/APFloat.h | 10 ++--- llvm/include/llvm/ADT/Any.h | 4 +- llvm/include/llvm/ADT/ArrayRef.h | 14 +++---- llvm/include/llvm/ADT/Bitfields.h | 21 +++++----- llvm/include/llvm/ADT/CoalescingBitVector.h | 2 +- llvm/include/llvm/ADT/DenseMap.h | 2 +- llvm/include/llvm/ADT/FoldingSet.h | 2 +- llvm/include/llvm/ADT/FunctionExtras.h | 13 ++++--- llvm/include/llvm/ADT/Hashing.h | 10 ++--- llvm/include/llvm/ADT/IntrusiveRefCntPtr.h | 4 +- llvm/include/llvm/ADT/PointerIntPair.h | 6 +-- llvm/include/llvm/ADT/PriorityWorklist.h | 2 +- llvm/include/llvm/ADT/STLExtras.h | 60 ++++++++++++++--------------- llvm/include/llvm/ADT/STLFunctionalExtras.h | 12 +++--- llvm/include/llvm/ADT/Sequence.h | 34 +++++++++------- llvm/include/llvm/ADT/SmallVector.h | 27 ++++++------- llvm/include/llvm/ADT/StringRef.h | 2 +- llvm/include/llvm/ADT/TinyPtrVector.h | 7 ++-- llvm/include/llvm/ADT/bit.h | 11 +++--- llvm/include/llvm/ADT/iterator.h | 16 ++++---- 20 files changed, 134 insertions(+), 125 deletions(-) diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h index 80d9d21..f5eb9f3 100644 --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -757,7 +757,7 @@ class APFloat : public APFloatBase { typedef detail::IEEEFloat IEEEFloat; typedef detail::DoubleAPFloat DoubleAPFloat; - static_assert(std::is_standard_layout_v); + static_assert(std::is_standard_layout::value); union Storage { const fltSemantics *semantics; @@ -849,9 +849,9 @@ class APFloat : public APFloatBase { } U; template static bool usesLayout(const fltSemantics &Semantics) { - static_assert(std::is_same_v || - std::is_same_v); - if (std::is_same_v) { + static_assert(std::is_same::value || + std::is_same::value); + if (std::is_same::value) { return &Semantics == &PPCDoubleDouble(); } return &Semantics != &PPCDoubleDouble(); @@ -912,7 +912,7 @@ public: APFloat(const fltSemantics &Semantics, StringRef S); APFloat(const fltSemantics &Semantics, integerPart I) : U(Semantics, I) {} template >> + typename = std::enable_if_t::value>> APFloat(const fltSemantics &Semantics, T V) = delete; // TODO: Remove this constructor. This isn't faster than the first one. APFloat(const fltSemantics &Semantics, uninitializedTag) diff --git a/llvm/include/llvm/ADT/Any.h b/llvm/include/llvm/ADT/Any.h index 4231427..acb7101a 100644 --- a/llvm/include/llvm/ADT/Any.h +++ b/llvm/include/llvm/ADT/Any.h @@ -70,7 +70,7 @@ public: // instead. template , Any>>, // We also disable this overload when an `Any` object can be // converted to the parameter type because in that case, @@ -83,7 +83,7 @@ public: // adopting it to work-around usage of `Any` with types that // need to be implicitly convertible from an `Any`. std::negation>>, - std::is_copy_constructible>>, + std::is_copy_constructible>>::value, int> = 0> Any(T &&Value) { Storage = diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h index ebcf087..a25cf1c 100644 --- a/llvm/include/llvm/ADT/ArrayRef.h +++ b/llvm/include/llvm/ADT/ArrayRef.h @@ -122,8 +122,8 @@ namespace llvm { /// ensure that only ArrayRefs of pointers can be converted. template ArrayRef(const ArrayRef &A, - std::enable_if_t> * = - nullptr) + std::enable_if_t::value> + * = nullptr) : Data(A.data()), Length(A.size()) {} /// Construct an ArrayRef from a SmallVector. This is @@ -132,7 +132,7 @@ namespace llvm { template /*implicit*/ ArrayRef( const SmallVectorTemplateCommon &Vec, - std::enable_if_t> * = + std::enable_if_t::value> * = nullptr) : Data(Vec.data()), Length(Vec.size()) {} @@ -140,8 +140,8 @@ namespace llvm { /// to ensure that only vectors of pointers can be converted. template ArrayRef(const std::vector &Vec, - std::enable_if_t> * = - nullptr) + std::enable_if_t::value> + * = nullptr) : Data(Vec.data()), Length(Vec.size()) {} /// @} @@ -261,7 +261,7 @@ namespace llvm { /// The declaration here is extra complicated so that "arrayRef = {}" /// continues to select the move assignment operator. template - std::enable_if_t, ArrayRef> & + std::enable_if_t::value, ArrayRef> & operator=(U &&Temporary) = delete; /// Disallow accidental assignment from a temporary. @@ -269,7 +269,7 @@ namespace llvm { /// The declaration here is extra complicated so that "arrayRef = {}" /// continues to select the move assignment operator. template - std::enable_if_t, ArrayRef> & + std::enable_if_t::value, ArrayRef> & operator=(std::initializer_list) = delete; /// @} diff --git a/llvm/include/llvm/ADT/Bitfields.h b/llvm/include/llvm/ADT/Bitfields.h index 1fd9346..4064d71 100644 --- a/llvm/include/llvm/ADT/Bitfields.h +++ b/llvm/include/llvm/ADT/Bitfields.h @@ -117,9 +117,9 @@ template struct BitPatterns { /// type so it can be packed and unpacked into a `bits` sized integer, /// `Compressor` is specialized on signed-ness so no runtime cost is incurred. /// The `pack` method also checks that the passed in `UserValue` is valid. -template > +template ::value> struct Compressor { - static_assert(std::is_unsigned_v, "T must be unsigned"); + static_assert(std::is_unsigned::value, "T must be unsigned"); using BP = BitPatterns; static T pack(T UserValue, T UserMaxValue) { @@ -132,7 +132,7 @@ struct Compressor { }; template struct Compressor { - static_assert(std::is_signed_v, "T must be signed"); + static_assert(std::is_signed::value, "T must be signed"); using BP = BitPatterns; static T pack(T UserValue, T UserMaxValue) { @@ -154,7 +154,8 @@ template struct Compressor { /// Impl is where Bifield description and Storage are put together to interact /// with values. template struct Impl { - static_assert(std::is_unsigned_v, "Storage must be unsigned"); + static_assert(std::is_unsigned::value, + "Storage must be unsigned"); using IntegerType = typename Bitfield::IntegerType; using C = Compressor; using BP = BitPatterns; @@ -192,7 +193,8 @@ template struct Impl { /// consistent semantics, this excludes typed enums and `bool` that are replaced /// with their unsigned counterparts. The correct type is restored in the public /// API. -template > struct ResolveUnderlyingType { +template ::value> +struct ResolveUnderlyingType { using type = std::underlying_type_t; }; template struct ResolveUnderlyingType { @@ -215,7 +217,7 @@ struct Bitfield { /// \tparam Size The size of the field. /// \tparam MaxValue For enums the maximum enum allowed. template + T MaxValue = std::is_enum::value ? T(0) // coupled with static_assert below : std::numeric_limits::max()> struct Element { @@ -234,11 +236,12 @@ struct Bitfield { static_assert(Bits > 0, "Bits must be non zero"); static constexpr size_t TypeBits = sizeof(IntegerType) * CHAR_BIT; static_assert(Bits <= TypeBits, "Bits may not be greater than T size"); - static_assert(!std::is_enum_v || MaxValue != T(0), + static_assert(!std::is_enum::value || MaxValue != T(0), "Enum Bitfields must provide a MaxValue"); - static_assert(!std::is_enum_v || std::is_unsigned_v, + static_assert(!std::is_enum::value || + std::is_unsigned::value, "Enum must be unsigned"); - static_assert(std::is_integral_v && + static_assert(std::is_integral::value && std::numeric_limits::is_integer, "IntegerType must be an integer type"); diff --git a/llvm/include/llvm/ADT/CoalescingBitVector.h b/llvm/include/llvm/ADT/CoalescingBitVector.h index 54fd156..4940bc1 100644 --- a/llvm/include/llvm/ADT/CoalescingBitVector.h +++ b/llvm/include/llvm/ADT/CoalescingBitVector.h @@ -36,7 +36,7 @@ namespace llvm { /// /// \tparam IndexT - The type of the index into the bitvector. template class CoalescingBitVector { - static_assert(std::is_unsigned_v, + static_assert(std::is_unsigned::value, "Index must be an unsigned integer."); using ThisT = CoalescingBitVector; diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h index 87c82b0..8a680c0 100644 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -464,7 +464,7 @@ protected: } static const KeyT getEmptyKey() { - static_assert(std::is_base_of_v, + static_assert(std::is_base_of::value, "Must pass the derived type to this template!"); return KeyInfoT::getEmptyKey(); } diff --git a/llvm/include/llvm/ADT/FoldingSet.h b/llvm/include/llvm/ADT/FoldingSet.h index 0ce6643..2376689 100644 --- a/llvm/include/llvm/ADT/FoldingSet.h +++ b/llvm/include/llvm/ADT/FoldingSet.h @@ -830,7 +830,7 @@ struct FoldingSetTrait> { }; template -struct FoldingSetTrait>> { +struct FoldingSetTrait::value>> { static void Profile(const T &X, FoldingSetNodeID &ID) { ID.AddInteger(static_cast>(X)); } diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h index 9eda865..8f04277 100644 --- a/llvm/include/llvm/ADT/FunctionExtras.h +++ b/llvm/include/llvm/ADT/FunctionExtras.h @@ -60,20 +60,21 @@ namespace detail { template using EnableIfTrivial = std::enable_if_t::value && - std::is_trivially_destructible_v>; + std::is_trivially_destructible::value>; template using EnableUnlessSameType = - std::enable_if_t, ThisT>>; + std::enable_if_t, ThisT>::value>; template -using EnableIfCallable = std::enable_if_t, std::is_same()(std::declval()...)), Ret>, std::is_same()( std::declval()...)), Ret>, - std::is_convertible< - decltype(std::declval()(std::declval()...)), Ret>>>; + std::is_convertible()( + std::declval()...)), + Ret>>::value>; template class UniqueFunctionBase { protected: @@ -96,7 +97,7 @@ protected: // It doesn't have to be exact though, and in one way it is more strict // because we want to still be able to observe either moves *or* copies. template struct AdjustedParamTBase { - static_assert(!std::is_reference_v, + static_assert(!std::is_reference::value, "references should be handled by template specialization"); using type = std::conditional_t< llvm::is_trivially_copy_constructible::value && diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h index dc03a11..ef98310 100644 --- a/llvm/include/llvm/ADT/Hashing.h +++ b/llvm/include/llvm/ADT/Hashing.h @@ -355,12 +355,10 @@ 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_v)&&64 % - sizeof(T) == - 0)> {}; +template struct is_hashable_data + : std::integral_constant::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 diff --git a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h index 40abf0a..e41eb06 100644 --- a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h +++ b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -177,13 +177,13 @@ public: IntrusiveRefCntPtr(IntrusiveRefCntPtr &&S) : Obj(S.Obj) { S.Obj = nullptr; } template , bool> = true> + std::enable_if_t::value, bool> = true> IntrusiveRefCntPtr(IntrusiveRefCntPtr S) : Obj(S.get()) { S.Obj = nullptr; } template , bool> = true> + std::enable_if_t::value, bool> = true> IntrusiveRefCntPtr(std::unique_ptr S) : Obj(S.release()) { retain(); } diff --git a/llvm/include/llvm/ADT/PointerIntPair.h b/llvm/include/llvm/ADT/PointerIntPair.h index 5b6cd3e..f73f5bc 100644 --- a/llvm/include/llvm/ADT/PointerIntPair.h +++ b/llvm/include/llvm/ADT/PointerIntPair.h @@ -30,9 +30,9 @@ template struct PunnedPointer { // Asserts that allow us to let the compiler implement the destructor and // copy/move constructors - static_assert(std::is_trivially_destructible_v, ""); - static_assert(std::is_trivially_copy_constructible_v, ""); - static_assert(std::is_trivially_move_constructible_v, ""); + static_assert(std::is_trivially_destructible::value, ""); + static_assert(std::is_trivially_copy_constructible::value, ""); + static_assert(std::is_trivially_move_constructible::value, ""); explicit constexpr PunnedPointer(intptr_t i = 0) { *this = i; } diff --git a/llvm/include/llvm/ADT/PriorityWorklist.h b/llvm/include/llvm/ADT/PriorityWorklist.h index 7c76744..2b6510f 100644 --- a/llvm/include/llvm/ADT/PriorityWorklist.h +++ b/llvm/include/llvm/ADT/PriorityWorklist.h @@ -109,7 +109,7 @@ public: /// Insert a sequence of new elements into the PriorityWorklist. template - std::enable_if_t> + std::enable_if_t::value> insert(SequenceT &&Input) { if (std::begin(Input) == std::end(Input)) // Nothing to do for an empty input sequence. diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index f683a21..6475ac7 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -166,7 +166,7 @@ using is_detected = typename detail::detector::value_t; /// * To access the number of arguments: Traits::num_args /// * To access the type of an argument: Traits::arg_t /// * To access the type of the result: Traits::result_t -template > +template ::value> struct function_traits : public function_traits {}; /// Overload for class function types. @@ -265,9 +265,9 @@ using TypeAtIndex = std::tuple_element_t>; /// Helper which adds two underlying types of enumeration type. /// Implicit conversion to a common type is accepted. template , + typename UT1 = std::enable_if_t::value, std::underlying_type_t>, - typename UT2 = std::enable_if_t, + typename UT2 = std::enable_if_t::value, std::underlying_type_t>> constexpr auto addEnumValues(EnumTy1 LHS, EnumTy2 RHS) { return static_cast(LHS) + static_cast(RHS); @@ -638,9 +638,9 @@ template <> struct fwd_or_bidi_tag_impl { /// of \p IterT does not derive from bidirectional_iterator_tag, and to /// bidirectional_iterator_tag otherwise. template struct fwd_or_bidi_tag { - using type = typename fwd_or_bidi_tag_impl::iterator_category>>::type; + typename std::iterator_traits::iterator_category>::value>::type; }; } // namespace detail @@ -1421,9 +1421,8 @@ public: } /// Allow conversion to any type accepting an iterator_range. - template >>> + template >::value>> operator RangeT() const { return RangeT(iterator_range(*this)); } @@ -1501,7 +1500,7 @@ namespace detail { /// always be a reference, to avoid returning a reference to a temporary. template class first_or_second_type { public: - using type = std::conditional_t, FirstTy, + using type = std::conditional_t::value, FirstTy, std::remove_reference_t>; }; } // end namespace detail @@ -1775,13 +1774,12 @@ inline void sort(Container &&C, Compare Comp) { /// Get the size of a range. This is a wrapper function around std::distance /// which is only enabled when the operation is O(1). template -auto size( - R &&Range, - std::enable_if_t< - std::is_base_of_v::iterator_category>, - void> * = nullptr) { +auto size(R &&Range, + std::enable_if_t< + std::is_base_of::iterator_category>::value, + void> * = nullptr) { return std::distance(Range.begin(), Range.end()); } @@ -2169,11 +2167,11 @@ void replace(Container &Cont, typename Container::iterator ContIt, /// [&](StringRef name) { os << name; }, /// [&] { os << ", "; }); /// \endcode -template < - typename ForwardIterator, typename UnaryFunctor, typename NullaryFunctor, - typename = - std::enable_if_t && - !std::is_constructible_v>> +template ::value && + !std::is_constructible::value>> inline void interleave(ForwardIterator begin, ForwardIterator end, UnaryFunctor each_fn, NullaryFunctor between_fn) { if (begin == end) @@ -2188,8 +2186,8 @@ inline void interleave(ForwardIterator begin, ForwardIterator end, template && - !std::is_constructible_v>> + !std::is_constructible::value && + !std::is_constructible::value>> inline void interleave(const Container &c, UnaryFunctor each_fn, NullaryFunctor between_fn) { interleave(c.begin(), c.end(), each_fn, between_fn); @@ -2492,11 +2490,11 @@ bool hasNItems( IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted = [](const decltype(*std::declval()) &) { return true; }, - std::enable_if_t>::iterator_category>, - void> * = nullptr) { + decltype(Begin)>>::iterator_category>::value, + void> * = nullptr) { for (; N; ++Begin) { if (Begin == End) return false; // Too few. @@ -2517,11 +2515,11 @@ bool hasNItemsOrMore( IterTy &&Begin, IterTy &&End, unsigned N, Pred &&ShouldBeCounted = [](const decltype(*std::declval()) &) { return true; }, - std::enable_if_t>::iterator_category>, - void> * = nullptr) { + decltype(Begin)>>::iterator_category>::value, + void> * = nullptr) { for (; N; ++Begin) { if (Begin == End) return false; // Too few. diff --git a/llvm/include/llvm/ADT/STLFunctionalExtras.h b/llvm/include/llvm/ADT/STLFunctionalExtras.h index f3044fe..dd7fc6d 100644 --- a/llvm/include/llvm/ADT/STLFunctionalExtras.h +++ b/llvm/include/llvm/ADT/STLFunctionalExtras.h @@ -54,13 +54,13 @@ public: function_ref( Callable &&callable, // This is not the copy-constructor. - std::enable_if_t, function_ref>> - * = nullptr, + std::enable_if_t, + function_ref>::value> * = nullptr, // Functor must be callable and return a suitable type. - std::enable_if_t || - std::is_convertible_v()( - std::declval()...)), - Ret>> * = nullptr) + std::enable_if_t::value || + std::is_convertible()( + std::declval()...)), + Ret>::value> * = nullptr) : callback(callback_fn>), callable(reinterpret_cast(&callable)) {} diff --git a/llvm/include/llvm/ADT/Sequence.h b/llvm/include/llvm/ADT/Sequence.h index 9a63552..ddda9a9 100644 --- a/llvm/include/llvm/ADT/Sequence.h +++ b/llvm/include/llvm/ADT/Sequence.h @@ -126,7 +126,7 @@ template bool canTypeFitValue(const U Value) { struct CheckedInt { // Integral constructor, asserts if Value cannot be represented as intmax_t. template , bool> = 0> + std::enable_if_t::value, bool> = 0> static CheckedInt from(Integral FromValue) { if (!canTypeFitValue(FromValue)) assertOutOfBounds(); @@ -136,7 +136,8 @@ struct CheckedInt { } // Enum constructor, asserts if Value cannot be represented as intmax_t. - template , bool> = 0> + template ::value, bool> = 0> static CheckedInt from(Enum FromValue) { using type = std::underlying_type_t; return from(static_cast(FromValue)); @@ -162,7 +163,7 @@ struct CheckedInt { // Convert to integral, asserts if Value cannot be represented as Integral. template , bool> = 0> + std::enable_if_t::value, bool> = 0> Integral to() const { if (!canTypeFitValue(Value)) assertOutOfBounds(); @@ -171,7 +172,8 @@ struct CheckedInt { // Convert to enum, asserts if Value cannot be represented as Enum's // underlying type. - template , bool> = 0> + template ::value, bool> = 0> Enum to() const { using type = std::underlying_type_t; return Enum(to()); @@ -285,9 +287,9 @@ template struct iota_range { auto rend() const { return const_reverse_iterator(BeginValue - 1); } private: - static_assert(std::is_integral_v || std::is_enum_v, + static_assert(std::is_integral::value || std::is_enum::value, "T must be an integral or enum type"); - static_assert(std::is_same_v>, + static_assert(std::is_same>::value, "T must not be const nor volatile"); iterator BeginValue; @@ -298,8 +300,8 @@ private: /// Note: Begin and End values have to be within [INTMAX_MIN, INTMAX_MAX] for /// forward iteration (resp. [INTMAX_MIN + 1, INTMAX_MAX] for reverse /// iteration). -template && - !std::is_enum_v>> +template ::value && + !std::is_enum::value>> auto seq(T Begin, T End) { return iota_range(Begin, End, false); } @@ -308,8 +310,8 @@ auto seq(T Begin, T End) { /// Note: Begin and End values have to be within [INTMAX_MIN, INTMAX_MAX - 1] /// for forward iteration (resp. [INTMAX_MIN + 1, INTMAX_MAX - 1] for reverse /// iteration). -template && - !std::is_enum_v>> +template ::value && + !std::is_enum::value>> auto seq_inclusive(T Begin, T End) { return iota_range(Begin, End, true); } @@ -320,7 +322,8 @@ auto seq_inclusive(T Begin, T End) { /// Note: Begin and End values have to be within [INTMAX_MIN, INTMAX_MAX] for /// forward iteration (resp. [INTMAX_MIN + 1, INTMAX_MAX] for reverse /// iteration). -template >> +template ::value>> auto enum_seq(EnumT Begin, EnumT End) { static_assert(enum_iteration_traits::is_iterable, "Enum type is not marked as iterable."); @@ -334,7 +337,8 @@ auto enum_seq(EnumT Begin, EnumT End) { /// Note: Begin and End values have to be within [INTMAX_MIN, INTMAX_MAX] for /// forward iteration (resp. [INTMAX_MIN + 1, INTMAX_MAX] for reverse /// iteration). -template >> +template ::value>> auto enum_seq(EnumT Begin, EnumT End, force_iteration_on_noniterable_enum_t) { return iota_range(Begin, End, false); } @@ -345,7 +349,8 @@ auto enum_seq(EnumT Begin, EnumT End, force_iteration_on_noniterable_enum_t) { /// Note: Begin and End values have to be within [INTMAX_MIN, INTMAX_MAX - 1] /// for forward iteration (resp. [INTMAX_MIN + 1, INTMAX_MAX - 1] for reverse /// iteration). -template >> +template ::value>> auto enum_seq_inclusive(EnumT Begin, EnumT End) { static_assert(enum_iteration_traits::is_iterable, "Enum type is not marked as iterable."); @@ -359,7 +364,8 @@ auto enum_seq_inclusive(EnumT Begin, EnumT End) { /// Note: Begin and End values have to be within [INTMAX_MIN, INTMAX_MAX - 1] /// for forward iteration (resp. [INTMAX_MIN + 1, INTMAX_MAX - 1] for reverse /// iteration). -template >> +template ::value>> auto enum_seq_inclusive(EnumT Begin, EnumT End, force_iteration_on_noniterable_enum_t) { return iota_range(Begin, End, true); diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index 31ab184..93d9491 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -37,10 +37,9 @@ template class ArrayRef; template class iterator_range; template -using EnableIfConvertibleToInputIterator = - std::enable_if_t::iterator_category, - std::input_iterator_tag>>; +using EnableIfConvertibleToInputIterator = std::enable_if_t::iterator_category, + std::input_iterator_tag>::value>; /// This is all the stuff common to all SmallVectors. /// @@ -208,9 +207,10 @@ protected: this->assertSafeToReferenceAfterResize(From, 0); this->assertSafeToReferenceAfterResize(To - 1, 0); } - template , T *>, - bool> = false> + template < + class ItTy, + std::enable_if_t, T *>::value, + bool> = false> void assertSafeToReferenceAfterClear(ItTy, ItTy) {} /// Check whether any part of the range will be invalidated by growing. @@ -220,9 +220,10 @@ protected: this->assertSafeToAdd(From, To - From); this->assertSafeToAdd(To - 1, To - From); } - template , T *>, - bool> = false> + template < + class ItTy, + std::enable_if_t, T *>::value, + bool> = false> void assertSafeToAddRange(ItTy, ItTy) {} /// Reserve enough space to add one element, and return the updated element @@ -327,7 +328,7 @@ public: /// trivially assignable. template ::value) && (is_trivially_move_constructible::value) && - std::is_trivially_destructible_v> + std::is_trivially_destructible::value> class SmallVectorTemplateBase : public SmallVectorTemplateCommon { friend class SmallVectorTemplateCommon; @@ -513,7 +514,7 @@ protected: template static void uninitialized_copy( T1 *I, T1 *E, T2 *Dest, - std::enable_if_t, T2>> * = + std::enable_if_t, T2>::value> * = nullptr) { // Use memcpy for PODs iterated by pointers (which includes SmallVector // iterators): std::uninitialized_copy optimizes to memmove, but we can @@ -1231,7 +1232,7 @@ public: } template >> + typename = std::enable_if_t::value>> explicit SmallVector(ArrayRef A) : SmallVectorImpl(N) { this->append(A.begin(), A.end()); } diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index f672784..868722e 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/include/llvm/ADT/StringRef.h @@ -238,7 +238,7 @@ namespace llvm { /// The declaration here is extra complicated so that `stringRef = {}` /// and `stringRef = "abc"` continue to select the move assignment operator. template - std::enable_if_t, StringRef> & + std::enable_if_t::value, StringRef> & operator=(T &&Str) = delete; /// @} diff --git a/llvm/include/llvm/ADT/TinyPtrVector.h b/llvm/include/llvm/ADT/TinyPtrVector.h index 2caa564..aa87fd6 100644 --- a/llvm/include/llvm/ADT/TinyPtrVector.h +++ b/llvm/include/llvm/ADT/TinyPtrVector.h @@ -151,9 +151,10 @@ public: } // Implicit conversion to ArrayRef if EltTy* implicitly converts to U*. - template , ArrayRef>, - bool> = false> + template < + typename U, + std::enable_if_t, ArrayRef>::value, + bool> = false> operator ArrayRef() const { return operator ArrayRef(); } diff --git a/llvm/include/llvm/ADT/bit.h b/llvm/include/llvm/ADT/bit.h index e416e9e..2840c5f 100644 --- a/llvm/include/llvm/ADT/bit.h +++ b/llvm/include/llvm/ADT/bit.h @@ -44,11 +44,12 @@ namespace llvm { // This implementation of bit_cast is different from the C++20 one in two ways: // - It isn't constexpr because that requires compiler support. // - It requires trivially-constructible To, to avoid UB in the implementation. -template , - typename = std::enable_if_t>, - typename = std::enable_if_t>, - typename = std::enable_if_t>> +template < + typename To, typename From, + typename = std::enable_if_t, + typename = std::enable_if_t::value>, + typename = std::enable_if_t::value>, + typename = std::enable_if_t::value>> [[nodiscard]] inline To bit_cast(const From &from) noexcept { #if __has_builtin(__builtin_bit_cast) return __builtin_bit_cast(To, from); diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h index de826dd..6f0c42f 100644 --- a/llvm/include/llvm/ADT/iterator.h +++ b/llvm/include/llvm/ADT/iterator.h @@ -87,10 +87,10 @@ public: protected: enum { - IsRandomAccess = - std::is_base_of_v, - IsBidirectional = - std::is_base_of_v, + IsRandomAccess = std::is_base_of::value, + IsBidirectional = std::is_base_of::value, }; /// A proxy object for computing a reference via indirecting a copy of an @@ -225,12 +225,12 @@ template < typename DifferenceTypeT = typename std::iterator_traits::difference_type, typename PointerT = std::conditional_t< - std::is_same_v< - T, typename std::iterator_traits::value_type>, + std::is_same::value_type>::value, typename std::iterator_traits::pointer, T *>, typename ReferenceT = std::conditional_t< - std::is_same_v< - T, typename std::iterator_traits::value_type>, + std::is_same::value_type>::value, typename std::iterator_traits::reference, T &>> class iterator_adaptor_base : public iterator_facade_base