diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.h b/clang-tools-extra/clang-tidy/ClangTidyCheck.h --- a/clang-tools-extra/clang-tidy/ClangTidyCheck.h +++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.h @@ -133,8 +133,8 @@ /// ``CheckOptions``. If the corresponding key is not present, returns /// \p Default. template - typename std::enable_if::value, T>::type - get(StringRef LocalName, T Default) const { + std::enable_if_t::value, T> get(StringRef LocalName, + T Default) const { std::string Value = get(LocalName, ""); T Result = Default; if (!Value.empty()) @@ -150,7 +150,7 @@ /// present, falls back to get global option. If global option is not /// present either, returns Default. template - typename std::enable_if::value, T>::type + std::enable_if_t::value, T> getLocalOrGlobal(StringRef LocalName, T Default) const { std::string Value = getLocalOrGlobal(LocalName, ""); T Result = Default; diff --git a/clang-tools-extra/clangd/Shutdown.h b/clang-tools-extra/clangd/Shutdown.h --- a/clang-tools-extra/clangd/Shutdown.h +++ b/clang-tools-extra/clangd/Shutdown.h @@ -66,7 +66,7 @@ /// requested (which interrupts IO), we'll fail rather than retry. template ()())> Ret retryAfterSignalUnlessShutdown( - const typename std::enable_if::type &Fail, // Suppress deduction. + const std::enable_if_t &Fail, // Suppress deduction. const Fun &F) { Ret Res; do { diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h --- a/llvm/include/llvm/ADT/APFloat.h +++ b/llvm/include/llvm/ADT/APFloat.h @@ -853,8 +853,8 @@ APFloat(const fltSemantics &Semantics) : U(Semantics) {} APFloat(const fltSemantics &Semantics, StringRef S); APFloat(const fltSemantics &Semantics, integerPart I) : U(Semantics, I) {} - template ::value>::type> + template ::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/AllocatorList.h b/llvm/include/llvm/ADT/AllocatorList.h --- a/llvm/include/llvm/ADT/AllocatorList.h +++ b/llvm/include/llvm/ADT/AllocatorList.h @@ -110,8 +110,8 @@ template IteratorImpl(const IteratorImpl &X, - typename std::enable_if::value>::type * = nullptr) + std::enable_if_t::value> * = nullptr) : base_type(X.wrapped()) {} ~IteratorImpl() = default; diff --git a/llvm/include/llvm/ADT/Any.h b/llvm/include/llvm/ADT/Any.h --- a/llvm/include/llvm/ADT/Any.h +++ b/llvm/include/llvm/ADT/Any.h @@ -59,26 +59,26 @@ // When T is Any or T is not copy-constructible we need to explicitly disable // the forwarding constructor so that the copy constructor gets selected // instead. - template < - typename T, - typename std::enable_if< - llvm::conjunction< - llvm::negation::type, Any>>, - // We also disable this overload when an `Any` object can be - // converted to the parameter type because in that case, this - // constructor may combine with that conversion during overload - // resolution for determining copy constructibility, and then - // when we try to determine copy constructibility below we may - // infinitely recurse. This is being evaluated by the standards - // committee as a potential DR in `std::any` as well, but we're - // going ahead and adopting it to work-around usage of `Any` with - // types that need to be implicitly convertible from an `Any`. - llvm::negation::type>>, - std::is_copy_constructible::type>>::value, - int>::type = 0> + template , Any>>, + // We also disable this overload when an `Any` object can be + // converted to the parameter type because in that case, + // this constructor may combine with that conversion during + // overload resolution for determining copy + // constructibility, and then when we try to determine copy + // constructibility below we may infinitely recurse. This is + // being evaluated by the standards committee as a potential + // DR in `std::any` as well, but we're going ahead and + // adopting it to work-around usage of `Any` with types that + // need to be implicitly convertible from an `Any`. + llvm::negation>>, + std::is_copy_constructible>>::value, + int> = 0> Any(T &&Value) { - using U = typename std::decay::type; - Storage = std::make_unique>(std::forward(Value)); + Storage = + std::make_unique>>(std::forward(Value)); } Any(Any &&Other) : Storage(std::move(Other.Storage)) {} @@ -114,32 +114,27 @@ template bool any_isa(const Any &Value) { if (!Value.Storage) return false; - using U = - typename std::remove_cv::type>::type; - return Value.Storage->id() == &Any::TypeId::Id; + return Value.Storage->id() == + &Any::TypeId>>::Id; } template T any_cast(const Any &Value) { - using U = - typename std::remove_cv::type>::type; - return static_cast(*any_cast(&Value)); + return static_cast( + *any_cast>>(&Value)); } template T any_cast(Any &Value) { - using U = - typename std::remove_cv::type>::type; - return static_cast(*any_cast(&Value)); + return static_cast( + *any_cast>>(&Value)); } template T any_cast(Any &&Value) { - using U = - typename std::remove_cv::type>::type; - return static_cast(std::move(*any_cast(&Value))); + return static_cast(std::move( + *any_cast>>(&Value))); } template const T *any_cast(const Any *Value) { - using U = - typename std::remove_cv::type>::type; + using U = std::remove_cv_t>; assert(Value && any_isa(*Value) && "Bad any cast!"); if (!Value || !any_isa(*Value)) return nullptr; @@ -147,7 +142,7 @@ } template T *any_cast(Any *Value) { - using U = typename std::decay::type; + using U = std::decay_t; assert(Value && any_isa(*Value) && "Bad any cast!"); if (!Value || !any_isa(*Value)) return nullptr; diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h --- a/llvm/include/llvm/ADT/ArrayRef.h +++ b/llvm/include/llvm/ADT/ArrayRef.h @@ -114,30 +114,28 @@ /// Construct an ArrayRef from ArrayRef. This uses SFINAE to /// ensure that only ArrayRefs of pointers can be converted. template - ArrayRef( - const ArrayRef &A, - typename std::enable_if< - std::is_convertible::value>::type * = nullptr) - : Data(A.data()), Length(A.size()) {} + ArrayRef(const ArrayRef &A, + std::enable_if_t::value> + * = nullptr) + : Data(A.data()), Length(A.size()) {} /// Construct an ArrayRef from a SmallVector. This is /// templated in order to avoid instantiating SmallVectorTemplateCommon /// whenever we copy-construct an ArrayRef. - template + template /*implicit*/ ArrayRef( - const SmallVectorTemplateCommon &Vec, - typename std::enable_if< - std::is_convertible::value>::type * = nullptr) - : Data(Vec.data()), Length(Vec.size()) { - } + const SmallVectorTemplateCommon &Vec, + std::enable_if_t::value> * = + nullptr) + : Data(Vec.data()), Length(Vec.size()) {} /// Construct an ArrayRef from std::vector. This uses SFINAE /// to ensure that only vectors of pointers can be converted. - template + template ArrayRef(const std::vector &Vec, - typename std::enable_if< - std::is_convertible::value>::type* = 0) - : Data(Vec.data()), Length(Vec.size()) {} + std::enable_if_t::value> + * = 0) + : Data(Vec.data()), Length(Vec.size()) {} /// @} /// @name Simple Operations @@ -256,7 +254,7 @@ /// The declaration here is extra complicated so that "arrayRef = {}" /// continues to select the move assignment operator. template - typename std::enable_if::value, ArrayRef>::type & + std::enable_if_t::value, ArrayRef> & operator=(U &&Temporary) = delete; /// Disallow accidental assignment from a temporary. @@ -264,7 +262,7 @@ /// The declaration here is extra complicated so that "arrayRef = {}" /// continues to select the move assignment operator. template - typename std::enable_if::value, ArrayRef>::type & + std::enable_if_t::value, ArrayRef> & operator=(std::initializer_list) = delete; /// @} diff --git a/llvm/include/llvm/ADT/BitmaskEnum.h b/llvm/include/llvm/ADT/BitmaskEnum.h --- a/llvm/include/llvm/ADT/BitmaskEnum.h +++ b/llvm/include/llvm/ADT/BitmaskEnum.h @@ -71,49 +71,45 @@ template struct is_bitmask_enum< - E, typename std::enable_if= - 0>::type> : std::true_type {}; + E, std::enable_if_t= 0>> + : std::true_type {}; namespace BitmaskEnumDetail { /// Get a bitmask with 1s in all places up to the high-order bit of E's largest /// value. -template typename std::underlying_type::type Mask() { +template std::underlying_type_t Mask() { // On overflow, NextPowerOf2 returns zero with the type uint64_t, so // subtracting 1 gives us the mask with all bits set, like we want. - return NextPowerOf2(static_cast::type>( + return NextPowerOf2(static_cast>( E::LLVM_BITMASK_LARGEST_ENUMERATOR)) - 1; } /// Check that Val is in range for E, and return Val cast to E's underlying /// type. -template typename std::underlying_type::type Underlying(E Val) { - auto U = static_cast::type>(Val); +template std::underlying_type_t Underlying(E Val) { + auto U = static_cast>(Val); assert(U >= 0 && "Negative enum values are not allowed."); assert(U <= Mask() && "Enum value too large (or largest val too small?)"); return U; } -template ::value>::type> +template ::value>> E operator~(E Val) { return static_cast(~Underlying(Val) & Mask()); } -template ::value>::type> +template ::value>> E operator|(E LHS, E RHS) { return static_cast(Underlying(LHS) | Underlying(RHS)); } -template ::value>::type> +template ::value>> E operator&(E LHS, E RHS) { return static_cast(Underlying(LHS) & Underlying(RHS)); } -template ::value>::type> +template ::value>> E operator^(E LHS, E RHS) { return static_cast(Underlying(LHS) ^ Underlying(RHS)); } @@ -121,22 +117,19 @@ // |=, &=, and ^= return a reference to LHS, to match the behavior of the // operators on builtin types. -template ::value>::type> +template ::value>> E &operator|=(E &LHS, E RHS) { LHS = LHS | RHS; return LHS; } -template ::value>::type> +template ::value>> E &operator&=(E &LHS, E RHS) { LHS = LHS & RHS; return LHS; } -template ::value>::type> +template ::value>> E &operator^=(E &LHS, E RHS) { LHS = LHS ^ RHS; return LHS; diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -1194,7 +1194,7 @@ // for const iterator destinations so it doesn't end up as a user defined copy // constructor. template ::type> + typename = std::enable_if_t> DenseMapIterator( const DenseMapIterator &I) : DebugEpochBase::HandleBase(I), Ptr(I.Ptr), End(I.End) {} diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h --- a/llvm/include/llvm/ADT/Hashing.h +++ b/llvm/include/llvm/ADT/Hashing.h @@ -101,8 +101,7 @@ /// differing argument types even if they would implicit promote to a common /// type without changing the value. template -typename std::enable_if::value, hash_code>::type -hash_value(T value); +std::enable_if_t::value, hash_code> hash_value(T value); /// Compute a hash_code for a pointer's address. /// @@ -360,7 +359,7 @@ /// Helper to get the hashable data representation for a type. /// This variant is enabled when the type itself can be used. template -typename std::enable_if::value, T>::type +std::enable_if_t::value, T> get_hashable_data(const T &value) { return value; } @@ -368,7 +367,7 @@ /// This variant is enabled when we must first call hash_value and use the /// result as our data. template -typename std::enable_if::value, size_t>::type +std::enable_if_t::value, size_t> get_hashable_data(const T &value) { using ::llvm::hash_value; return hash_value(value); @@ -442,7 +441,7 @@ /// are stored in contiguous memory, this routine avoids copying each value /// and directly reads from the underlying memory. template -typename std::enable_if::value, hash_code>::type +std::enable_if_t::value, hash_code> hash_combine_range_impl(ValueT *first, ValueT *last) { const uint64_t seed = get_execution_seed(); const char *s_begin = reinterpret_cast(first); @@ -627,8 +626,7 @@ // Declared and documented above, but defined here so that any of the hashing // infrastructure is available. template -typename std::enable_if::value, hash_code>::type -hash_value(T value) { +std::enable_if_t::value, hash_code> hash_value(T value) { return ::llvm::hashing::detail::hash_integer_value( static_cast(value)); } diff --git a/llvm/include/llvm/ADT/PriorityWorklist.h b/llvm/include/llvm/ADT/PriorityWorklist.h --- a/llvm/include/llvm/ADT/PriorityWorklist.h +++ b/llvm/include/llvm/ADT/PriorityWorklist.h @@ -110,7 +110,7 @@ /// Insert a sequence of new elements into the PriorityWorklist. template - typename std::enable_if::value>::type + 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 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -115,9 +115,8 @@ template function_ref(Callable &&callable, - typename std::enable_if< - !std::is_same::type, - function_ref>::value>::type * = nullptr) + std::enable_if_t, + function_ref>::value> * = nullptr) : callback(callback_fn::type>), callable(reinterpret_cast(&callable)) {} @@ -254,9 +253,8 @@ // Returns an iterator_range over the given container which iterates in reverse. // Note that the container must have rbegin()/rend() methods for this to work. template -auto reverse( - ContainerTy &&C, - typename std::enable_if::value>::type * = nullptr) { +auto reverse(ContainerTy &&C, + std::enable_if_t::value> * = nullptr) { return make_range(C.rbegin(), C.rend()); } @@ -271,8 +269,7 @@ // bidirectional iterators for this to work. template auto reverse(ContainerTy &&C, - typename std::enable_if::value>::type * = - nullptr) { + std::enable_if_t::value> * = nullptr) { return make_range(llvm::make_reverse_iterator(std::end(C)), llvm::make_reverse_iterator(std::begin(C))); } @@ -1148,11 +1145,11 @@ /// 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, typename std::enable_if< - std::is_same::iterator_category, - std::random_access_iterator_tag>::value, - void>::type * = nullptr) { +auto size(R &&Range, + std::enable_if_t::iterator_category, + std::random_access_iterator_tag>::value, + void> * = nullptr) { return std::distance(Range.begin(), Range.end()); } @@ -1516,12 +1513,11 @@ template bool hasNItems( IterTy &&Begin, IterTy &&End, unsigned N, - typename std::enable_if< - !std::is_same< - typename std::iterator_traits::type>::iterator_category, - std::random_access_iterator_tag>::value, - void>::type * = nullptr) { + std::enable_if_t< + !std::is_same>::iterator_category, + std::random_access_iterator_tag>::value, + void> * = nullptr) { for (; N; --N, ++Begin) if (Begin == End) return false; // Too few. @@ -1533,12 +1529,11 @@ template bool hasNItemsOrMore( IterTy &&Begin, IterTy &&End, unsigned N, - typename std::enable_if< - !std::is_same< - typename std::iterator_traits::type>::iterator_category, - std::random_access_iterator_tag>::value, - void>::type * = nullptr) { + std::enable_if_t< + !std::is_same>::iterator_category, + std::random_access_iterator_tag>::value, + void> * = nullptr) { for (; N; --N, ++Begin) if (Begin == End) return false; // Too few. diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -284,8 +284,8 @@ template static void uninitialized_copy( T1 *I, T1 *E, T2 *Dest, - typename std::enable_if::type, - T2>::value>::type * = nullptr) { + std::enable_if_t::type, + T2>::value> * = nullptr) { // Use memcpy for PODs iterated by pointers (which includes SmallVector // iterators): std::uninitialized_copy optimizes to memmove, but we can // use memcpy here. Note that I and E are iterators and thus might be @@ -381,9 +381,9 @@ /// Add the specified range to the end of the SmallVector. template ::iterator_category, - std::input_iterator_tag>::value>::type> + std::input_iterator_tag>::value>> void append(in_iter in_start, in_iter in_end) { size_type NumInputs = std::distance(in_start, in_end); if (NumInputs > this->capacity() - this->size()) @@ -418,9 +418,9 @@ } template ::iterator_category, - std::input_iterator_tag>::value>::type> + std::input_iterator_tag>::value>> void assign(in_iter in_start, in_iter in_end) { clear(); append(in_start, in_end); @@ -575,9 +575,9 @@ } template ::iterator_category, - std::input_iterator_tag>::value>::type> + std::input_iterator_tag>::value>> iterator insert(iterator I, ItTy From, ItTy To) { // Convert iterator to elt# to avoid invalidating iterator when we reserve() size_t InsertElt = I - this->begin(); @@ -849,9 +849,9 @@ } template ::iterator_category, - std::input_iterator_tag>::value>::type> + std::input_iterator_tag>::value>> SmallVector(ItTy S, ItTy E) : SmallVectorImpl(N) { this->append(S, E); } diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/include/llvm/ADT/StringRef.h @@ -265,8 +265,7 @@ /// The declaration here is extra complicated so that `stringRef = {}` /// and `stringRef = "abc"` continue to select the move assignment operator. template - typename std::enable_if::value, - StringRef>::type & + std::enable_if_t::value, StringRef> & operator=(T &&Str) = delete; /// @} @@ -508,7 +507,7 @@ /// this returns true to signify the error. The string is considered /// erroneous if empty or if it overflows T. template - typename std::enable_if::is_signed, bool>::type + std::enable_if_t::is_signed, bool> getAsInteger(unsigned Radix, T &Result) const { long long LLVal; if (getAsSignedInteger(*this, Radix, LLVal) || @@ -519,7 +518,7 @@ } template - typename std::enable_if::is_signed, bool>::type + std::enable_if_t::is_signed, bool> getAsInteger(unsigned Radix, T &Result) const { unsigned long long ULLVal; // The additional cast to unsigned long long is required to avoid the @@ -542,7 +541,7 @@ /// The portion of the string representing the discovered numeric value /// is removed from the beginning of the string. template - typename std::enable_if::is_signed, bool>::type + std::enable_if_t::is_signed, bool> consumeInteger(unsigned Radix, T &Result) { long long LLVal; if (consumeSignedInteger(*this, Radix, LLVal) || @@ -553,7 +552,7 @@ } template - typename std::enable_if::is_signed, bool>::type + std::enable_if_t::is_signed, bool> consumeInteger(unsigned Radix, T &Result) { unsigned long long ULLVal; if (consumeUnsignedInteger(*this, Radix, ULLVal) || diff --git a/llvm/include/llvm/ADT/TinyPtrVector.h b/llvm/include/llvm/ADT/TinyPtrVector.h --- a/llvm/include/llvm/ADT/TinyPtrVector.h +++ b/llvm/include/llvm/ADT/TinyPtrVector.h @@ -152,10 +152,10 @@ } // Implicit conversion to ArrayRef if EltTy* implicitly converts to U*. - template, ArrayRef>::value, - bool>::type = 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/ilist_iterator.h b/llvm/include/llvm/ADT/ilist_iterator.h --- a/llvm/include/llvm/ADT/ilist_iterator.h +++ b/llvm/include/llvm/ADT/ilist_iterator.h @@ -88,15 +88,14 @@ // This is templated so that we can allow constructing a const iterator from // a nonconst iterator... template - ilist_iterator( - const ilist_iterator &RHS, - typename std::enable_if::type = nullptr) + ilist_iterator(const ilist_iterator &RHS, + std::enable_if_t = nullptr) : NodePtr(RHS.NodePtr) {} // This is templated so that we can allow assigning to a const iterator from // a nonconst iterator... template - typename std::enable_if::type + std::enable_if_t operator=(const ilist_iterator &RHS) { NodePtr = RHS.NodePtr; return *this; diff --git a/llvm/include/llvm/ADT/iterator.h b/llvm/include/llvm/ADT/iterator.h --- a/llvm/include/llvm/ADT/iterator.h +++ b/llvm/include/llvm/ADT/iterator.h @@ -194,14 +194,14 @@ typename T = typename std::iterator_traits::value_type, typename DifferenceTypeT = typename std::iterator_traits::difference_type, - typename PointerT = typename std::conditional< + typename PointerT = std::conditional_t< std::is_same::value_type>::value, - typename std::iterator_traits::pointer, T *>::type, - typename ReferenceT = typename std::conditional< + typename std::iterator_traits::pointer, T *>, + typename ReferenceT = std::conditional_t< std::is_same::value_type>::value, - typename std::iterator_traits::reference, T &>::type> + typename std::iterator_traits::reference, T &>> class iterator_adaptor_base : public iterator_facade_base { @@ -281,8 +281,8 @@ /// using iterator = pointee_iterator::iterator>; /// \endcode template ())>::type> + typename T = std::remove_reference_t())>> struct pointee_iterator : iterator_adaptor_base< pointee_iterator, WrappedIteratorT, @@ -334,9 +334,11 @@ } template ())>::type, - typename T2 = typename std::add_pointer::type> -using raw_pointer_iterator = pointer_iterator, T2>; + typename T1 = std::remove_reference_t())>, + typename T2 = std::add_pointer_t> +using raw_pointer_iterator = + pointer_iterator, T2>; // Wrapper iterator over iterator ItType, adding DataRef to the type of ItType, // to create NodeRef = std::pair. diff --git a/llvm/include/llvm/Analysis/RegionInfo.h b/llvm/include/llvm/Analysis/RegionInfo.h --- a/llvm/include/llvm/Analysis/RegionInfo.h +++ b/llvm/include/llvm/Analysis/RegionInfo.h @@ -574,10 +574,9 @@ template class block_iterator_wrapper : public df_iterator< - typename std::conditional::type *> { + std::conditional_t *> { using super = - df_iterator< - typename std::conditional::type *>; + df_iterator *>; public: using Self = block_iterator_wrapper; diff --git a/llvm/include/llvm/Analysis/RegionInfoImpl.h b/llvm/include/llvm/Analysis/RegionInfoImpl.h --- a/llvm/include/llvm/Analysis/RegionInfoImpl.h +++ b/llvm/include/llvm/Analysis/RegionInfoImpl.h @@ -724,7 +724,7 @@ template void RegionInfoBase::scanForRegions(FuncT &F, BBtoBBMap *ShortCut) { - using FuncPtrT = typename std::add_pointer::type; + using FuncPtrT = std::add_pointer_t; BlockT *entry = GraphTraits::getEntryNode(&F); DomTreeNodeT *N = DT->getNode(entry); @@ -912,7 +912,7 @@ template void RegionInfoBase::calculate(FuncT &F) { - using FuncPtrT = typename std::add_pointer::type; + using FuncPtrT = std::add_pointer_t; // ShortCut a function where for every BB the exit of the largest region // starting with BB is stored. These regions can be threated as single BBS. diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h --- a/llvm/include/llvm/BinaryFormat/Dwarf.h +++ b/llvm/include/llvm/BinaryFormat/Dwarf.h @@ -672,8 +672,7 @@ /// dumping functions above, these format unknown enumerator values as /// DW_TYPE_unknown_1234 (e.g. DW_TAG_unknown_ffff). template -struct format_provider< - Enum, typename std::enable_if::value>::type> { +struct format_provider::value>> { static void format(const Enum &E, raw_ostream &OS, StringRef Style) { StringRef Str = dwarf::EnumTraits::StringFn(E); if (Str.empty()) { diff --git a/llvm/include/llvm/CodeGen/LiveInterval.h b/llvm/include/llvm/CodeGen/LiveInterval.h --- a/llvm/include/llvm/CodeGen/LiveInterval.h +++ b/llvm/include/llvm/CodeGen/LiveInterval.h @@ -625,11 +625,12 @@ // if the Seg is lower find first segment that is above Idx using binary // search if (Seg->end <= *Idx) { - Seg = std::upper_bound(++Seg, EndSeg, *Idx, - [=](typename std::remove_reference::type V, - const typename std::remove_reference::type &S) { - return V < S.end; - }); + Seg = std::upper_bound( + ++Seg, EndSeg, *Idx, + [=](std::remove_reference_t V, + const std::remove_reference_t &S) { + return V < S.end; + }); if (Seg == EndSeg) break; } diff --git a/llvm/include/llvm/CodeGen/MachineInstrBundleIterator.h b/llvm/include/llvm/CodeGen/MachineInstrBundleIterator.h --- a/llvm/include/llvm/CodeGen/MachineInstrBundleIterator.h +++ b/llvm/include/llvm/CodeGen/MachineInstrBundleIterator.h @@ -152,8 +152,8 @@ template MachineInstrBundleIterator( const MachineInstrBundleIterator &I, - typename std::enable_if::value, - void *>::type = nullptr) + std::enable_if_t::value, void *> = + nullptr) : MII(I.getInstrIterator()) {} MachineInstrBundleIterator() : MII(nullptr) {} diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h --- a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h +++ b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h @@ -114,7 +114,7 @@ if (!isStreaming() && sizeof(Value) > maxFieldLength()) return make_error(cv_error_code::insufficient_buffer); - using U = typename std::underlying_type::type; + using U = std::underlying_type_t; U X; if (isWriting() || isStreaming()) diff --git a/llvm/include/llvm/ExecutionEngine/JITSymbol.h b/llvm/include/llvm/ExecutionEngine/JITSymbol.h --- a/llvm/include/llvm/ExecutionEngine/JITSymbol.h +++ b/llvm/include/llvm/ExecutionEngine/JITSymbol.h @@ -58,10 +58,9 @@ /// Casts the given address to a callable function pointer. This operation /// will perform pointer signing for platforms that require it (e.g. arm64e). template T jitTargetAddressToFunction(JITTargetAddress Addr) { - static_assert( - std::is_pointer::value && - std::is_function::type>::value, - "T must be a function pointer type"); + static_assert(std::is_pointer::value && + std::is_function>::value, + "T must be a function pointer type"); return jitTargetAddressToPointer(Addr); } diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h --- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -202,10 +202,10 @@ /// If Body returns true then the element just passed in is removed from the /// set. If Body returns false then the element is retained. template - auto forEachWithRemoval(BodyFn &&Body) -> typename std::enable_if< + auto forEachWithRemoval(BodyFn &&Body) -> std::enable_if_t< std::is_same(), std::declval())), - bool>::value>::type { + bool>::value> { UnderlyingVector::size_type I = 0; while (I != Symbols.size()) { const auto &Name = Symbols[I].first; @@ -224,11 +224,11 @@ /// returns true then the element just passed in is removed from the set. If /// Body returns false then the element is retained. template - auto forEachWithRemoval(BodyFn &&Body) -> typename std::enable_if< + auto forEachWithRemoval(BodyFn &&Body) -> std::enable_if_t< std::is_same(), std::declval())), Expected>::value, - Error>::type { + Error> { UnderlyingVector::size_type I = 0; while (I != Symbols.size()) { const auto &Name = Symbols[I].first; diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h b/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h --- a/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h @@ -73,17 +73,13 @@ /// function objects. template std::unique_ptr::type>::type, - typename std::remove_cv< - typename std::remove_reference::type>::type>> + std::remove_cv_t>, + std::remove_cv_t>>> createSymbolResolver(GetResponsibilitySetFn &&GetResponsibilitySet, LookupFn &&Lookup) { using LambdaSymbolResolverImpl = LambdaSymbolResolver< - typename std::remove_cv< - typename std::remove_reference::type>::type, - typename std::remove_cv< - typename std::remove_reference::type>::type>; + std::remove_cv_t>, + std::remove_cv_t>>; return std::make_unique( std::forward(GetResponsibilitySet), std::forward(Lookup)); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h --- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h @@ -108,8 +108,7 @@ template class SerializationTraits< ChannelT, remote::DirectBufferWriter, remote::DirectBufferWriter, - typename std::enable_if< - std::is_base_of::value>::type> { + std::enable_if_t::value>> { public: static Error serialize(ChannelT &C, const remote::DirectBufferWriter &DBW) { if (auto EC = serializeSeq(C, DBW.getDst())) diff --git a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h --- a/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h @@ -60,7 +60,7 @@ SymbolLookup(std::move(SymbolLookup)), EHFramesRegister(std::move(EHFramesRegister)), EHFramesDeregister(std::move(EHFramesDeregister)) { - using ThisT = typename std::remove_reference::type; + using ThisT = std::remove_reference_t; addHandler(*this, &ThisT::handleCallIntVoid); addHandler(*this, &ThisT::handleCallMain); addHandler(*this, &ThisT::handleCallVoidVoid); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h --- a/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCSerialization.h @@ -230,9 +230,9 @@ /// /// template /// class SerializationTraits::value -/// >::type> { +/// >> { /// public: /// static const char* getName() { ... }; /// } @@ -274,9 +274,8 @@ template static Error serialize(ChannelT &C, CArgT &&CArg) { - return SerializationTraits::type>:: - serialize(C, std::forward(CArg)); + return SerializationTraits>::serialize( + C, std::forward(CArg)); } template @@ -293,8 +292,8 @@ static Error serialize(ChannelT &C, CArgT &&CArg, CArgTs &&... CArgs) { if (auto Err = - SerializationTraits::type>:: - serialize(C, std::forward(CArg))) + SerializationTraits>::serialize( + C, std::forward(CArg))) return Err; if (auto Err = SequenceTraits::emitSeparator(C)) return Err; @@ -316,8 +315,8 @@ template Error serializeSeq(ChannelT &C, ArgTs &&... Args) { - return SequenceSerialization::type...>:: - serialize(C, std::forward(Args)...); + return SequenceSerialization...>::serialize( + C, std::forward(Args)...); } template diff --git a/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h --- a/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h @@ -184,8 +184,7 @@ /// This specialization of RPCFunctionIdAllocator provides a default /// implementation for integral types. template -class RPCFunctionIdAllocator< - T, typename std::enable_if::value>::type> { +class RPCFunctionIdAllocator::value>> { public: static T getInvalidId() { return T(0); } static T getResponseId() { return T(1); } @@ -205,8 +204,7 @@ template class FunctionArgsTuple { public: - using Type = std::tuple::type>::type...>; + using Type = std::tuple>...>; }; // ResultTraits provides typedefs and utilities specific to the return type @@ -483,9 +481,9 @@ }; template -class AsyncHandlerTraits : - public AsyncHandlerTraits::type, - ArgTs...)> {}; +class AsyncHandlerTraits + : public AsyncHandlerTraits, + ArgTs...)> {}; // This template class provides utilities related to RPC function handlers. // The base case applies to non-function types (the template class is @@ -524,18 +522,17 @@ // Call the given handler with the given arguments. template - static typename std::enable_if< - std::is_void::ReturnType>::value, - Error>::type + static std::enable_if_t< + std::is_void::ReturnType>::value, Error> run(HandlerT &Handler, ArgTs &&... Args) { Handler(std::move(Args)...); return Error::success(); } template - static typename std::enable_if< + static std::enable_if_t< !std::is_void::ReturnType>::value, - typename HandlerTraits::ReturnType>::type + typename HandlerTraits::ReturnType> run(HandlerT &Handler, TArgTs... Args) { return Handler(std::move(Args)...); } @@ -894,12 +891,12 @@ using S = SerializationTraits; template - static std::true_type - check(typename std::enable_if< - std::is_same(), - std::declval())), - Error>::value, - void *>::type); + static std::true_type check( + std::enable_if_t(), + std::declval())), + Error>::value, + void *>); template static std::false_type check(...); @@ -914,11 +911,11 @@ template static std::true_type - check(typename std::enable_if< - std::is_same(), - std::declval())), - Error>::value, - void *>::type); + check(std::enable_if_t< + std::is_same(), + std::declval())), + Error>::value, + void *>); template static std::false_type check(...); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h --- a/llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/RPC/RawByteChannel.h @@ -87,13 +87,13 @@ template class SerializationTraits< ChannelT, T, T, - typename std::enable_if< + std::enable_if_t< std::is_base_of::value && (std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || - std::is_same::value)>::type> { + std::is_same::value)>> { public: static Error serialize(ChannelT &C, T V) { support::endian::byte_swap(V); @@ -109,9 +109,9 @@ }; template -class SerializationTraits::value>::type> { +class SerializationTraits< + ChannelT, bool, bool, + std::enable_if_t::value>> { public: static Error serialize(ChannelT &C, bool V) { uint8_t Tmp = V ? 1 : 0; @@ -131,9 +131,9 @@ }; template -class SerializationTraits::value>::type> { +class SerializationTraits< + ChannelT, std::string, StringRef, + std::enable_if_t::value>> { public: /// RPC channel serialization for std::strings. static Error serialize(RawByteChannel &C, StringRef S) { @@ -144,11 +144,11 @@ }; template -class SerializationTraits::value && - (std::is_same::value || - std::is_same::value)>::type> { +class SerializationTraits< + ChannelT, std::string, T, + std::enable_if_t::value && + (std::is_same::value || + std::is_same::value)>> { public: static Error serialize(RawByteChannel &C, const char *S) { return SerializationTraits::serialize(C, @@ -157,9 +157,9 @@ }; template -class SerializationTraits::value>::type> { +class SerializationTraits< + ChannelT, std::string, std::string, + std::enable_if_t::value>> { public: /// RPC channel serialization for std::strings. static Error serialize(RawByteChannel &C, const std::string &S) { diff --git a/llvm/include/llvm/FuzzMutate/Random.h b/llvm/include/llvm/FuzzMutate/Random.h --- a/llvm/include/llvm/FuzzMutate/Random.h +++ b/llvm/include/llvm/FuzzMutate/Random.h @@ -32,7 +32,7 @@ /// elements, which may each be weighted to be more likely choices. template class ReservoirSampler { GenT &RandGen; - typename std::remove_const::type Selection = {}; + std::remove_const_t Selection = {}; uint64_t TotalWeight = 0; public: @@ -70,8 +70,8 @@ }; template ()))>::type> + typename ElT = std::remove_reference_t< + decltype(*std::begin(std::declval()))>> ReservoirSampler makeSampler(GenT &RandGen, RangeT &&Items) { ReservoirSampler RS(RandGen); RS.sample(Items); diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h --- a/llvm/include/llvm/IR/Constants.h +++ b/llvm/include/llvm/IR/Constants.h @@ -460,8 +460,7 @@ static Constant *get(StructType *T, ArrayRef V); template - static typename std::enable_if::value, - Constant *>::type + static std::enable_if_t::value, Constant *> get(StructType *T, Csts *... Vs) { SmallVector Values({Vs...}); return get(T, Values); diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h --- a/llvm/include/llvm/IR/DerivedTypes.h +++ b/llvm/include/llvm/IR/DerivedTypes.h @@ -267,8 +267,7 @@ StringRef Name, bool isPacked = false); static StructType *create(LLVMContext &Context, ArrayRef Elements); template - static typename std::enable_if::value, - StructType *>::type + static std::enable_if_t::value, StructType *> create(StringRef Name, Type *elt1, Tys *... elts) { assert(elt1 && "Cannot create a struct type with no elements with this"); SmallVector StructFields({elt1, elts...}); @@ -286,8 +285,7 @@ /// specifying the elements as arguments. Note that this method always returns /// a non-packed struct, and requires at least one element type. template - static typename std::enable_if::value, - StructType *>::type + static std::enable_if_t::value, StructType *> get(Type *elt1, Tys *... elts) { assert(elt1 && "Cannot create a struct type with no elements with this"); LLVMContext &Ctx = elt1->getContext(); @@ -324,7 +322,7 @@ void setBody(ArrayRef Elements, bool isPacked = false); template - typename std::enable_if::value, void>::type + std::enable_if_t::value, void> setBody(Type *elt1, Tys *... elts) { assert(elt1 && "Cannot create a struct type with no elements with this"); SmallVector StructFields({elt1, elts...}); diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h --- a/llvm/include/llvm/IR/DiagnosticInfo.h +++ b/llvm/include/llvm/IR/DiagnosticInfo.h @@ -531,9 +531,10 @@ template RemarkT & operator<<(RemarkT &R, - typename std::enable_if< + std::enable_if_t< std::is_base_of::value, - StringRef>::type S) { + StringRef> + S) { R.insert(S); return R; } @@ -543,9 +544,10 @@ template RemarkT & operator<<(RemarkT &&R, - typename std::enable_if< + std::enable_if_t< std::is_base_of::value, - StringRef>::type S) { + StringRef> + S) { R.insert(S); return R; } @@ -553,9 +555,10 @@ template RemarkT & operator<<(RemarkT &R, - typename std::enable_if< + std::enable_if_t< std::is_base_of::value, - DiagnosticInfoOptimizationBase::Argument>::type A) { + DiagnosticInfoOptimizationBase::Argument> + A) { R.insert(A); return R; } @@ -563,9 +566,10 @@ template RemarkT & operator<<(RemarkT &&R, - typename std::enable_if< + std::enable_if_t< std::is_base_of::value, - DiagnosticInfoOptimizationBase::Argument>::type A) { + DiagnosticInfoOptimizationBase::Argument> + A) { R.insert(A); return R; } @@ -573,9 +577,10 @@ template RemarkT & operator<<(RemarkT &R, - typename std::enable_if< + std::enable_if_t< std::is_base_of::value, - DiagnosticInfoOptimizationBase::setIsVerbose>::type V) { + DiagnosticInfoOptimizationBase::setIsVerbose> + V) { R.insert(V); return R; } @@ -583,9 +588,10 @@ template RemarkT & operator<<(RemarkT &&R, - typename std::enable_if< + std::enable_if_t< std::is_base_of::value, - DiagnosticInfoOptimizationBase::setIsVerbose>::type V) { + DiagnosticInfoOptimizationBase::setIsVerbose> + V) { R.insert(V); return R; } @@ -593,9 +599,10 @@ template RemarkT & operator<<(RemarkT &R, - typename std::enable_if< + std::enable_if_t< std::is_base_of::value, - DiagnosticInfoOptimizationBase::setExtraArgs>::type EA) { + DiagnosticInfoOptimizationBase::setExtraArgs> + EA) { R.insert(EA); return R; } diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h --- a/llvm/include/llvm/IR/Metadata.h +++ b/llvm/include/llvm/IR/Metadata.h @@ -527,7 +527,7 @@ /// As an analogue to \a isa(), check whether \c MD has an \a Value inside of /// type \c X. template -inline typename std::enable_if::value, bool>::type +inline std::enable_if_t::value, bool> hasa(Y &&MD) { assert(MD && "Null pointer sent into hasa"); if (auto *V = dyn_cast(MD)) @@ -535,9 +535,8 @@ return false; } template -inline - typename std::enable_if::value, bool>::type - hasa(Y &MD) { +inline std::enable_if_t::value, bool> +hasa(Y &MD) { return hasa(&MD); } @@ -545,14 +544,13 @@ /// /// As an analogue to \a cast(), extract the \a Value subclass \c X from \c MD. template -inline typename std::enable_if::value, X *>::type +inline std::enable_if_t::value, X *> extract(Y &&MD) { return cast(cast(MD)->getValue()); } template -inline - typename std::enable_if::value, X *>::type - extract(Y &MD) { +inline std::enable_if_t::value, X *> +extract(Y &MD) { return extract(&MD); } @@ -561,7 +559,7 @@ /// As an analogue to \a cast_or_null(), extract the \a Value subclass \c X /// from \c MD, allowing \c MD to be null. template -inline typename std::enable_if::value, X *>::type +inline std::enable_if_t::value, X *> extract_or_null(Y &&MD) { if (auto *V = cast_or_null(MD)) return cast(V->getValue()); @@ -574,7 +572,7 @@ /// from \c MD, return null if \c MD doesn't contain a \a Value or if the \a /// Value it does contain is of the wrong subclass. template -inline typename std::enable_if::value, X *>::type +inline std::enable_if_t::value, X *> dyn_extract(Y &&MD) { if (auto *V = dyn_cast(MD)) return dyn_cast(V->getValue()); @@ -587,7 +585,7 @@ /// from \c MD, return null if \c MD doesn't contain a \a Value or if the \a /// Value it does contain is of the wrong subclass, allowing \c MD to be null. template -inline typename std::enable_if::value, X *>::type +inline std::enable_if_t::value, X *> dyn_extract_or_null(Y &&MD) { if (auto *V = dyn_cast_or_null(MD)) return dyn_cast(V->getValue()); @@ -976,7 +974,7 @@ /// Try to create a uniqued version of \c N -- in place, if possible -- and /// return it. If \c N cannot be uniqued, return a distinct node instead. template - static typename std::enable_if::value, T *>::type + static std::enable_if_t::value, T *> replaceWithPermanent(std::unique_ptr N) { return cast(N.release()->replaceWithPermanentImpl()); } @@ -988,7 +986,7 @@ /// /// \pre N does not self-reference. template - static typename std::enable_if::value, T *>::type + static std::enable_if_t::value, T *> replaceWithUniqued(std::unique_ptr N) { return cast(N.release()->replaceWithUniquedImpl()); } @@ -998,7 +996,7 @@ /// Create a distinct version of \c N -- in place, if possible -- and return /// it. Takes ownership of the temporary node. template - static typename std::enable_if::value, T *>::type + static std::enable_if_t::value, T *> replaceWithDistinct(std::unique_ptr N) { return cast(N.release()->replaceWithDistinctImpl()); } @@ -1237,15 +1235,13 @@ template MDTupleTypedArrayWrapper( const MDTupleTypedArrayWrapper &Other, - typename std::enable_if::value>::type * = - nullptr) + std::enable_if_t::value> * = nullptr) : N(Other.get()) {} template explicit MDTupleTypedArrayWrapper( const MDTupleTypedArrayWrapper &Other, - typename std::enable_if::value>::type * = - nullptr) + std::enable_if_t::value> * = nullptr) : N(Other.get()) {} explicit operator bool() const { return get(); } diff --git a/llvm/include/llvm/IR/ValueMap.h b/llvm/include/llvm/IR/ValueMap.h --- a/llvm/include/llvm/IR/ValueMap.h +++ b/llvm/include/llvm/IR/ValueMap.h @@ -243,7 +243,7 @@ friend struct DenseMapInfo; using ValueMapT = ValueMap; - using KeySansPointerT = typename std::remove_pointer::type; + using KeySansPointerT = std::remove_pointer_t; ValueMapT *Map; diff --git a/llvm/include/llvm/Object/ELFTypes.h b/llvm/include/llvm/Object/ELFTypes.h --- a/llvm/include/llvm/Object/ELFTypes.h +++ b/llvm/include/llvm/Object/ELFTypes.h @@ -53,7 +53,7 @@ static const endianness TargetEndianness = E; static const bool Is64Bits = Is64; - using uint = typename std::conditional::type; + using uint = std::conditional_t; using Ehdr = Elf_Ehdr_Impl>; using Shdr = Elf_Shdr_Impl>; using Sym = Elf_Sym_Impl>; @@ -346,10 +346,8 @@ struct Elf_Dyn_Impl : Elf_Dyn_Base { using Elf_Dyn_Base::d_tag; using Elf_Dyn_Base::d_un; - using intX_t = typename std::conditional::type; - using uintX_t = typename std::conditional::type; + using intX_t = std::conditional_t; + using uintX_t = std::conditional_t; intX_t getTag() const { return d_tag; } uintX_t getVal() const { return d_un.d_val; } uintX_t getPtr() const { return d_un.d_ptr; } diff --git a/llvm/include/llvm/Support/AllocatorBase.h b/llvm/include/llvm/Support/AllocatorBase.h --- a/llvm/include/llvm/Support/AllocatorBase.h +++ b/llvm/include/llvm/Support/AllocatorBase.h @@ -70,8 +70,7 @@ /// Deallocate space for a sequence of objects without constructing them. template - typename std::enable_if< - !std::is_same::type, void>::value, void>::type + std::enable_if_t, void>::value, void> Deallocate(T *Ptr, size_t Num = 1) { Deallocate(static_cast(Ptr), Num * sizeof(T)); } diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h --- a/llvm/include/llvm/Support/BinaryStreamReader.h +++ b/llvm/include/llvm/Support/BinaryStreamReader.h @@ -90,7 +90,7 @@ template Error readEnum(T &Dest) { static_assert(std::is_enum::value, "Cannot call readEnum with non-enum value!"); - typename std::underlying_type::type N; + std::underlying_type_t N; if (auto EC = readInteger(N)) return EC; Dest = static_cast(N); diff --git a/llvm/include/llvm/Support/BinaryStreamWriter.h b/llvm/include/llvm/Support/BinaryStreamWriter.h --- a/llvm/include/llvm/Support/BinaryStreamWriter.h +++ b/llvm/include/llvm/Support/BinaryStreamWriter.h @@ -75,7 +75,7 @@ static_assert(std::is_enum::value, "Cannot call writeEnum with non-Enum type"); - using U = typename std::underlying_type::type; + using U = std::underlying_type_t; return writeInteger(static_cast(Num)); } diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h --- a/llvm/include/llvm/Support/Casting.h +++ b/llvm/include/llvm/Support/Casting.h @@ -61,8 +61,7 @@ /// Always allow upcasts, and perform no dynamic check for them. template -struct isa_impl< - To, From, typename std::enable_if::value>::type> { +struct isa_impl::value>> { static inline bool doit(const From &) { return true; } }; @@ -184,7 +183,7 @@ struct cast_retty_impl> { private: using PointerType = typename cast_retty_impl::ret_type; - using ResultType = typename std::remove_pointer::type; + using ResultType = std::remove_pointer_t; public: using ret_type = std::unique_ptr; @@ -244,8 +243,8 @@ // cast(myVal)->getParent() // template -inline typename std::enable_if::value, - typename cast_retty::ret_type>::type +inline std::enable_if_t::value, + typename cast_retty::ret_type> cast(const Y &Val) { assert(isa(Val) && "cast() argument of incompatible type!"); return cast_convert_val< @@ -280,10 +279,9 @@ // accepted. // template -LLVM_NODISCARD inline - typename std::enable_if::value, - typename cast_retty::ret_type>::type - cast_or_null(const Y &Val) { +LLVM_NODISCARD inline std::enable_if_t< + !is_simple_type::value, typename cast_retty::ret_type> +cast_or_null(const Y &Val) { if (!Val) return nullptr; assert(isa(Val) && "cast_or_null() argument of incompatible type!"); @@ -291,10 +289,9 @@ } template -LLVM_NODISCARD inline - typename std::enable_if::value, - typename cast_retty::ret_type>::type - cast_or_null(Y &Val) { +LLVM_NODISCARD inline std::enable_if_t::value, + typename cast_retty::ret_type> +cast_or_null(Y &Val) { if (!Val) return nullptr; assert(isa(Val) && "cast_or_null() argument of incompatible type!"); @@ -326,10 +323,9 @@ // template -LLVM_NODISCARD inline - typename std::enable_if::value, - typename cast_retty::ret_type>::type - dyn_cast(const Y &Val) { +LLVM_NODISCARD inline std::enable_if_t< + !is_simple_type::value, typename cast_retty::ret_type> +dyn_cast(const Y &Val) { return isa(Val) ? cast(Val) : nullptr; } @@ -347,18 +343,16 @@ // value is accepted. // template -LLVM_NODISCARD inline - typename std::enable_if::value, - typename cast_retty::ret_type>::type - dyn_cast_or_null(const Y &Val) { +LLVM_NODISCARD inline std::enable_if_t< + !is_simple_type::value, typename cast_retty::ret_type> +dyn_cast_or_null(const Y &Val) { return (Val && isa(Val)) ? cast(Val) : nullptr; } template -LLVM_NODISCARD inline - typename std::enable_if::value, - typename cast_retty::ret_type>::type - dyn_cast_or_null(Y &Val) { +LLVM_NODISCARD inline std::enable_if_t::value, + typename cast_retty::ret_type> +dyn_cast_or_null(Y &Val) { return (Val && isa(Val)) ? cast(Val) : nullptr; } diff --git a/llvm/include/llvm/Support/CheckedArithmetic.h b/llvm/include/llvm/Support/CheckedArithmetic.h --- a/llvm/include/llvm/Support/CheckedArithmetic.h +++ b/llvm/include/llvm/Support/CheckedArithmetic.h @@ -25,8 +25,8 @@ /// \p RHS. /// \return Empty optional if the operation overflows, or result otherwise. template -typename std::enable_if::value && sizeof(T) * 8 <= 64, - llvm::Optional>::type +std::enable_if_t::value && sizeof(T) * 8 <= 64, + llvm::Optional> checkedOp(T LHS, T RHS, F Op, bool Signed = true) { llvm::APInt ALHS(/*BitSize=*/sizeof(T) * 8, LHS, Signed); llvm::APInt ARHS(/*BitSize=*/sizeof(T) * 8, RHS, Signed); @@ -44,7 +44,7 @@ /// \return Optional of sum if no signed overflow occurred, /// \c None otherwise. template -typename std::enable_if::value, llvm::Optional>::type +std::enable_if_t::value, llvm::Optional> checkedAdd(T LHS, T RHS) { return checkedOp(LHS, RHS, &llvm::APInt::sadd_ov); } @@ -53,7 +53,7 @@ /// \return Optional of sum if no signed overflow occurred, /// \c None otherwise. template -typename std::enable_if::value, llvm::Optional>::type +std::enable_if_t::value, llvm::Optional> checkedSub(T LHS, T RHS) { return checkedOp(LHS, RHS, &llvm::APInt::ssub_ov); } @@ -62,7 +62,7 @@ /// \return Optional of product if no signed overflow occurred, /// \c None otherwise. template -typename std::enable_if::value, llvm::Optional>::type +std::enable_if_t::value, llvm::Optional> checkedMul(T LHS, T RHS) { return checkedOp(LHS, RHS, &llvm::APInt::smul_ov); } @@ -71,7 +71,7 @@ /// \return Optional of result if no signed overflow occurred, /// \c None otherwise. template -typename std::enable_if::value, llvm::Optional>::type +std::enable_if_t::value, llvm::Optional> checkedMulAdd(T A, T B, T C) { if (auto Product = checkedMul(A, B)) return checkedAdd(*Product, C); @@ -82,7 +82,7 @@ /// \return Optional of sum if no unsigned overflow occurred, /// \c None otherwise. template -typename std::enable_if::value, llvm::Optional>::type +std::enable_if_t::value, llvm::Optional> checkedAddUnsigned(T LHS, T RHS) { return checkedOp(LHS, RHS, &llvm::APInt::uadd_ov, /*Signed=*/false); } @@ -91,7 +91,7 @@ /// \return Optional of product if no unsigned overflow occurred, /// \c None otherwise. template -typename std::enable_if::value, llvm::Optional>::type +std::enable_if_t::value, llvm::Optional> checkedMulUnsigned(T LHS, T RHS) { return checkedOp(LHS, RHS, &llvm::APInt::umul_ov, /*Signed=*/false); } @@ -100,7 +100,7 @@ /// \return Optional of result if no unsigned overflow occurred, /// \c None otherwise. template -typename std::enable_if::value, llvm::Optional>::type +std::enable_if_t::value, llvm::Optional> checkedMulAddUnsigned(T A, T B, T C) { if (auto Product = checkedMulUnsigned(A, B)) return checkedAddUnsigned(*Product, C); diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h --- a/llvm/include/llvm/Support/Chrono.h +++ b/llvm/include/llvm/Support/Chrono.h @@ -112,8 +112,8 @@ struct format_provider> { private: typedef std::chrono::duration Dur; - typedef typename std::conditional< - std::chrono::treat_as_floating_point::value, double, intmax_t>::type + typedef std::conditional_t::value, + double, intmax_t> InternalRep; template static InternalRep getAs(const Dur &D) { diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -488,14 +488,13 @@ template struct callback_traits { using result_type = R; - using arg_type = typename std::tuple_element<0, std::tuple>::type; + using arg_type = std::tuple_element_t<0, std::tuple>; static_assert(sizeof...(Args) == 1, "callback function must have one and only one parameter"); static_assert(std::is_same::value, "callback return type must be void"); - static_assert( - std::is_lvalue_reference::value && - std::is_const::type>::value, - "callback arg_type must be a const lvalue reference"); + static_assert(std::is_lvalue_reference::value && + std::is_const>::value, + "callback arg_type must be a const lvalue reference"); }; } // namespace detail @@ -1453,16 +1452,16 @@ } } - template ::value>::type> + template ::value>> void setDefaultImpl() { const OptionValue &V = this->getDefault(); if (V.hasValue()) this->setValue(V.getValue()); } - template ::value>::type> + template ::value>> void setDefaultImpl(...) {} void setDefault() override { setDefaultImpl(); } diff --git a/llvm/include/llvm/Support/Endian.h b/llvm/include/llvm/Support/Endian.h --- a/llvm/include/llvm/Support/Endian.h +++ b/llvm/include/llvm/Support/Endian.h @@ -111,7 +111,7 @@ } template -using make_unsigned_t = typename std::make_unsigned::type; +using make_unsigned_t = std::make_unsigned_t; /// Read a value of a particular endianness from memory, for a location /// that starts at the given bit offset within the first byte. diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -436,19 +436,19 @@ static const bool isRef = std::is_reference::value; - using wrap = std::reference_wrapper::type>; + using wrap = std::reference_wrapper>; using error_type = std::unique_ptr; public: - using storage_type = typename std::conditional::type; + using storage_type = std::conditional_t; using value_type = T; private: - using reference = typename std::remove_reference::type &; - using const_reference = const typename std::remove_reference::type &; - using pointer = typename std::remove_reference::type *; - using const_pointer = const typename std::remove_reference::type *; + using reference = std::remove_reference_t &; + using const_reference = const std::remove_reference_t &; + using pointer = std::remove_reference_t *; + using const_pointer = const std::remove_reference_t *; public: /// Create an Expected error value from the given Error. @@ -472,12 +472,12 @@ /// must be convertible to T. template Expected(OtherT &&Val, - typename std::enable_if::value>::type - * = nullptr) + std::enable_if_t::value> * = nullptr) : HasError(false) #if LLVM_ENABLE_ABI_BREAKING_CHECKS // Expected is unchecked upon construction in Debug builds. - , Unchecked(true) + , + Unchecked(true) #endif { new (getStorage()) storage_type(std::forward(Val)); @@ -489,9 +489,9 @@ /// Move construct an Expected value from an Expected, where OtherT /// must be convertible to T. template - Expected(Expected &&Other, - typename std::enable_if::value>::type - * = nullptr) { + Expected( + Expected &&Other, + std::enable_if_t::value> * = nullptr) { moveConstruct(std::move(Other)); } @@ -500,8 +500,7 @@ template explicit Expected( Expected &&Other, - typename std::enable_if::value>::type * = - nullptr) { + std::enable_if_t::value> * = nullptr) { moveConstruct(std::move(Other)); } diff --git a/llvm/include/llvm/Support/ErrorOr.h b/llvm/include/llvm/Support/ErrorOr.h --- a/llvm/include/llvm/Support/ErrorOr.h +++ b/llvm/include/llvm/Support/ErrorOr.h @@ -58,23 +58,23 @@ static const bool isRef = std::is_reference::value; - using wrap = std::reference_wrapper::type>; + using wrap = std::reference_wrapper>; public: - using storage_type = typename std::conditional::type; + using storage_type = std::conditional_t; private: - using reference = typename std::remove_reference::type &; - using const_reference = const typename std::remove_reference::type &; - using pointer = typename std::remove_reference::type *; - using const_pointer = const typename std::remove_reference::type *; + using reference = std::remove_reference_t &; + using const_reference = const std::remove_reference_t &; + using pointer = std::remove_reference_t *; + using const_pointer = const std::remove_reference_t *; public: template ErrorOr(E ErrorCode, - typename std::enable_if::value || - std::is_error_condition_enum::value, - void *>::type = nullptr) + std::enable_if_t::value || + std::is_error_condition_enum::value, + void *> = nullptr) : HasError(true) { new (getErrorStorage()) std::error_code(make_error_code(ErrorCode)); } @@ -85,8 +85,7 @@ template ErrorOr(OtherT &&Val, - typename std::enable_if::value>::type - * = nullptr) + std::enable_if_t::value> * = nullptr) : HasError(false) { new (getStorage()) storage_type(std::forward(Val)); } @@ -96,18 +95,16 @@ } template - ErrorOr( - const ErrorOr &Other, - typename std::enable_if::value>::type * = - nullptr) { + ErrorOr(const ErrorOr &Other, + std::enable_if_t::value> * = nullptr) { copyConstruct(Other); } template explicit ErrorOr( const ErrorOr &Other, - typename std::enable_if< - !std::is_convertible::value>::type * = nullptr) { + std::enable_if_t::value> * = + nullptr) { copyConstruct(Other); } @@ -116,10 +113,8 @@ } template - ErrorOr( - ErrorOr &&Other, - typename std::enable_if::value>::type * = - nullptr) { + ErrorOr(ErrorOr &&Other, + std::enable_if_t::value> * = nullptr) { moveConstruct(std::move(Other)); } @@ -128,8 +123,7 @@ template explicit ErrorOr( ErrorOr &&Other, - typename std::enable_if::value>::type * = - nullptr) { + std::enable_if_t::value> * = nullptr) { moveConstruct(std::move(Other)); } @@ -266,9 +260,9 @@ }; template -typename std::enable_if::value || - std::is_error_condition_enum::value, - bool>::type +std::enable_if_t::value || + std::is_error_condition_enum::value, + bool> operator==(const ErrorOr &Err, E Code) { return Err.getError() == Code; } diff --git a/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h --- a/llvm/include/llvm/Support/FormatProviders.h +++ b/llvm/include/llvm/Support/FormatProviders.h @@ -124,7 +124,7 @@ template struct format_provider< - T, typename std::enable_if::value>::type> + T, std::enable_if_t::value>> : public detail::HelperFunctions { private: public: @@ -173,7 +173,7 @@ /// cases indicates the minimum number of nibbles to print. template struct format_provider< - T, typename std::enable_if::value>::type> + T, std::enable_if_t::value>> : public detail::HelperFunctions { private: public: @@ -198,7 +198,7 @@ template struct format_provider< - T, typename std::enable_if::value>::type> { + T, std::enable_if_t::value>> { static void format(const T &V, llvm::raw_ostream &Stream, StringRef Style) { size_t N = StringRef::npos; if (!Style.empty() && Style.getAsInteger(10, N)) { @@ -230,8 +230,8 @@ /// character. Otherwise, it is treated as an integer options string. /// template -struct format_provider< - T, typename std::enable_if::value>::type> { +struct format_provider::value>> { static void format(const char &V, llvm::raw_ostream &Stream, StringRef Style) { if (Style.empty()) @@ -296,8 +296,8 @@ /// else. template -struct format_provider< - T, typename std::enable_if::value>::type> +struct format_provider::value>> : public detail::HelperFunctions { static void format(const T &V, llvm::raw_ostream &Stream, StringRef Style) { FloatStyle S; diff --git a/llvm/include/llvm/Support/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h --- a/llvm/include/llvm/Support/FormatVariadicDetails.h +++ b/llvm/include/llvm/Support/FormatVariadicDetails.h @@ -36,7 +36,7 @@ explicit provider_format_adapter(T &&Item) : Item(std::forward(Item)) {} void format(llvm::raw_ostream &S, StringRef Options) override { - format_provider::type>::format(Item, S, Options); + format_provider>::format(Item, S, Options); } }; @@ -59,7 +59,7 @@ // template class has_FormatProvider { public: - using Decayed = typename std::decay::type; + using Decayed = std::decay_t; typedef void (*Signature_format)(const Decayed &, llvm::raw_ostream &, StringRef); @@ -75,14 +75,14 @@ // Test if raw_ostream& << T -> raw_ostream& is findable via ADL. template class has_StreamOperator { public: - using ConstRefT = const typename std::decay::type &; + using ConstRefT = const std::decay_t &; template - static char test(typename std::enable_if< - std::is_same() - << std::declval()), - llvm::raw_ostream &>::value, - int *>::type); + static char test( + std::enable_if_t() + << std::declval()), + llvm::raw_ostream &>::value, + int *>); template static double test(...); @@ -95,8 +95,8 @@ struct uses_format_member : public std::integral_constant< bool, - std::is_base_of::type>::value> {}; + std::is_base_of>::value> { +}; // Simple template that decides whether a type T should use the format_provider // based format() invocation. The member function takes priority, so this test @@ -127,34 +127,32 @@ }; template -typename std::enable_if::value, T>::type +std::enable_if_t::value, T> build_format_adapter(T &&Item) { return std::forward(Item); } template -typename std::enable_if::value, - provider_format_adapter>::type +std::enable_if_t::value, provider_format_adapter> build_format_adapter(T &&Item) { return provider_format_adapter(std::forward(Item)); } template -typename std::enable_if::value, - stream_operator_format_adapter>::type +std::enable_if_t::value, + stream_operator_format_adapter> build_format_adapter(T &&Item) { // If the caller passed an Error by value, then stream_operator_format_adapter // would be responsible for consuming it. // Make the caller opt into this by calling fmt_consume(). static_assert( - !std::is_same::type>::value, + !std::is_same>::value, "llvm::Error-by-value must be wrapped in fmt_consume() for formatv"); return stream_operator_format_adapter(std::forward(Item)); } template -typename std::enable_if::value, - missing_format_adapter>::type +std::enable_if_t::value, missing_format_adapter> build_format_adapter(T &&Item) { return missing_format_adapter(); } diff --git a/llvm/include/llvm/Support/GenericDomTree.h b/llvm/include/llvm/Support/GenericDomTree.h --- a/llvm/include/llvm/Support/GenericDomTree.h +++ b/llvm/include/llvm/Support/GenericDomTree.h @@ -225,7 +225,7 @@ using ParentPtr = decltype(std::declval()->getParent()); static_assert(std::is_pointer::value, "Currently NodeT's parent must be a pointer type"); - using ParentType = typename std::remove_pointer::type; + using ParentType = std::remove_pointer_t; static constexpr bool IsPostDominator = IsPostDom; using UpdateType = cfg::Update; diff --git a/llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h b/llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h --- a/llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h +++ b/llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h @@ -57,7 +57,7 @@ template class IDFCalculatorBase { public: using OrderedNodeTy = - typename std::conditional, NodeTy *>::type; + std::conditional_t, NodeTy *>; using ChildrenGetterTy = IDFCalculatorDetail::ChildrenGetterTy; diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h --- a/llvm/include/llvm/Support/JSON.h +++ b/llvm/include/llvm/Support/JSON.h @@ -329,25 +329,21 @@ Value(std::nullptr_t) : Type(T_Null) {} // Boolean (disallow implicit conversions). // (The last template parameter is a dummy to keep templates distinct.) - template < - typename T, - typename = typename std::enable_if::value>::type, - bool = false> + template ::value>, + bool = false> Value(T B) : Type(T_Boolean) { create(B); } // Integers (except boolean). Must be non-narrowing convertible to int64_t. - template < - typename T, - typename = typename std::enable_if::value>::type, - typename = typename std::enable_if::value>::type> + template ::value>, + typename = std::enable_if_t::value>> Value(T I) : Type(T_Integer) { create(int64_t{I}); } // Floating point. Must be non-narrowing convertible to double. template ::value>::type, + typename = std::enable_if_t::value>, double * = nullptr> Value(T D) : Type(T_Double) { create(double{D}); diff --git a/llvm/include/llvm/Support/MSVCErrorWorkarounds.h b/llvm/include/llvm/Support/MSVCErrorWorkarounds.h --- a/llvm/include/llvm/Support/MSVCErrorWorkarounds.h +++ b/llvm/include/llvm/Support/MSVCErrorWorkarounds.h @@ -59,22 +59,19 @@ template MSVCPExpected( OtherT &&Val, - typename std::enable_if::value>::type * = - nullptr) + std::enable_if_t::value> * = nullptr) : Expected(std::move(Val)) {} template MSVCPExpected( Expected &&Other, - typename std::enable_if::value>::type * = - nullptr) + std::enable_if_t::value> * = nullptr) : Expected(std::move(Other)) {} template explicit MSVCPExpected( Expected &&Other, - typename std::enable_if::value>::type * = - nullptr) + std::enable_if_t::value> * = nullptr) : Expected(std::move(Other)) {} }; diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -364,14 +364,12 @@ /// to keep MSVC from (incorrectly) warning on isUInt<64> that we're shifting /// left too many places. template -constexpr inline typename std::enable_if<(N < 64), bool>::type -isUInt(uint64_t X) { +constexpr inline std::enable_if_t<(N < 64), bool> isUInt(uint64_t X) { static_assert(N > 0, "isUInt<0> doesn't make sense"); return X < (UINT64_C(1) << (N)); } template -constexpr inline typename std::enable_if= 64, bool>::type -isUInt(uint64_t X) { +constexpr inline std::enable_if_t= 64, bool> isUInt(uint64_t X) { return true; } @@ -780,8 +778,7 @@ /// Subtract two unsigned integers, X and Y, of type T and return the absolute /// value of the result. template -typename std::enable_if::value, T>::type -AbsoluteDifference(T X, T Y) { +std::enable_if_t::value, T> AbsoluteDifference(T X, T Y) { return std::max(X, Y) - std::min(X, Y); } @@ -789,7 +786,7 @@ /// maximum representable value of T on overflow. ResultOverflowed indicates if /// the result is larger than the maximum representable value of type T. template -typename std::enable_if::value, T>::type +std::enable_if_t::value, T> SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) { bool Dummy; bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy; @@ -806,7 +803,7 @@ /// maximum representable value of T on overflow. ResultOverflowed indicates if /// the result is larger than the maximum representable value of type T. template -typename std::enable_if::value, T>::type +std::enable_if_t::value, T> SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) { bool Dummy; bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy; @@ -852,7 +849,7 @@ /// overflow. ResultOverflowed indicates if the result is larger than the /// maximum representable value of type T. template -typename std::enable_if::value, T>::type +std::enable_if_t::value, T> SaturatingMultiplyAdd(T X, T Y, T A, bool *ResultOverflowed = nullptr) { bool Dummy; bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy; @@ -871,13 +868,12 @@ /// Add two signed integers, computing the two's complement truncated result, /// returning true if overflow occured. template -typename std::enable_if::value, T>::type -AddOverflow(T X, T Y, T &Result) { +std::enable_if_t::value, T> AddOverflow(T X, T Y, T &Result) { #if __has_builtin(__builtin_add_overflow) return __builtin_add_overflow(X, Y, &Result); #else // Perform the unsigned addition. - using U = typename std::make_unsigned::type; + using U = std::make_unsigned_t; const U UX = static_cast(X); const U UY = static_cast(Y); const U UResult = UX + UY; @@ -898,13 +894,12 @@ /// Subtract two signed integers, computing the two's complement truncated /// result, returning true if an overflow ocurred. template -typename std::enable_if::value, T>::type -SubOverflow(T X, T Y, T &Result) { +std::enable_if_t::value, T> SubOverflow(T X, T Y, T &Result) { #if __has_builtin(__builtin_sub_overflow) return __builtin_sub_overflow(X, Y, &Result); #else // Perform the unsigned addition. - using U = typename std::make_unsigned::type; + using U = std::make_unsigned_t; const U UX = static_cast(X); const U UY = static_cast(Y); const U UResult = UX - UY; @@ -922,14 +917,12 @@ #endif } - /// Multiply two signed integers, computing the two's complement truncated /// result, returning true if an overflow ocurred. template -typename std::enable_if::value, T>::type -MulOverflow(T X, T Y, T &Result) { +std::enable_if_t::value, T> MulOverflow(T X, T Y, T &Result) { // Perform the unsigned multiplication on absolute values. - using U = typename std::make_unsigned::type; + using U = std::make_unsigned_t; const U UX = X < 0 ? (0 - static_cast(X)) : static_cast(X); const U UY = Y < 0 ? (0 - static_cast(Y)) : static_cast(Y); const U UResult = UX * UY; diff --git a/llvm/include/llvm/Support/SwapByteOrder.h b/llvm/include/llvm/Support/SwapByteOrder.h --- a/llvm/include/llvm/Support/SwapByteOrder.h +++ b/llvm/include/llvm/Support/SwapByteOrder.h @@ -143,10 +143,9 @@ } template -inline typename std::enable_if::value, T>::type -getSwappedBytes(T C) { +inline std::enable_if_t::value, T> getSwappedBytes(T C) { return static_cast( - getSwappedBytes(static_cast::type>(C))); + getSwappedBytes(static_cast>(C))); } template diff --git a/llvm/include/llvm/Support/TaskQueue.h b/llvm/include/llvm/Support/TaskQueue.h --- a/llvm/include/llvm/Support/TaskQueue.h +++ b/llvm/include/llvm/Support/TaskQueue.h @@ -38,7 +38,7 @@ // type-specialized domain (before type erasure) and then erase this into a // std::function. template struct Task { - using ResultTy = typename std::result_of::type; + using ResultTy = std::result_of_t; explicit Task(Callable C, TaskQueue &Parent) : C(std::move(C)), P(std::make_shared>()), Parent(&Parent) {} @@ -78,13 +78,13 @@ /// used to wait for the task (and all previous tasks that have not yet /// completed) to finish. template - std::future::type> async(Callable &&C) { + std::future> async(Callable &&C) { #if !LLVM_ENABLE_THREADS static_assert(false, "TaskQueue requires building with LLVM_ENABLE_THREADS!"); #endif Task T{std::move(C), *this}; - using ResultTy = typename std::result_of::type; + using ResultTy = std::result_of_t; std::future F = T.P->get_future(); { std::lock_guard Lock(QueueLock); diff --git a/llvm/include/llvm/Support/TrailingObjects.h b/llvm/include/llvm/Support/TrailingObjects.h --- a/llvm/include/llvm/Support/TrailingObjects.h +++ b/llvm/include/llvm/Support/TrailingObjects.h @@ -326,8 +326,8 @@ /// used in the class; they are supplied here redundantly only so /// that it's clear what the counts are counting in callers. template - static constexpr typename std::enable_if< - std::is_same, Foo>::value, size_t>::type + static constexpr std::enable_if_t< + std::is_same, Foo>::value, size_t> additionalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t>::type... Counts) { return ParentType::additionalSizeToAllocImpl(0, Counts...); @@ -338,8 +338,8 @@ /// additionalSizeToAlloc, except it *does* include the size of the base /// object. template - static constexpr typename std::enable_if< - std::is_same, Foo>::value, size_t>::type + static constexpr std::enable_if_t< + std::is_same, Foo>::value, size_t> totalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t>::type... Counts) { return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, Counts...); diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -868,7 +868,7 @@ } template - typename std::enable_if::value, void>::type + std::enable_if_t::value, void> mapOptionalWithContext(const char *Key, T &Val, Context &Ctx) { // omit key/value instead of outputting empty sequence if (this->canElideEmptySequence() && !(Val.begin() != Val.end())) @@ -883,7 +883,7 @@ } template - typename std::enable_if::value, void>::type + std::enable_if_t::value, void> mapOptionalWithContext(const char *Key, T &Val, Context &Ctx) { this->processKey(Key, Val, false, Ctx); } @@ -965,7 +965,7 @@ } // end namespace detail template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { io.beginEnumScalar(); ScalarEnumerationTraits::enumeration(io, Val); @@ -973,7 +973,7 @@ } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { bool DoClear; if ( io.beginBitSetScalar(DoClear) ) { @@ -985,8 +985,8 @@ } template -typename std::enable_if::value, void>::type -yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, + EmptyContext &Ctx) { if ( io.outputting() ) { std::string Storage; raw_string_ostream Buffer(Storage); @@ -1005,7 +1005,7 @@ } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &YamlIO, T &Val, bool, EmptyContext &Ctx) { if (YamlIO.outputting()) { std::string Storage; @@ -1024,7 +1024,7 @@ } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { if (io.outputting()) { std::string ScalarStorage, TagStorage; @@ -1049,7 +1049,7 @@ } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, Context &Ctx) { if (has_FlowTraits>::value) io.beginFlowMapping(); @@ -1075,7 +1075,7 @@ } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, Context &Ctx) { if (has_FlowTraits>::value) { io.beginFlowMapping(); @@ -1089,7 +1089,7 @@ } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { if ( io.outputting() ) { io.beginMapping(); @@ -1104,7 +1104,7 @@ } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { switch (io.outputting() ? PolymorphicTraits::getKind(Val) : io.getNodeKind()) { @@ -1118,13 +1118,13 @@ } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { char missing_yaml_trait_for_type[sizeof(MissingTrait)]; } template -typename std::enable_if::value, void>::type +std::enable_if_t::value, void> yamlize(IO &io, T &Seq, bool, Context &Ctx) { if ( has_FlowTraits< SequenceTraits>::value ) { unsigned incnt = io.beginFlowSequence(); @@ -1247,10 +1247,9 @@ // type. This way endian aware types are supported whenever the traits are // defined for the underlying type. template -struct ScalarTraits< - support::detail::packed_endian_specific_integral, - typename std::enable_if::value>::type> { +struct ScalarTraits, + std::enable_if_t::value>> { using endian_type = support::detail::packed_endian_specific_integral; @@ -1275,8 +1274,7 @@ struct ScalarEnumerationTraits< support::detail::packed_endian_specific_integral, - typename std::enable_if< - has_ScalarEnumerationTraits::value>::type> { + std::enable_if_t::value>> { using endian_type = support::detail::packed_endian_specific_integral; @@ -1292,7 +1290,7 @@ struct ScalarBitSetTraits< support::detail::packed_endian_specific_integral, - typename std::enable_if::value>::type> { + std::enable_if_t::value>> { using endian_type = support::detail::packed_endian_specific_integral; @@ -1688,8 +1686,7 @@ // Define non-member operator>> so that Input can stream in a document list. template -inline -typename std::enable_if::value, Input &>::type +inline std::enable_if_t::value, Input &> operator>>(Input &yin, T &docList) { int i = 0; EmptyContext Ctx; @@ -1705,8 +1702,7 @@ // Define non-member operator>> so that Input can stream in a map as a document. template -inline typename std::enable_if::value, - Input &>::type +inline std::enable_if_t::value, Input &> operator>>(Input &yin, T &docMap) { EmptyContext Ctx; yin.setCurrentDocument(); @@ -1717,8 +1713,7 @@ // Define non-member operator>> so that Input can stream in a sequence as // a document. template -inline -typename std::enable_if::value, Input &>::type +inline std::enable_if_t::value, Input &> operator>>(Input &yin, T &docSeq) { EmptyContext Ctx; if (yin.setCurrentDocument()) @@ -1728,8 +1723,7 @@ // Define non-member operator>> so that Input can stream in a block scalar. template -inline -typename std::enable_if::value, Input &>::type +inline std::enable_if_t::value, Input &> operator>>(Input &In, T &Val) { EmptyContext Ctx; if (In.setCurrentDocument()) @@ -1739,8 +1733,7 @@ // Define non-member operator>> so that Input can stream in a string map. template -inline -typename std::enable_if::value, Input &>::type +inline std::enable_if_t::value, Input &> operator>>(Input &In, T &Val) { EmptyContext Ctx; if (In.setCurrentDocument()) @@ -1750,7 +1743,7 @@ // Define non-member operator>> so that Input can stream in a polymorphic type. template -inline typename std::enable_if::value, Input &>::type +inline std::enable_if_t::value, Input &> operator>>(Input &In, T &Val) { EmptyContext Ctx; if (In.setCurrentDocument()) @@ -1760,8 +1753,7 @@ // Provide better error message about types missing a trait specialization template -inline typename std::enable_if::value, - Input &>::type +inline std::enable_if_t::value, Input &> operator>>(Input &yin, T &docSeq) { char missing_yaml_trait_for_type[sizeof(MissingTrait)]; return yin; @@ -1769,8 +1761,7 @@ // Define non-member operator<< so that Output can stream out document list. template -inline -typename std::enable_if::value, Output &>::type +inline std::enable_if_t::value, Output &> operator<<(Output &yout, T &docList) { EmptyContext Ctx; yout.beginDocuments(); @@ -1788,8 +1779,7 @@ // Define non-member operator<< so that Output can stream out a map. template -inline typename std::enable_if::value, - Output &>::type +inline std::enable_if_t::value, Output &> operator<<(Output &yout, T &map) { EmptyContext Ctx; yout.beginDocuments(); @@ -1803,8 +1793,7 @@ // Define non-member operator<< so that Output can stream out a sequence. template -inline -typename std::enable_if::value, Output &>::type +inline std::enable_if_t::value, Output &> operator<<(Output &yout, T &seq) { EmptyContext Ctx; yout.beginDocuments(); @@ -1818,8 +1807,7 @@ // Define non-member operator<< so that Output can stream out a block scalar. template -inline -typename std::enable_if::value, Output &>::type +inline std::enable_if_t::value, Output &> operator<<(Output &Out, T &Val) { EmptyContext Ctx; Out.beginDocuments(); @@ -1833,8 +1821,7 @@ // Define non-member operator<< so that Output can stream out a string map. template -inline -typename std::enable_if::value, Output &>::type +inline std::enable_if_t::value, Output &> operator<<(Output &Out, T &Val) { EmptyContext Ctx; Out.beginDocuments(); @@ -1849,7 +1836,7 @@ // Define non-member operator<< so that Output can stream out a polymorphic // type. template -inline typename std::enable_if::value, Output &>::type +inline std::enable_if_t::value, Output &> operator<<(Output &Out, T &Val) { EmptyContext Ctx; Out.beginDocuments(); @@ -1866,8 +1853,7 @@ // Provide better error message about types missing a trait specialization template -inline typename std::enable_if::value, - Output &>::type +inline std::enable_if_t::value, Output &> operator<<(Output &yout, T &seq) { char missing_yaml_trait_for_type[sizeof(MissingTrait)]; return yout; @@ -1898,25 +1884,25 @@ // If T has SequenceElementTraits, then vector and SmallVector have // SequenceTraits that do the obvious thing. template -struct SequenceTraits, - typename std::enable_if::flow>::value>::type> +struct SequenceTraits< + std::vector, + std::enable_if_t::flow>::value>> : SequenceTraitsImpl, SequenceElementTraits::flow> {}; template -struct SequenceTraits, - typename std::enable_if::flow>::value>::type> +struct SequenceTraits< + SmallVector, + std::enable_if_t::flow>::value>> : SequenceTraitsImpl, SequenceElementTraits::flow> {}; template -struct SequenceTraits, - typename std::enable_if::flow>::value>::type> +struct SequenceTraits< + SmallVectorImpl, + std::enable_if_t::flow>::value>> : SequenceTraitsImpl, SequenceElementTraits::flow> {}; // Sequences of fundamental types use flow formatting. template -struct SequenceElementTraits< - T, typename std::enable_if::value>::type> { +struct SequenceElementTraits::value>> { static const bool flow = true; }; diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h --- a/llvm/include/llvm/Support/raw_ostream.h +++ b/llvm/include/llvm/Support/raw_ostream.h @@ -358,9 +358,9 @@ /// Call the appropriate insertion operator, given an rvalue reference to a /// raw_ostream object and return a stream of the same type as the argument. template -typename std::enable_if::value && - std::is_base_of::value, - OStream &&>::type +std::enable_if_t::value && + std::is_base_of::value, + OStream &&> operator<<(OStream &&OS, const T &Value) { OS << Value; return std::move(OS); diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h --- a/llvm/include/llvm/Support/type_traits.h +++ b/llvm/include/llvm/Support/type_traits.h @@ -28,7 +28,7 @@ /// Also note that enum classes aren't implicitly convertible to integral types, /// the value may therefore need to be explicitly converted before being used. template class is_integral_or_enum { - using UnderlyingT = typename std::remove_reference::type; + using UnderlyingT = std::remove_reference_t; public: static const bool value = @@ -45,7 +45,7 @@ template struct add_lvalue_reference_if_not_pointer< - T, typename std::enable_if::value>::type> { + T, std::enable_if_t::value>> { using type = T; }; @@ -55,9 +55,8 @@ struct add_const_past_pointer { using type = const T; }; template -struct add_const_past_pointer< - T, typename std::enable_if::value>::type> { - using type = const typename std::remove_pointer::type *; +struct add_const_past_pointer::value>> { + using type = const std::remove_pointer_t *; }; template @@ -65,8 +64,8 @@ using type = const T &; }; template -struct const_pointer_or_const_ref< - T, typename std::enable_if::value>::type> { +struct const_pointer_or_const_ref::value>> { using type = typename add_const_past_pointer::type; }; diff --git a/llvm/include/llvm/XRay/Graph.h b/llvm/include/llvm/XRay/Graph.h --- a/llvm/include/llvm/XRay/Graph.h +++ b/llvm/include/llvm/XRay/Graph.h @@ -126,14 +126,14 @@ /// set. template ::type> + typename T = + std::conditional_t> class NeighborEdgeIteratorT : public iterator_adaptor_base< NeighborEdgeIteratorT, BaseIt, typename std::iterator_traits::iterator_category, T> { using InternalEdgeMapT = - typename std::conditional::type; + std::conditional_t; friend class NeighborEdgeIteratorT; friend class NeighborEdgeIteratorT::type> + typename = std::enable_if> operator NeighborEdgeIteratorT() const { return NeighborEdgeIteratorT; using const_iterator = NeighborEdgeIteratorT; - using GraphT = typename std::conditional::type; + using GraphT = std::conditional_t; using InternalEdgeMapT = - typename std::conditional::type; + std::conditional_t; private: InternalEdgeMapT &M; @@ -272,10 +272,10 @@ /// the number of elements in the range and whether the range is empty. template class VertexView { public: - using iterator = typename std::conditional::type; + using iterator = + std::conditional_t; using const_iterator = ConstVertexIterator; - using GraphT = typename std::conditional::type; + using GraphT = std::conditional_t; private: GraphT &G; @@ -309,10 +309,10 @@ /// the number of elements in the range and whether the range is empty. template class EdgeView { public: - using iterator = typename std::conditional::type; + using iterator = + std::conditional_t; using const_iterator = ConstEdgeIterator; - using GraphT = typename std::conditional::type; + using GraphT = std::conditional_t; private: GraphT &G; diff --git a/llvm/lib/Demangle/ItaniumDemangle.cpp b/llvm/lib/Demangle/ItaniumDemangle.cpp --- a/llvm/lib/Demangle/ItaniumDemangle.cpp +++ b/llvm/lib/Demangle/ItaniumDemangle.cpp @@ -107,13 +107,11 @@ // Overload used when T is exactly 'bool', not merely convertible to 'bool'. void print(bool B) { printStr(B ? "true" : "false"); } - template - typename std::enable_if::value>::type print(T N) { + template std::enable_if_t::value> print(T N) { fprintf(stderr, "%llu", (unsigned long long)N); } - template - typename std::enable_if::value>::type print(T N) { + template std::enable_if_t::value> print(T N) { fprintf(stderr, "%lld", (long long)N); } diff --git a/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp b/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp --- a/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp +++ b/llvm/lib/Support/ItaniumManglingCanonicalizer.cpp @@ -30,9 +30,8 @@ void operator()(StringView Str) { ID.AddString(llvm::StringRef(Str.begin(), Str.size())); } - template - typename std::enable_if::value || - std::is_enum::value>::type + template + std::enable_if_t::value || std::is_enum::value> operator()(T V) { ID.AddInteger((unsigned long long)V); } diff --git a/llvm/lib/Support/NativeFormatting.cpp b/llvm/lib/Support/NativeFormatting.cpp --- a/llvm/lib/Support/NativeFormatting.cpp +++ b/llvm/lib/Support/NativeFormatting.cpp @@ -89,7 +89,7 @@ IntegerStyle Style) { static_assert(std::is_signed::value, "Value is not signed!"); - using UnsignedT = typename std::make_unsigned::type; + using UnsignedT = std::make_unsigned_t; if (N >= 0) { write_unsigned(S, static_cast(N), MinDigits, Style); diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -757,8 +757,8 @@ return false; int64_t Val = MCE->getValue(); - int64_t SVal = typename std::make_signed::type(Val); - int64_t UVal = typename std::make_unsigned::type(Val); + int64_t SVal = std::make_signed_t(Val); + int64_t UVal = std::make_unsigned_t(Val); if (Val != SVal && Val != UVal) return false; @@ -854,8 +854,7 @@ if (!isShiftedImm() && (!isImm() || !isa(getImm()))) return DiagnosticPredicateTy::NoMatch; - bool IsByte = - std::is_same::type>::value; + bool IsByte = std::is_same>::value; if (auto ShiftedImm = getShiftedVal<8>()) if (!(IsByte && ShiftedImm->second) && AArch64_AM::isSVECpyImm(uint64_t(ShiftedImm->first) @@ -872,8 +871,7 @@ if (!isShiftedImm() && (!isImm() || !isa(getImm()))) return DiagnosticPredicateTy::NoMatch; - bool IsByte = - std::is_same::type>::value; + bool IsByte = std::is_same>::value; if (auto ShiftedImm = getShiftedVal<8>()) if (!(IsByte && ShiftedImm->second) && AArch64_AM::isSVEAddSubImm(ShiftedImm->first @@ -1610,7 +1608,7 @@ void addLogicalImmOperands(MCInst &Inst, unsigned N) const { assert(N == 1 && "Invalid number of operands!"); const MCConstantExpr *MCE = cast(getImm()); - typename std::make_unsigned::type Val = MCE->getValue(); + std::make_unsigned_t Val = MCE->getValue(); uint64_t encoding = AArch64_AM::encodeLogicalImmediate(Val, sizeof(T) * 8); Inst.addOperand(MCOperand::createImm(encoding)); } @@ -1619,7 +1617,7 @@ void addLogicalImmNotOperands(MCInst &Inst, unsigned N) const { assert(N == 1 && "Invalid number of operands!"); const MCConstantExpr *MCE = cast(getImm()); - typename std::make_unsigned::type Val = ~MCE->getValue(); + std::make_unsigned_t Val = ~MCE->getValue(); uint64_t encoding = AArch64_AM::encodeLogicalImmediate(Val, sizeof(T) * 8); Inst.addOperand(MCOperand::createImm(encoding)); } diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h @@ -763,10 +763,10 @@ bool IsImm8 = int8_t(Imm) == Imm; bool IsImm16 = int16_t(Imm & ~0xff) == Imm; - if (std::is_same::type>::value) + if (std::is_same>::value) return IsImm8 || uint8_t(Imm) == Imm; - if (std::is_same::type>::value) + if (std::is_same>::value) return IsImm8 || IsImm16 || uint16_t(Imm & ~0xff) == Imm; return IsImm8 || IsImm16; @@ -775,8 +775,7 @@ /// Returns true if Imm is valid for ADD/SUB. template static inline bool isSVEAddSubImm(int64_t Imm) { - bool IsInt8t = - std::is_same::type>::value; + bool IsInt8t = std::is_same>::value; return uint8_t(Imm) == Imm || (!IsInt8t && uint16_t(Imm & ~0xff) == Imm); } diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp @@ -1511,7 +1511,7 @@ template void AArch64InstPrinter::printImmSVE(T Value, raw_ostream &O) { - typename std::make_unsigned::type HexValue = Value; + std::make_unsigned_t HexValue = Value; if (getPrintImmHex()) O << '#' << formatHex((uint64_t)HexValue); @@ -1556,8 +1556,8 @@ void AArch64InstPrinter::printSVELogicalImm(const MCInst *MI, unsigned OpNum, const MCSubtargetInfo &STI, raw_ostream &O) { - typedef typename std::make_signed::type SignedT; - typedef typename std::make_unsigned::type UnsignedT; + typedef std::make_signed_t SignedT; + typedef std::make_unsigned_t UnsignedT; uint64_t Val = MI->getOperand(OpNum).getImm(); UnsignedT PrintVal = AArch64_AM::decodeLogicalImmediate(Val, 64); diff --git a/llvm/lib/XRay/FDRTraceWriter.cpp b/llvm/lib/XRay/FDRTraceWriter.cpp --- a/llvm/lib/XRay/FDRTraceWriter.cpp +++ b/llvm/lib/XRay/FDRTraceWriter.cpp @@ -20,10 +20,9 @@ template struct IndexedWriter { template < class Tuple, - typename std::enable_if< - (Index < - std::tuple_size::type>::value), - int>::type = 0> + std::enable_if_t<(Index < + std::tuple_size>::value), + int> = 0> static size_t write(support::endian::Writer &OS, Tuple &&T) { OS.write(std::get(T)); return sizeof(std::get(T)) + IndexedWriter::write(OS, T); @@ -31,10 +30,9 @@ template < class Tuple, - typename std::enable_if< - (Index >= - std::tuple_size::type>::value), - int>::type = 0> + std::enable_if_t<(Index >= + std::tuple_size>::value), + int> = 0> static size_t write(support::endian::Writer &OS, Tuple &&) { return 0; } diff --git a/llvm/tools/dsymutil/CFBundle.cpp b/llvm/tools/dsymutil/CFBundle.cpp --- a/llvm/tools/dsymutil/CFBundle.cpp +++ b/llvm/tools/dsymutil/CFBundle.cpp @@ -34,9 +34,8 @@ /// any valid pointer it owns unless that pointer is explicitly released using /// the release() member function. template -using CFReleaser = - std::unique_ptr::type, - CFDeleter::type>>; +using CFReleaser = std::unique_ptr, + CFDeleter>>; /// RAII wrapper around CFBundleRef. class CFString : public CFReleaser { diff --git a/llvm/tools/llvm-pdbutil/FormatUtil.h b/llvm/tools/llvm-pdbutil/FormatUtil.h --- a/llvm/tools/llvm-pdbutil/FormatUtil.h +++ b/llvm/tools/llvm-pdbutil/FormatUtil.h @@ -42,8 +42,7 @@ return Ret; template std::string formatUnknownEnum(T Value) { - return formatv("unknown ({0})", - static_cast::type>(Value)) + return formatv("unknown ({0})", static_cast>(Value)) .str(); } diff --git a/llvm/tools/llvm-xray/trie-node.h b/llvm/tools/llvm-xray/trie-node.h --- a/llvm/tools/llvm-xray/trie-node.h +++ b/llvm/tools/llvm-xray/trie-node.h @@ -48,7 +48,7 @@ TrieNode * mergeTrieNodes(const TrieNode &Left, const TrieNode &Right, /*Non-deduced pointer type for nullptr compatibility*/ - typename std::remove_reference *>::type NewParent, + std::remove_reference_t *> NewParent, std::forward_list> &NodeStore, Callable &&MergeCallable) { llvm::function_ref MergeFn( diff --git a/llvm/unittests/ADT/DenseSetTest.cpp b/llvm/unittests/ADT/DenseSetTest.cpp --- a/llvm/unittests/ADT/DenseSetTest.cpp +++ b/llvm/unittests/ADT/DenseSetTest.cpp @@ -52,7 +52,7 @@ private: static T GetTestSet() { - typename std::remove_const::type Set; + std::remove_const_t Set; Set.insert(0); Set.insert(1); Set.insert(2); diff --git a/llvm/unittests/IR/PatternMatch.cpp b/llvm/unittests/IR/PatternMatch.cpp --- a/llvm/unittests/IR/PatternMatch.cpp +++ b/llvm/unittests/IR/PatternMatch.cpp @@ -1319,8 +1319,8 @@ TYPED_TEST(MutableConstTest, ICmp) { auto &IRB = PatternMatchTest::IRB; - typedef typename std::tuple_element<0, TypeParam>::type ValueType; - typedef typename std::tuple_element<1, TypeParam>::type InstructionType; + typedef std::tuple_element_t<0, TypeParam> ValueType; + typedef std::tuple_element_t<1, TypeParam> InstructionType; Value *L = IRB.getInt32(1); Value *R = IRB.getInt32(2); diff --git a/llvm/unittests/XRay/GraphTest.cpp b/llvm/unittests/XRay/GraphTest.cpp --- a/llvm/unittests/XRay/GraphTest.cpp +++ b/llvm/unittests/XRay/GraphTest.cpp @@ -34,7 +34,7 @@ private: static T getTestGraph() { using std::make_pair; - typename std::remove_const::type G; + std::remove_const_t G; G.insert(make_pair(1u, VAttr({3u}))); G.insert(make_pair(2u, VAttr({5u}))); G.insert(make_pair(3u, VAttr({7u}))); diff --git a/llvm/utils/benchmark/include/benchmark/benchmark.h b/llvm/utils/benchmark/include/benchmark/benchmark.h --- a/llvm/utils/benchmark/include/benchmark/benchmark.h +++ b/llvm/utils/benchmark/include/benchmark/benchmark.h @@ -990,8 +990,7 @@ #ifdef BENCHMARK_HAS_CXX11 template internal::Benchmark* RegisterBenchmark(const char* name, Lambda&& fn) { - using BenchType = - internal::LambdaBenchmark::type>; + using BenchType = internal::LambdaBenchmark>; return internal::RegisterBenchmarkInternal( ::new BenchType(name, std::forward(fn))); } diff --git a/llvm/utils/benchmark/src/sysinfo.cc b/llvm/utils/benchmark/src/sysinfo.cc --- a/llvm/utils/benchmark/src/sysinfo.cc +++ b/llvm/utils/benchmark/src/sysinfo.cc @@ -176,9 +176,8 @@ return true; } -template ::value>::type> -bool GetSysctl(std::string const& Name, Tp* Out) { +template ::value>> +bool GetSysctl(std::string const &Name, Tp *Out) { *Out = 0; auto Buff = GetSysctlImp(Name); if (!Buff) return false; diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h @@ -3118,8 +3118,9 @@ typedef typename View::const_reference StlContainerReference; typedef decltype(std::begin( std::declval())) StlContainerConstIterator; - typedef typename std::remove_reference())>::type Element; + typedef std::remove_reference_t())> + Element; // Constructs the matcher from a sequence of element values or // element matchers. @@ -3360,8 +3361,9 @@ typedef typename View::const_reference StlContainerReference; typedef decltype(std::begin( std::declval())) StlContainerConstIterator; - typedef typename std::remove_reference())>::type Element; + typedef std::remove_reference_t())> + Element; // Constructs the matcher from a sequence of element values or // element matchers. @@ -3470,8 +3472,9 @@ typedef typename View::const_reference StlContainerReference; typedef decltype(std::begin( std::declval())) StlContainerConstIterator; - typedef typename std::remove_reference())>::type Element; + typedef std::remove_reference_t())> + Element; typedef ::std::vector > MatcherVec; MatcherVec matchers; matchers.reserve(::testing::tuple_size::value); @@ -3499,8 +3502,9 @@ typedef typename View::const_reference StlContainerReference; typedef decltype(std::begin( std::declval())) StlContainerConstIterator; - typedef typename std::remove_reference())>::type Element; + typedef std::remove_reference_t())> + Element; typedef ::std::vector > MatcherVec; MatcherVec matchers; matchers.reserve(::testing::tuple_size::value);