1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

Use std::foo_t rather than std::foo in LLVM.

Summary: C++14 migration. No functional change.

Reviewers: bkramer, JDevlieghere, lebedev.ri

Subscribers: MatzeB, hiraditya, jkorous, dexonsmith, arphaman, kadircet, lebedev.ri, usaxena95, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D74384
This commit is contained in:
Justin Lebar 2020-02-10 20:33:08 -08:00
parent 7f1560ae89
commit 0e4d775a3f
75 changed files with 479 additions and 568 deletions

View File

@ -853,8 +853,8 @@ public:
APFloat(const fltSemantics &Semantics) : U(Semantics) {} APFloat(const fltSemantics &Semantics) : U(Semantics) {}
APFloat(const fltSemantics &Semantics, StringRef S); APFloat(const fltSemantics &Semantics, StringRef S);
APFloat(const fltSemantics &Semantics, integerPart I) : U(Semantics, I) {} APFloat(const fltSemantics &Semantics, integerPart I) : U(Semantics, I) {}
template <typename T, typename = typename std::enable_if< template <typename T,
std::is_floating_point<T>::value>::type> typename = std::enable_if_t<std::is_floating_point<T>::value>>
APFloat(const fltSemantics &Semantics, T V) = delete; APFloat(const fltSemantics &Semantics, T V) = delete;
// TODO: Remove this constructor. This isn't faster than the first one. // TODO: Remove this constructor. This isn't faster than the first one.
APFloat(const fltSemantics &Semantics, uninitializedTag) APFloat(const fltSemantics &Semantics, uninitializedTag)

View File

@ -110,8 +110,8 @@ private:
template <class OtherValueT, class OtherIteratorBase> template <class OtherValueT, class OtherIteratorBase>
IteratorImpl(const IteratorImpl<OtherValueT, OtherIteratorBase> &X, IteratorImpl(const IteratorImpl<OtherValueT, OtherIteratorBase> &X,
typename std::enable_if<std::is_convertible< std::enable_if_t<std::is_convertible<
OtherIteratorBase, IteratorBase>::value>::type * = nullptr) OtherIteratorBase, IteratorBase>::value> * = nullptr)
: base_type(X.wrapped()) {} : base_type(X.wrapped()) {}
~IteratorImpl() = default; ~IteratorImpl() = default;

View File

@ -59,26 +59,26 @@ public:
// When T is Any or T is not copy-constructible we need to explicitly disable // 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 // the forwarding constructor so that the copy constructor gets selected
// instead. // instead.
template < template <typename T,
typename T, std::enable_if_t<
typename std::enable_if< llvm::conjunction<
llvm::conjunction< llvm::negation<std::is_same<std::decay_t<T>, Any>>,
llvm::negation<std::is_same<typename std::decay<T>::type, Any>>, // We also disable this overload when an `Any` object can be
// We also disable this overload when an `Any` object can be // converted to the parameter type because in that case,
// converted to the parameter type because in that case, this // this constructor may combine with that conversion during
// constructor may combine with that conversion during overload // overload resolution for determining copy
// resolution for determining copy constructibility, and then // constructibility, and then when we try to determine copy
// when we try to determine copy constructibility below we may // constructibility below we may infinitely recurse. This is
// infinitely recurse. This is being evaluated by the standards // being evaluated by the standards committee as a potential
// committee as a potential DR in `std::any` as well, but we're // DR in `std::any` as well, but we're going ahead and
// going ahead and adopting it to work-around usage of `Any` with // adopting it to work-around usage of `Any` with types that
// types that need to be implicitly convertible from an `Any`. // need to be implicitly convertible from an `Any`.
llvm::negation<std::is_convertible<Any, typename std::decay<T>::type>>, llvm::negation<std::is_convertible<Any, std::decay_t<T>>>,
std::is_copy_constructible<typename std::decay<T>::type>>::value, std::is_copy_constructible<std::decay<T>>>::value,
int>::type = 0> int> = 0>
Any(T &&Value) { Any(T &&Value) {
using U = typename std::decay<T>::type; Storage =
Storage = std::make_unique<StorageImpl<U>>(std::forward<T>(Value)); std::make_unique<StorageImpl<std::decay_t<T>>>(std::forward<T>(Value));
} }
Any(Any &&Other) : Storage(std::move(Other.Storage)) {} Any(Any &&Other) : Storage(std::move(Other.Storage)) {}
@ -114,32 +114,27 @@ template <typename T> const char Any::TypeId<T>::Id = 0;
template <typename T> bool any_isa(const Any &Value) { template <typename T> bool any_isa(const Any &Value) {
if (!Value.Storage) if (!Value.Storage)
return false; return false;
using U = return Value.Storage->id() ==
typename std::remove_cv<typename std::remove_reference<T>::type>::type; &Any::TypeId<std::remove_cv_t<std::remove_reference_t<T>>>::Id;
return Value.Storage->id() == &Any::TypeId<U>::Id;
} }
template <class T> T any_cast(const Any &Value) { template <class T> T any_cast(const Any &Value) {
using U = return static_cast<T>(
typename std::remove_cv<typename std::remove_reference<T>::type>::type; *any_cast<std::remove_cv_t<std::remove_reference_t<T>>>(&Value));
return static_cast<T>(*any_cast<U>(&Value));
} }
template <class T> T any_cast(Any &Value) { template <class T> T any_cast(Any &Value) {
using U = return static_cast<T>(
typename std::remove_cv<typename std::remove_reference<T>::type>::type; *any_cast<std::remove_cv_t<std::remove_reference_t<T>>>(&Value));
return static_cast<T>(*any_cast<U>(&Value));
} }
template <class T> T any_cast(Any &&Value) { template <class T> T any_cast(Any &&Value) {
using U = return static_cast<T>(std::move(
typename std::remove_cv<typename std::remove_reference<T>::type>::type; *any_cast<std::remove_cv_t<std::remove_reference_t<T>>>(&Value)));
return static_cast<T>(std::move(*any_cast<U>(&Value)));
} }
template <class T> const T *any_cast(const Any *Value) { template <class T> const T *any_cast(const Any *Value) {
using U = using U = std::remove_cv_t<std::remove_reference_t<T>>;
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
assert(Value && any_isa<T>(*Value) && "Bad any cast!"); assert(Value && any_isa<T>(*Value) && "Bad any cast!");
if (!Value || !any_isa<U>(*Value)) if (!Value || !any_isa<U>(*Value))
return nullptr; return nullptr;
@ -147,7 +142,7 @@ template <class T> const T *any_cast(const Any *Value) {
} }
template <class T> T *any_cast(Any *Value) { template <class T> T *any_cast(Any *Value) {
using U = typename std::decay<T>::type; using U = std::decay_t<T>;
assert(Value && any_isa<U>(*Value) && "Bad any cast!"); assert(Value && any_isa<U>(*Value) && "Bad any cast!");
if (!Value || !any_isa<U>(*Value)) if (!Value || !any_isa<U>(*Value))
return nullptr; return nullptr;

View File

@ -114,30 +114,28 @@ namespace llvm {
/// Construct an ArrayRef<const T*> from ArrayRef<T*>. This uses SFINAE to /// Construct an ArrayRef<const T*> from ArrayRef<T*>. This uses SFINAE to
/// ensure that only ArrayRefs of pointers can be converted. /// ensure that only ArrayRefs of pointers can be converted.
template <typename U> template <typename U>
ArrayRef( ArrayRef(const ArrayRef<U *> &A,
const ArrayRef<U *> &A, std::enable_if_t<std::is_convertible<U *const *, T const *>::value>
typename std::enable_if< * = nullptr)
std::is_convertible<U *const *, T const *>::value>::type * = nullptr) : Data(A.data()), Length(A.size()) {}
: Data(A.data()), Length(A.size()) {}
/// Construct an ArrayRef<const T*> from a SmallVector<T*>. This is /// Construct an ArrayRef<const T*> from a SmallVector<T*>. This is
/// templated in order to avoid instantiating SmallVectorTemplateCommon<T> /// templated in order to avoid instantiating SmallVectorTemplateCommon<T>
/// whenever we copy-construct an ArrayRef. /// whenever we copy-construct an ArrayRef.
template<typename U, typename DummyT> template <typename U, typename DummyT>
/*implicit*/ ArrayRef( /*implicit*/ ArrayRef(
const SmallVectorTemplateCommon<U *, DummyT> &Vec, const SmallVectorTemplateCommon<U *, DummyT> &Vec,
typename std::enable_if< std::enable_if_t<std::is_convertible<U *const *, T const *>::value> * =
std::is_convertible<U *const *, T const *>::value>::type * = nullptr) nullptr)
: Data(Vec.data()), Length(Vec.size()) { : Data(Vec.data()), Length(Vec.size()) {}
}
/// Construct an ArrayRef<const T*> from std::vector<T*>. This uses SFINAE /// Construct an ArrayRef<const T*> from std::vector<T*>. This uses SFINAE
/// to ensure that only vectors of pointers can be converted. /// to ensure that only vectors of pointers can be converted.
template<typename U, typename A> template <typename U, typename A>
ArrayRef(const std::vector<U *, A> &Vec, ArrayRef(const std::vector<U *, A> &Vec,
typename std::enable_if< std::enable_if_t<std::is_convertible<U *const *, T const *>::value>
std::is_convertible<U *const *, T const *>::value>::type* = 0) * = 0)
: Data(Vec.data()), Length(Vec.size()) {} : Data(Vec.data()), Length(Vec.size()) {}
/// @} /// @}
/// @name Simple Operations /// @name Simple Operations
@ -256,7 +254,7 @@ namespace llvm {
/// The declaration here is extra complicated so that "arrayRef = {}" /// The declaration here is extra complicated so that "arrayRef = {}"
/// continues to select the move assignment operator. /// continues to select the move assignment operator.
template <typename U> template <typename U>
typename std::enable_if<std::is_same<U, T>::value, ArrayRef<T>>::type & std::enable_if_t<std::is_same<U, T>::value, ArrayRef<T>> &
operator=(U &&Temporary) = delete; operator=(U &&Temporary) = delete;
/// Disallow accidental assignment from a temporary. /// Disallow accidental assignment from a temporary.
@ -264,7 +262,7 @@ namespace llvm {
/// The declaration here is extra complicated so that "arrayRef = {}" /// The declaration here is extra complicated so that "arrayRef = {}"
/// continues to select the move assignment operator. /// continues to select the move assignment operator.
template <typename U> template <typename U>
typename std::enable_if<std::is_same<U, T>::value, ArrayRef<T>>::type & std::enable_if_t<std::is_same<U, T>::value, ArrayRef<T>> &
operator=(std::initializer_list<U>) = delete; operator=(std::initializer_list<U>) = delete;
/// @} /// @}

View File

@ -71,49 +71,45 @@ struct is_bitmask_enum : std::false_type {};
template <typename E> template <typename E>
struct is_bitmask_enum< struct is_bitmask_enum<
E, typename std::enable_if<sizeof(E::LLVM_BITMASK_LARGEST_ENUMERATOR) >= E, std::enable_if_t<sizeof(E::LLVM_BITMASK_LARGEST_ENUMERATOR) >= 0>>
0>::type> : std::true_type {}; : std::true_type {};
namespace BitmaskEnumDetail { namespace BitmaskEnumDetail {
/// Get a bitmask with 1s in all places up to the high-order bit of E's largest /// Get a bitmask with 1s in all places up to the high-order bit of E's largest
/// value. /// value.
template <typename E> typename std::underlying_type<E>::type Mask() { template <typename E> std::underlying_type_t<E> Mask() {
// On overflow, NextPowerOf2 returns zero with the type uint64_t, so // On overflow, NextPowerOf2 returns zero with the type uint64_t, so
// subtracting 1 gives us the mask with all bits set, like we want. // subtracting 1 gives us the mask with all bits set, like we want.
return NextPowerOf2(static_cast<typename std::underlying_type<E>::type>( return NextPowerOf2(static_cast<std::underlying_type_t<E>>(
E::LLVM_BITMASK_LARGEST_ENUMERATOR)) - E::LLVM_BITMASK_LARGEST_ENUMERATOR)) -
1; 1;
} }
/// Check that Val is in range for E, and return Val cast to E's underlying /// Check that Val is in range for E, and return Val cast to E's underlying
/// type. /// type.
template <typename E> typename std::underlying_type<E>::type Underlying(E Val) { template <typename E> std::underlying_type_t<E> Underlying(E Val) {
auto U = static_cast<typename std::underlying_type<E>::type>(Val); auto U = static_cast<std::underlying_type_t<E>>(Val);
assert(U >= 0 && "Negative enum values are not allowed."); assert(U >= 0 && "Negative enum values are not allowed.");
assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)"); assert(U <= Mask<E>() && "Enum value too large (or largest val too small?)");
return U; return U;
} }
template <typename E, template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
E operator~(E Val) { E operator~(E Val) {
return static_cast<E>(~Underlying(Val) & Mask<E>()); return static_cast<E>(~Underlying(Val) & Mask<E>());
} }
template <typename E, template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
E operator|(E LHS, E RHS) { E operator|(E LHS, E RHS) {
return static_cast<E>(Underlying(LHS) | Underlying(RHS)); return static_cast<E>(Underlying(LHS) | Underlying(RHS));
} }
template <typename E, template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
E operator&(E LHS, E RHS) { E operator&(E LHS, E RHS) {
return static_cast<E>(Underlying(LHS) & Underlying(RHS)); return static_cast<E>(Underlying(LHS) & Underlying(RHS));
} }
template <typename E, template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
E operator^(E LHS, E RHS) { E operator^(E LHS, E RHS) {
return static_cast<E>(Underlying(LHS) ^ Underlying(RHS)); return static_cast<E>(Underlying(LHS) ^ Underlying(RHS));
} }
@ -121,22 +117,19 @@ E operator^(E LHS, E RHS) {
// |=, &=, and ^= return a reference to LHS, to match the behavior of the // |=, &=, and ^= return a reference to LHS, to match the behavior of the
// operators on builtin types. // operators on builtin types.
template <typename E, template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
E &operator|=(E &LHS, E RHS) { E &operator|=(E &LHS, E RHS) {
LHS = LHS | RHS; LHS = LHS | RHS;
return LHS; return LHS;
} }
template <typename E, template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
E &operator&=(E &LHS, E RHS) { E &operator&=(E &LHS, E RHS) {
LHS = LHS & RHS; LHS = LHS & RHS;
return LHS; return LHS;
} }
template <typename E, template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
typename = typename std::enable_if<is_bitmask_enum<E>::value>::type>
E &operator^=(E &LHS, E RHS) { E &operator^=(E &LHS, E RHS) {
LHS = LHS ^ RHS; LHS = LHS ^ RHS;
return LHS; return LHS;

View File

@ -1194,7 +1194,7 @@ public:
// for const iterator destinations so it doesn't end up as a user defined copy // for const iterator destinations so it doesn't end up as a user defined copy
// constructor. // constructor.
template <bool IsConstSrc, template <bool IsConstSrc,
typename = typename std::enable_if<!IsConstSrc && IsConst>::type> typename = std::enable_if_t<!IsConstSrc && IsConst>>
DenseMapIterator( DenseMapIterator(
const DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConstSrc> &I) const DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConstSrc> &I)
: DebugEpochBase::HandleBase(I), Ptr(I.Ptr), End(I.End) {} : DebugEpochBase::HandleBase(I), Ptr(I.Ptr), End(I.End) {}

View File

@ -101,8 +101,7 @@ public:
/// differing argument types even if they would implicit promote to a common /// differing argument types even if they would implicit promote to a common
/// type without changing the value. /// type without changing the value.
template <typename T> template <typename T>
typename std::enable_if<is_integral_or_enum<T>::value, hash_code>::type std::enable_if_t<is_integral_or_enum<T>::value, hash_code> hash_value(T value);
hash_value(T value);
/// Compute a hash_code for a pointer's address. /// Compute a hash_code for a pointer's address.
/// ///
@ -360,7 +359,7 @@ template <typename T, typename U> struct is_hashable_data<std::pair<T, U> >
/// Helper to get the hashable data representation for a type. /// Helper to get the hashable data representation for a type.
/// This variant is enabled when the type itself can be used. /// This variant is enabled when the type itself can be used.
template <typename T> template <typename T>
typename std::enable_if<is_hashable_data<T>::value, T>::type std::enable_if_t<is_hashable_data<T>::value, T>
get_hashable_data(const T &value) { get_hashable_data(const T &value) {
return value; return value;
} }
@ -368,7 +367,7 @@ get_hashable_data(const T &value) {
/// This variant is enabled when we must first call hash_value and use the /// This variant is enabled when we must first call hash_value and use the
/// result as our data. /// result as our data.
template <typename T> template <typename T>
typename std::enable_if<!is_hashable_data<T>::value, size_t>::type std::enable_if_t<!is_hashable_data<T>::value, size_t>
get_hashable_data(const T &value) { get_hashable_data(const T &value) {
using ::llvm::hash_value; using ::llvm::hash_value;
return hash_value(value); return hash_value(value);
@ -442,7 +441,7 @@ hash_code hash_combine_range_impl(InputIteratorT first, InputIteratorT last) {
/// are stored in contiguous memory, this routine avoids copying each value /// are stored in contiguous memory, this routine avoids copying each value
/// and directly reads from the underlying memory. /// and directly reads from the underlying memory.
template <typename ValueT> template <typename ValueT>
typename std::enable_if<is_hashable_data<ValueT>::value, hash_code>::type std::enable_if_t<is_hashable_data<ValueT>::value, hash_code>
hash_combine_range_impl(ValueT *first, ValueT *last) { hash_combine_range_impl(ValueT *first, ValueT *last) {
const uint64_t seed = get_execution_seed(); const uint64_t seed = get_execution_seed();
const char *s_begin = reinterpret_cast<const char *>(first); const char *s_begin = reinterpret_cast<const char *>(first);
@ -627,8 +626,7 @@ inline hash_code hash_integer_value(uint64_t value) {
// Declared and documented above, but defined here so that any of the hashing // Declared and documented above, but defined here so that any of the hashing
// infrastructure is available. // infrastructure is available.
template <typename T> template <typename T>
typename std::enable_if<is_integral_or_enum<T>::value, hash_code>::type std::enable_if_t<is_integral_or_enum<T>::value, hash_code> hash_value(T value) {
hash_value(T value) {
return ::llvm::hashing::detail::hash_integer_value( return ::llvm::hashing::detail::hash_integer_value(
static_cast<uint64_t>(value)); static_cast<uint64_t>(value));
} }

View File

@ -110,7 +110,7 @@ public:
/// Insert a sequence of new elements into the PriorityWorklist. /// Insert a sequence of new elements into the PriorityWorklist.
template <typename SequenceT> template <typename SequenceT>
typename std::enable_if<!std::is_convertible<SequenceT, T>::value>::type std::enable_if_t<!std::is_convertible<SequenceT, T>::value>
insert(SequenceT &&Input) { insert(SequenceT &&Input) {
if (std::begin(Input) == std::end(Input)) if (std::begin(Input) == std::end(Input))
// Nothing to do for an empty input sequence. // Nothing to do for an empty input sequence.

View File

@ -115,9 +115,8 @@ public:
template <typename Callable> template <typename Callable>
function_ref(Callable &&callable, function_ref(Callable &&callable,
typename std::enable_if< std::enable_if_t<!std::is_same<std::remove_reference_t<Callable>,
!std::is_same<typename std::remove_reference<Callable>::type, function_ref>::value> * = nullptr)
function_ref>::value>::type * = nullptr)
: callback(callback_fn<typename std::remove_reference<Callable>::type>), : callback(callback_fn<typename std::remove_reference<Callable>::type>),
callable(reinterpret_cast<intptr_t>(&callable)) {} callable(reinterpret_cast<intptr_t>(&callable)) {}
@ -254,9 +253,8 @@ struct has_rbegin : has_rbegin_impl<typename std::remove_reference<Ty>::type> {
// Returns an iterator_range over the given container which iterates in reverse. // 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. // Note that the container must have rbegin()/rend() methods for this to work.
template <typename ContainerTy> template <typename ContainerTy>
auto reverse( auto reverse(ContainerTy &&C,
ContainerTy &&C, std::enable_if_t<has_rbegin<ContainerTy>::value> * = nullptr) {
typename std::enable_if<has_rbegin<ContainerTy>::value>::type * = nullptr) {
return make_range(C.rbegin(), C.rend()); return make_range(C.rbegin(), C.rend());
} }
@ -271,8 +269,7 @@ std::reverse_iterator<IteratorTy> make_reverse_iterator(IteratorTy It) {
// bidirectional iterators for this to work. // bidirectional iterators for this to work.
template <typename ContainerTy> template <typename ContainerTy>
auto reverse(ContainerTy &&C, auto reverse(ContainerTy &&C,
typename std::enable_if<!has_rbegin<ContainerTy>::value>::type * = std::enable_if_t<!has_rbegin<ContainerTy>::value> * = nullptr) {
nullptr) {
return make_range(llvm::make_reverse_iterator(std::end(C)), return make_range(llvm::make_reverse_iterator(std::end(C)),
llvm::make_reverse_iterator(std::begin(C))); llvm::make_reverse_iterator(std::begin(C)));
} }
@ -1148,11 +1145,11 @@ void DeleteContainerSeconds(Container &C) {
/// Get the size of a range. This is a wrapper function around std::distance /// Get the size of a range. This is a wrapper function around std::distance
/// which is only enabled when the operation is O(1). /// which is only enabled when the operation is O(1).
template <typename R> template <typename R>
auto size(R &&Range, typename std::enable_if< auto size(R &&Range,
std::is_same<typename std::iterator_traits<decltype( std::enable_if_t<std::is_same<typename std::iterator_traits<decltype(
Range.begin())>::iterator_category, Range.begin())>::iterator_category,
std::random_access_iterator_tag>::value, std::random_access_iterator_tag>::value,
void>::type * = nullptr) { void> * = nullptr) {
return std::distance(Range.begin(), Range.end()); return std::distance(Range.begin(), Range.end());
} }
@ -1516,12 +1513,11 @@ decltype(auto) apply_tuple(F &&f, Tuple &&t) {
template <typename IterTy> template <typename IterTy>
bool hasNItems( bool hasNItems(
IterTy &&Begin, IterTy &&End, unsigned N, IterTy &&Begin, IterTy &&End, unsigned N,
typename std::enable_if< std::enable_if_t<
!std::is_same< !std::is_same<typename std::iterator_traits<std::remove_reference_t<
typename std::iterator_traits<typename std::remove_reference< decltype(Begin)>>::iterator_category,
decltype(Begin)>::type>::iterator_category, std::random_access_iterator_tag>::value,
std::random_access_iterator_tag>::value, void> * = nullptr) {
void>::type * = nullptr) {
for (; N; --N, ++Begin) for (; N; --N, ++Begin)
if (Begin == End) if (Begin == End)
return false; // Too few. return false; // Too few.
@ -1533,12 +1529,11 @@ bool hasNItems(
template <typename IterTy> template <typename IterTy>
bool hasNItemsOrMore( bool hasNItemsOrMore(
IterTy &&Begin, IterTy &&End, unsigned N, IterTy &&Begin, IterTy &&End, unsigned N,
typename std::enable_if< std::enable_if_t<
!std::is_same< !std::is_same<typename std::iterator_traits<std::remove_reference_t<
typename std::iterator_traits<typename std::remove_reference< decltype(Begin)>>::iterator_category,
decltype(Begin)>::type>::iterator_category, std::random_access_iterator_tag>::value,
std::random_access_iterator_tag>::value, void> * = nullptr) {
void>::type * = nullptr) {
for (; N; --N, ++Begin) for (; N; --N, ++Begin)
if (Begin == End) if (Begin == End)
return false; // Too few. return false; // Too few.

View File

@ -284,8 +284,8 @@ protected:
template <typename T1, typename T2> template <typename T1, typename T2>
static void uninitialized_copy( static void uninitialized_copy(
T1 *I, T1 *E, T2 *Dest, T1 *I, T1 *E, T2 *Dest,
typename std::enable_if<std::is_same<typename std::remove_const<T1>::type, std::enable_if_t<std::is_same<typename std::remove_const<T1>::type,
T2>::value>::type * = nullptr) { T2>::value> * = nullptr) {
// Use memcpy for PODs iterated by pointers (which includes SmallVector // Use memcpy for PODs iterated by pointers (which includes SmallVector
// iterators): std::uninitialized_copy optimizes to memmove, but we can // iterators): std::uninitialized_copy optimizes to memmove, but we can
// use memcpy here. Note that I and E are iterators and thus might be // use memcpy here. Note that I and E are iterators and thus might be
@ -381,9 +381,9 @@ public:
/// Add the specified range to the end of the SmallVector. /// Add the specified range to the end of the SmallVector.
template <typename in_iter, template <typename in_iter,
typename = typename std::enable_if<std::is_convertible< typename = std::enable_if_t<std::is_convertible<
typename std::iterator_traits<in_iter>::iterator_category, typename std::iterator_traits<in_iter>::iterator_category,
std::input_iterator_tag>::value>::type> std::input_iterator_tag>::value>>
void append(in_iter in_start, in_iter in_end) { void append(in_iter in_start, in_iter in_end) {
size_type NumInputs = std::distance(in_start, in_end); size_type NumInputs = std::distance(in_start, in_end);
if (NumInputs > this->capacity() - this->size()) if (NumInputs > this->capacity() - this->size())
@ -418,9 +418,9 @@ public:
} }
template <typename in_iter, template <typename in_iter,
typename = typename std::enable_if<std::is_convertible< typename = std::enable_if_t<std::is_convertible<
typename std::iterator_traits<in_iter>::iterator_category, typename std::iterator_traits<in_iter>::iterator_category,
std::input_iterator_tag>::value>::type> std::input_iterator_tag>::value>>
void assign(in_iter in_start, in_iter in_end) { void assign(in_iter in_start, in_iter in_end) {
clear(); clear();
append(in_start, in_end); append(in_start, in_end);
@ -575,9 +575,9 @@ public:
} }
template <typename ItTy, template <typename ItTy,
typename = typename std::enable_if<std::is_convertible< typename = std::enable_if_t<std::is_convertible<
typename std::iterator_traits<ItTy>::iterator_category, typename std::iterator_traits<ItTy>::iterator_category,
std::input_iterator_tag>::value>::type> std::input_iterator_tag>::value>>
iterator insert(iterator I, ItTy From, ItTy To) { iterator insert(iterator I, ItTy From, ItTy To) {
// Convert iterator to elt# to avoid invalidating iterator when we reserve() // Convert iterator to elt# to avoid invalidating iterator when we reserve()
size_t InsertElt = I - this->begin(); size_t InsertElt = I - this->begin();
@ -849,9 +849,9 @@ public:
} }
template <typename ItTy, template <typename ItTy,
typename = typename std::enable_if<std::is_convertible< typename = std::enable_if_t<std::is_convertible<
typename std::iterator_traits<ItTy>::iterator_category, typename std::iterator_traits<ItTy>::iterator_category,
std::input_iterator_tag>::value>::type> std::input_iterator_tag>::value>>
SmallVector(ItTy S, ItTy E) : SmallVectorImpl<T>(N) { SmallVector(ItTy S, ItTy E) : SmallVectorImpl<T>(N) {
this->append(S, E); this->append(S, E);
} }

View File

@ -265,8 +265,7 @@ namespace llvm {
/// The declaration here is extra complicated so that `stringRef = {}` /// The declaration here is extra complicated so that `stringRef = {}`
/// and `stringRef = "abc"` continue to select the move assignment operator. /// and `stringRef = "abc"` continue to select the move assignment operator.
template <typename T> template <typename T>
typename std::enable_if<std::is_same<T, std::string>::value, std::enable_if_t<std::is_same<T, std::string>::value, StringRef> &
StringRef>::type &
operator=(T &&Str) = delete; operator=(T &&Str) = delete;
/// @} /// @}
@ -508,7 +507,7 @@ namespace llvm {
/// this returns true to signify the error. The string is considered /// this returns true to signify the error. The string is considered
/// erroneous if empty or if it overflows T. /// erroneous if empty or if it overflows T.
template <typename T> template <typename T>
typename std::enable_if<std::numeric_limits<T>::is_signed, bool>::type std::enable_if_t<std::numeric_limits<T>::is_signed, bool>
getAsInteger(unsigned Radix, T &Result) const { getAsInteger(unsigned Radix, T &Result) const {
long long LLVal; long long LLVal;
if (getAsSignedInteger(*this, Radix, LLVal) || if (getAsSignedInteger(*this, Radix, LLVal) ||
@ -519,7 +518,7 @@ namespace llvm {
} }
template <typename T> template <typename T>
typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type std::enable_if_t<!std::numeric_limits<T>::is_signed, bool>
getAsInteger(unsigned Radix, T &Result) const { getAsInteger(unsigned Radix, T &Result) const {
unsigned long long ULLVal; unsigned long long ULLVal;
// The additional cast to unsigned long long is required to avoid the // The additional cast to unsigned long long is required to avoid the
@ -542,7 +541,7 @@ namespace llvm {
/// The portion of the string representing the discovered numeric value /// The portion of the string representing the discovered numeric value
/// is removed from the beginning of the string. /// is removed from the beginning of the string.
template <typename T> template <typename T>
typename std::enable_if<std::numeric_limits<T>::is_signed, bool>::type std::enable_if_t<std::numeric_limits<T>::is_signed, bool>
consumeInteger(unsigned Radix, T &Result) { consumeInteger(unsigned Radix, T &Result) {
long long LLVal; long long LLVal;
if (consumeSignedInteger(*this, Radix, LLVal) || if (consumeSignedInteger(*this, Radix, LLVal) ||
@ -553,7 +552,7 @@ namespace llvm {
} }
template <typename T> template <typename T>
typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type std::enable_if_t<!std::numeric_limits<T>::is_signed, bool>
consumeInteger(unsigned Radix, T &Result) { consumeInteger(unsigned Radix, T &Result) {
unsigned long long ULLVal; unsigned long long ULLVal;
if (consumeUnsignedInteger(*this, Radix, ULLVal) || if (consumeUnsignedInteger(*this, Radix, ULLVal) ||

View File

@ -152,10 +152,10 @@ public:
} }
// Implicit conversion to ArrayRef<U> if EltTy* implicitly converts to U*. // Implicit conversion to ArrayRef<U> if EltTy* implicitly converts to U*.
template<typename U, template <
typename std::enable_if< typename U,
std::is_convertible<ArrayRef<EltTy>, ArrayRef<U>>::value, std::enable_if_t<std::is_convertible<ArrayRef<EltTy>, ArrayRef<U>>::value,
bool>::type = false> bool> = false>
operator ArrayRef<U>() const { operator ArrayRef<U>() const {
return operator ArrayRef<EltTy>(); return operator ArrayRef<EltTy>();
} }

View File

@ -88,15 +88,14 @@ public:
// This is templated so that we can allow constructing a const iterator from // This is templated so that we can allow constructing a const iterator from
// a nonconst iterator... // a nonconst iterator...
template <bool RHSIsConst> template <bool RHSIsConst>
ilist_iterator( ilist_iterator(const ilist_iterator<OptionsT, IsReverse, RHSIsConst> &RHS,
const ilist_iterator<OptionsT, IsReverse, RHSIsConst> &RHS, std::enable_if_t<IsConst || !RHSIsConst, void *> = nullptr)
typename std::enable_if<IsConst || !RHSIsConst, void *>::type = nullptr)
: NodePtr(RHS.NodePtr) {} : NodePtr(RHS.NodePtr) {}
// This is templated so that we can allow assigning to a const iterator from // This is templated so that we can allow assigning to a const iterator from
// a nonconst iterator... // a nonconst iterator...
template <bool RHSIsConst> template <bool RHSIsConst>
typename std::enable_if<IsConst || !RHSIsConst, ilist_iterator &>::type std::enable_if_t<IsConst || !RHSIsConst, ilist_iterator &>
operator=(const ilist_iterator<OptionsT, IsReverse, RHSIsConst> &RHS) { operator=(const ilist_iterator<OptionsT, IsReverse, RHSIsConst> &RHS) {
NodePtr = RHS.NodePtr; NodePtr = RHS.NodePtr;
return *this; return *this;

View File

@ -194,14 +194,14 @@ template <
typename T = typename std::iterator_traits<WrappedIteratorT>::value_type, typename T = typename std::iterator_traits<WrappedIteratorT>::value_type,
typename DifferenceTypeT = typename DifferenceTypeT =
typename std::iterator_traits<WrappedIteratorT>::difference_type, typename std::iterator_traits<WrappedIteratorT>::difference_type,
typename PointerT = typename std::conditional< typename PointerT = std::conditional_t<
std::is_same<T, typename std::iterator_traits< std::is_same<T, typename std::iterator_traits<
WrappedIteratorT>::value_type>::value, WrappedIteratorT>::value_type>::value,
typename std::iterator_traits<WrappedIteratorT>::pointer, T *>::type, typename std::iterator_traits<WrappedIteratorT>::pointer, T *>,
typename ReferenceT = typename std::conditional< typename ReferenceT = std::conditional_t<
std::is_same<T, typename std::iterator_traits< std::is_same<T, typename std::iterator_traits<
WrappedIteratorT>::value_type>::value, WrappedIteratorT>::value_type>::value,
typename std::iterator_traits<WrappedIteratorT>::reference, T &>::type> typename std::iterator_traits<WrappedIteratorT>::reference, T &>>
class iterator_adaptor_base class iterator_adaptor_base
: public iterator_facade_base<DerivedT, IteratorCategoryT, T, : public iterator_facade_base<DerivedT, IteratorCategoryT, T,
DifferenceTypeT, PointerT, ReferenceT> { DifferenceTypeT, PointerT, ReferenceT> {
@ -281,8 +281,8 @@ public:
/// using iterator = pointee_iterator<SmallVectorImpl<T *>::iterator>; /// using iterator = pointee_iterator<SmallVectorImpl<T *>::iterator>;
/// \endcode /// \endcode
template <typename WrappedIteratorT, template <typename WrappedIteratorT,
typename T = typename std::remove_reference< typename T = std::remove_reference_t<decltype(
decltype(**std::declval<WrappedIteratorT>())>::type> **std::declval<WrappedIteratorT>())>>
struct pointee_iterator struct pointee_iterator
: iterator_adaptor_base< : iterator_adaptor_base<
pointee_iterator<WrappedIteratorT, T>, WrappedIteratorT, pointee_iterator<WrappedIteratorT, T>, WrappedIteratorT,
@ -334,9 +334,11 @@ make_pointer_range(RangeT &&Range) {
} }
template <typename WrappedIteratorT, template <typename WrappedIteratorT,
typename T1 = typename std::remove_reference<decltype(**std::declval<WrappedIteratorT>())>::type, typename T1 = std::remove_reference_t<decltype(
typename T2 = typename std::add_pointer<T1>::type> **std::declval<WrappedIteratorT>())>,
using raw_pointer_iterator = pointer_iterator<pointee_iterator<WrappedIteratorT, T1>, T2>; typename T2 = std::add_pointer_t<T1>>
using raw_pointer_iterator =
pointer_iterator<pointee_iterator<WrappedIteratorT, T1>, T2>;
// Wrapper iterator over iterator ItType, adding DataRef to the type of ItType, // Wrapper iterator over iterator ItType, adding DataRef to the type of ItType,
// to create NodeRef = std::pair<InnerTypeOfItType, DataRef>. // to create NodeRef = std::pair<InnerTypeOfItType, DataRef>.

View File

@ -574,10 +574,9 @@ public:
template <bool IsConst> template <bool IsConst>
class block_iterator_wrapper class block_iterator_wrapper
: public df_iterator< : public df_iterator<
typename std::conditional<IsConst, const BlockT, BlockT>::type *> { std::conditional_t<IsConst, const BlockT, BlockT> *> {
using super = using super =
df_iterator< df_iterator<std::conditional_t<IsConst, const BlockT, BlockT> *>;
typename std::conditional<IsConst, const BlockT, BlockT>::type *>;
public: public:
using Self = block_iterator_wrapper<IsConst>; using Self = block_iterator_wrapper<IsConst>;

View File

@ -724,7 +724,7 @@ void RegionInfoBase<Tr>::findRegionsWithEntry(BlockT *entry,
template <class Tr> template <class Tr>
void RegionInfoBase<Tr>::scanForRegions(FuncT &F, BBtoBBMap *ShortCut) { void RegionInfoBase<Tr>::scanForRegions(FuncT &F, BBtoBBMap *ShortCut) {
using FuncPtrT = typename std::add_pointer<FuncT>::type; using FuncPtrT = std::add_pointer_t<FuncT>;
BlockT *entry = GraphTraits<FuncPtrT>::getEntryNode(&F); BlockT *entry = GraphTraits<FuncPtrT>::getEntryNode(&F);
DomTreeNodeT *N = DT->getNode(entry); DomTreeNodeT *N = DT->getNode(entry);
@ -912,7 +912,7 @@ RegionInfoBase<Tr>::getCommonRegion(SmallVectorImpl<BlockT *> &BBs) const {
template <class Tr> template <class Tr>
void RegionInfoBase<Tr>::calculate(FuncT &F) { void RegionInfoBase<Tr>::calculate(FuncT &F) {
using FuncPtrT = typename std::add_pointer<FuncT>::type; using FuncPtrT = std::add_pointer_t<FuncT>;
// ShortCut a function where for every BB the exit of the largest region // 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. // starting with BB is stored. These regions can be threated as single BBS.

View File

@ -672,8 +672,7 @@ template <> struct EnumTraits<LineNumberOps> : public std::true_type {
/// dumping functions above, these format unknown enumerator values as /// dumping functions above, these format unknown enumerator values as
/// DW_TYPE_unknown_1234 (e.g. DW_TAG_unknown_ffff). /// DW_TYPE_unknown_1234 (e.g. DW_TAG_unknown_ffff).
template <typename Enum> template <typename Enum>
struct format_provider< struct format_provider<Enum, std::enable_if_t<dwarf::EnumTraits<Enum>::value>> {
Enum, typename std::enable_if<dwarf::EnumTraits<Enum>::value>::type> {
static void format(const Enum &E, raw_ostream &OS, StringRef Style) { static void format(const Enum &E, raw_ostream &OS, StringRef Style) {
StringRef Str = dwarf::EnumTraits<Enum>::StringFn(E); StringRef Str = dwarf::EnumTraits<Enum>::StringFn(E);
if (Str.empty()) { if (Str.empty()) {

View File

@ -625,11 +625,12 @@ namespace llvm {
// if the Seg is lower find first segment that is above Idx using binary // if the Seg is lower find first segment that is above Idx using binary
// search // search
if (Seg->end <= *Idx) { if (Seg->end <= *Idx) {
Seg = std::upper_bound(++Seg, EndSeg, *Idx, Seg = std::upper_bound(
[=](typename std::remove_reference<decltype(*Idx)>::type V, ++Seg, EndSeg, *Idx,
const typename std::remove_reference<decltype(*Seg)>::type &S) { [=](std::remove_reference_t<decltype(*Idx)> V,
return V < S.end; const std::remove_reference_t<decltype(*Seg)> &S) {
}); return V < S.end;
});
if (Seg == EndSeg) if (Seg == EndSeg)
break; break;
} }

View File

@ -152,8 +152,8 @@ public:
template <class OtherTy> template <class OtherTy>
MachineInstrBundleIterator( MachineInstrBundleIterator(
const MachineInstrBundleIterator<OtherTy, IsReverse> &I, const MachineInstrBundleIterator<OtherTy, IsReverse> &I,
typename std::enable_if<std::is_convertible<OtherTy *, Ty *>::value, std::enable_if_t<std::is_convertible<OtherTy *, Ty *>::value, void *> =
void *>::type = nullptr) nullptr)
: MII(I.getInstrIterator()) {} : MII(I.getInstrIterator()) {}
MachineInstrBundleIterator() : MII(nullptr) {} MachineInstrBundleIterator() : MII(nullptr) {}

View File

@ -114,7 +114,7 @@ public:
if (!isStreaming() && sizeof(Value) > maxFieldLength()) if (!isStreaming() && sizeof(Value) > maxFieldLength())
return make_error<CodeViewError>(cv_error_code::insufficient_buffer); return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
using U = typename std::underlying_type<T>::type; using U = std::underlying_type_t<T>;
U X; U X;
if (isWriting() || isStreaming()) if (isWriting() || isStreaming())

View File

@ -58,10 +58,9 @@ template <typename T> T jitTargetAddressToPointer(JITTargetAddress Addr) {
/// Casts the given address to a callable function pointer. This operation /// Casts the given address to a callable function pointer. This operation
/// will perform pointer signing for platforms that require it (e.g. arm64e). /// will perform pointer signing for platforms that require it (e.g. arm64e).
template <typename T> T jitTargetAddressToFunction(JITTargetAddress Addr) { template <typename T> T jitTargetAddressToFunction(JITTargetAddress Addr) {
static_assert( static_assert(std::is_pointer<T>::value &&
std::is_pointer<T>::value && std::is_function<std::remove_pointer_t<T>>::value,
std::is_function<typename std::remove_pointer<T>::type>::value, "T must be a function pointer type");
"T must be a function pointer type");
return jitTargetAddressToPointer<T>(Addr); return jitTargetAddressToPointer<T>(Addr);
} }

View File

@ -202,10 +202,10 @@ public:
/// If Body returns true then the element just passed in is removed from the /// If Body returns true then the element just passed in is removed from the
/// set. If Body returns false then the element is retained. /// set. If Body returns false then the element is retained.
template <typename BodyFn> template <typename BodyFn>
auto forEachWithRemoval(BodyFn &&Body) -> typename std::enable_if< auto forEachWithRemoval(BodyFn &&Body) -> std::enable_if_t<
std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(), std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
std::declval<SymbolLookupFlags>())), std::declval<SymbolLookupFlags>())),
bool>::value>::type { bool>::value> {
UnderlyingVector::size_type I = 0; UnderlyingVector::size_type I = 0;
while (I != Symbols.size()) { while (I != Symbols.size()) {
const auto &Name = Symbols[I].first; const auto &Name = Symbols[I].first;
@ -224,11 +224,11 @@ public:
/// returns true then the element just passed in is removed from the set. If /// returns true then the element just passed in is removed from the set. If
/// Body returns false then the element is retained. /// Body returns false then the element is retained.
template <typename BodyFn> template <typename BodyFn>
auto forEachWithRemoval(BodyFn &&Body) -> typename std::enable_if< auto forEachWithRemoval(BodyFn &&Body) -> std::enable_if_t<
std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(), std::is_same<decltype(Body(std::declval<const SymbolStringPtr &>(),
std::declval<SymbolLookupFlags>())), std::declval<SymbolLookupFlags>())),
Expected<bool>>::value, Expected<bool>>::value,
Error>::type { Error> {
UnderlyingVector::size_type I = 0; UnderlyingVector::size_type I = 0;
while (I != Symbols.size()) { while (I != Symbols.size()) {
const auto &Name = Symbols[I].first; const auto &Name = Symbols[I].first;

View File

@ -73,17 +73,13 @@ private:
/// function objects. /// function objects.
template <typename GetResponsibilitySetFn, typename LookupFn> template <typename GetResponsibilitySetFn, typename LookupFn>
std::unique_ptr<LambdaSymbolResolver< std::unique_ptr<LambdaSymbolResolver<
typename std::remove_cv< std::remove_cv_t<std::remove_reference_t<GetResponsibilitySetFn>>,
typename std::remove_reference<GetResponsibilitySetFn>::type>::type, std::remove_cv_t<std::remove_reference_t<LookupFn>>>>
typename std::remove_cv<
typename std::remove_reference<LookupFn>::type>::type>>
createSymbolResolver(GetResponsibilitySetFn &&GetResponsibilitySet, createSymbolResolver(GetResponsibilitySetFn &&GetResponsibilitySet,
LookupFn &&Lookup) { LookupFn &&Lookup) {
using LambdaSymbolResolverImpl = LambdaSymbolResolver< using LambdaSymbolResolverImpl = LambdaSymbolResolver<
typename std::remove_cv< std::remove_cv_t<std::remove_reference_t<GetResponsibilitySetFn>>,
typename std::remove_reference<GetResponsibilitySetFn>::type>::type, std::remove_cv_t<std::remove_reference_t<LookupFn>>>;
typename std::remove_cv<
typename std::remove_reference<LookupFn>::type>::type>;
return std::make_unique<LambdaSymbolResolverImpl>( return std::make_unique<LambdaSymbolResolverImpl>(
std::forward<GetResponsibilitySetFn>(GetResponsibilitySet), std::forward<GetResponsibilitySetFn>(GetResponsibilitySet),
std::forward<LookupFn>(Lookup)); std::forward<LookupFn>(Lookup));

View File

@ -108,8 +108,7 @@ public:
template <typename ChannelT> template <typename ChannelT>
class SerializationTraits< class SerializationTraits<
ChannelT, remote::DirectBufferWriter, remote::DirectBufferWriter, ChannelT, remote::DirectBufferWriter, remote::DirectBufferWriter,
typename std::enable_if< std::enable_if_t<std::is_base_of<RawByteChannel, ChannelT>::value>> {
std::is_base_of<RawByteChannel, ChannelT>::value>::type> {
public: public:
static Error serialize(ChannelT &C, const remote::DirectBufferWriter &DBW) { static Error serialize(ChannelT &C, const remote::DirectBufferWriter &DBW) {
if (auto EC = serializeSeq(C, DBW.getDst())) if (auto EC = serializeSeq(C, DBW.getDst()))

View File

@ -60,7 +60,7 @@ public:
SymbolLookup(std::move(SymbolLookup)), SymbolLookup(std::move(SymbolLookup)),
EHFramesRegister(std::move(EHFramesRegister)), EHFramesRegister(std::move(EHFramesRegister)),
EHFramesDeregister(std::move(EHFramesDeregister)) { EHFramesDeregister(std::move(EHFramesDeregister)) {
using ThisT = typename std::remove_reference<decltype(*this)>::type; using ThisT = std::remove_reference_t<decltype(*this)>;
addHandler<exec::CallIntVoid>(*this, &ThisT::handleCallIntVoid); addHandler<exec::CallIntVoid>(*this, &ThisT::handleCallIntVoid);
addHandler<exec::CallMain>(*this, &ThisT::handleCallMain); addHandler<exec::CallMain>(*this, &ThisT::handleCallMain);
addHandler<exec::CallVoidVoid>(*this, &ThisT::handleCallVoidVoid); addHandler<exec::CallVoidVoid>(*this, &ThisT::handleCallVoidVoid);

View File

@ -230,9 +230,9 @@ public:
/// ///
/// template <DerivedChannelT> /// template <DerivedChannelT>
/// class SerializationTraits<DerivedChannelT, bool, /// class SerializationTraits<DerivedChannelT, bool,
/// typename std::enable_if< /// std::enable_if_t<
/// std::is_base_of<VirtChannel, DerivedChannel>::value /// std::is_base_of<VirtChannel, DerivedChannel>::value
/// >::type> { /// >> {
/// public: /// public:
/// static const char* getName() { ... }; /// static const char* getName() { ... };
/// } /// }
@ -274,9 +274,8 @@ public:
template <typename CArgT> template <typename CArgT>
static Error serialize(ChannelT &C, CArgT &&CArg) { static Error serialize(ChannelT &C, CArgT &&CArg) {
return SerializationTraits<ChannelT, ArgT, return SerializationTraits<ChannelT, ArgT, std::decay_t<CArgT>>::serialize(
typename std::decay<CArgT>::type>:: C, std::forward<CArgT>(CArg));
serialize(C, std::forward<CArgT>(CArg));
} }
template <typename CArgT> template <typename CArgT>
@ -293,8 +292,8 @@ public:
static Error serialize(ChannelT &C, CArgT &&CArg, static Error serialize(ChannelT &C, CArgT &&CArg,
CArgTs &&... CArgs) { CArgTs &&... CArgs) {
if (auto Err = if (auto Err =
SerializationTraits<ChannelT, ArgT, typename std::decay<CArgT>::type>:: SerializationTraits<ChannelT, ArgT, std::decay_t<CArgT>>::serialize(
serialize(C, std::forward<CArgT>(CArg))) C, std::forward<CArgT>(CArg)))
return Err; return Err;
if (auto Err = SequenceTraits<ChannelT>::emitSeparator(C)) if (auto Err = SequenceTraits<ChannelT>::emitSeparator(C))
return Err; return Err;
@ -316,8 +315,8 @@ public:
template <typename ChannelT, typename... ArgTs> template <typename ChannelT, typename... ArgTs>
Error serializeSeq(ChannelT &C, ArgTs &&... Args) { Error serializeSeq(ChannelT &C, ArgTs &&... Args) {
return SequenceSerialization<ChannelT, typename std::decay<ArgTs>::type...>:: return SequenceSerialization<ChannelT, std::decay_t<ArgTs>...>::serialize(
serialize(C, std::forward<ArgTs>(Args)...); C, std::forward<ArgTs>(Args)...);
} }
template <typename ChannelT, typename... ArgTs> template <typename ChannelT, typename... ArgTs>

View File

@ -184,8 +184,7 @@ template <typename T, typename = void> class RPCFunctionIdAllocator;
/// This specialization of RPCFunctionIdAllocator provides a default /// This specialization of RPCFunctionIdAllocator provides a default
/// implementation for integral types. /// implementation for integral types.
template <typename T> template <typename T>
class RPCFunctionIdAllocator< class RPCFunctionIdAllocator<T, std::enable_if_t<std::is_integral<T>::value>> {
T, typename std::enable_if<std::is_integral<T>::value>::type> {
public: public:
static T getInvalidId() { return T(0); } static T getInvalidId() { return T(0); }
static T getResponseId() { return T(1); } static T getResponseId() { return T(1); }
@ -205,8 +204,7 @@ template <typename T> class FunctionArgsTuple;
template <typename RetT, typename... ArgTs> template <typename RetT, typename... ArgTs>
class FunctionArgsTuple<RetT(ArgTs...)> { class FunctionArgsTuple<RetT(ArgTs...)> {
public: public:
using Type = std::tuple<typename std::decay< using Type = std::tuple<std::decay_t<std::remove_reference_t<ArgTs>>...>;
typename std::remove_reference<ArgTs>::type>::type...>;
}; };
// ResultTraits provides typedefs and utilities specific to the return type // ResultTraits provides typedefs and utilities specific to the return type
@ -483,9 +481,9 @@ public:
}; };
template <typename ResponseHandlerT, typename... ArgTs> template <typename ResponseHandlerT, typename... ArgTs>
class AsyncHandlerTraits<Error(ResponseHandlerT, ArgTs...)> : class AsyncHandlerTraits<Error(ResponseHandlerT, ArgTs...)>
public AsyncHandlerTraits<Error(typename std::decay<ResponseHandlerT>::type, : public AsyncHandlerTraits<Error(std::decay_t<ResponseHandlerT>,
ArgTs...)> {}; ArgTs...)> {};
// This template class provides utilities related to RPC function handlers. // This template class provides utilities related to RPC function handlers.
// The base case applies to non-function types (the template class is // The base case applies to non-function types (the template class is
@ -524,18 +522,17 @@ public:
// Call the given handler with the given arguments. // Call the given handler with the given arguments.
template <typename HandlerT> template <typename HandlerT>
static typename std::enable_if< static std::enable_if_t<
std::is_void<typename HandlerTraits<HandlerT>::ReturnType>::value, std::is_void<typename HandlerTraits<HandlerT>::ReturnType>::value, Error>
Error>::type
run(HandlerT &Handler, ArgTs &&... Args) { run(HandlerT &Handler, ArgTs &&... Args) {
Handler(std::move(Args)...); Handler(std::move(Args)...);
return Error::success(); return Error::success();
} }
template <typename HandlerT, typename... TArgTs> template <typename HandlerT, typename... TArgTs>
static typename std::enable_if< static std::enable_if_t<
!std::is_void<typename HandlerTraits<HandlerT>::ReturnType>::value, !std::is_void<typename HandlerTraits<HandlerT>::ReturnType>::value,
typename HandlerTraits<HandlerT>::ReturnType>::type typename HandlerTraits<HandlerT>::ReturnType>
run(HandlerT &Handler, TArgTs... Args) { run(HandlerT &Handler, TArgTs... Args) {
return Handler(std::move(Args)...); return Handler(std::move(Args)...);
} }
@ -894,12 +891,12 @@ private:
using S = SerializationTraits<ChannelT, WireT, ConcreteT>; using S = SerializationTraits<ChannelT, WireT, ConcreteT>;
template <typename T> template <typename T>
static std::true_type static std::true_type check(
check(typename std::enable_if< std::enable_if_t<std::is_same<decltype(T::serialize(
std::is_same<decltype(T::serialize(std::declval<ChannelT &>(), std::declval<ChannelT &>(),
std::declval<const ConcreteT &>())), std::declval<const ConcreteT &>())),
Error>::value, Error>::value,
void *>::type); void *>);
template <typename> static std::false_type check(...); template <typename> static std::false_type check(...);
@ -914,11 +911,11 @@ private:
template <typename T> template <typename T>
static std::true_type static std::true_type
check(typename std::enable_if< check(std::enable_if_t<
std::is_same<decltype(T::deserialize(std::declval<ChannelT &>(), std::is_same<decltype(T::deserialize(std::declval<ChannelT &>(),
std::declval<ConcreteT &>())), std::declval<ConcreteT &>())),
Error>::value, Error>::value,
void *>::type); void *>);
template <typename> static std::false_type check(...); template <typename> static std::false_type check(...);

View File

@ -87,13 +87,13 @@ private:
template <typename ChannelT, typename T> template <typename ChannelT, typename T>
class SerializationTraits< class SerializationTraits<
ChannelT, T, T, ChannelT, T, T,
typename std::enable_if< std::enable_if_t<
std::is_base_of<RawByteChannel, ChannelT>::value && std::is_base_of<RawByteChannel, ChannelT>::value &&
(std::is_same<T, uint8_t>::value || std::is_same<T, int8_t>::value || (std::is_same<T, uint8_t>::value || std::is_same<T, int8_t>::value ||
std::is_same<T, uint16_t>::value || std::is_same<T, int16_t>::value || std::is_same<T, uint16_t>::value || std::is_same<T, int16_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, int32_t>::value || std::is_same<T, uint32_t>::value || std::is_same<T, int32_t>::value ||
std::is_same<T, uint64_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, uint64_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, char>::value)>::type> { std::is_same<T, char>::value)>> {
public: public:
static Error serialize(ChannelT &C, T V) { static Error serialize(ChannelT &C, T V) {
support::endian::byte_swap<T, support::big>(V); support::endian::byte_swap<T, support::big>(V);
@ -109,9 +109,9 @@ public:
}; };
template <typename ChannelT> template <typename ChannelT>
class SerializationTraits<ChannelT, bool, bool, class SerializationTraits<
typename std::enable_if<std::is_base_of< ChannelT, bool, bool,
RawByteChannel, ChannelT>::value>::type> { std::enable_if_t<std::is_base_of<RawByteChannel, ChannelT>::value>> {
public: public:
static Error serialize(ChannelT &C, bool V) { static Error serialize(ChannelT &C, bool V) {
uint8_t Tmp = V ? 1 : 0; uint8_t Tmp = V ? 1 : 0;
@ -131,9 +131,9 @@ public:
}; };
template <typename ChannelT> template <typename ChannelT>
class SerializationTraits<ChannelT, std::string, StringRef, class SerializationTraits<
typename std::enable_if<std::is_base_of< ChannelT, std::string, StringRef,
RawByteChannel, ChannelT>::value>::type> { std::enable_if_t<std::is_base_of<RawByteChannel, ChannelT>::value>> {
public: public:
/// RPC channel serialization for std::strings. /// RPC channel serialization for std::strings.
static Error serialize(RawByteChannel &C, StringRef S) { static Error serialize(RawByteChannel &C, StringRef S) {
@ -144,11 +144,11 @@ public:
}; };
template <typename ChannelT, typename T> template <typename ChannelT, typename T>
class SerializationTraits<ChannelT, std::string, T, class SerializationTraits<
typename std::enable_if< ChannelT, std::string, T,
std::is_base_of<RawByteChannel, ChannelT>::value && std::enable_if_t<std::is_base_of<RawByteChannel, ChannelT>::value &&
(std::is_same<T, const char*>::value || (std::is_same<T, const char *>::value ||
std::is_same<T, char*>::value)>::type> { std::is_same<T, char *>::value)>> {
public: public:
static Error serialize(RawByteChannel &C, const char *S) { static Error serialize(RawByteChannel &C, const char *S) {
return SerializationTraits<ChannelT, std::string, StringRef>::serialize(C, return SerializationTraits<ChannelT, std::string, StringRef>::serialize(C,
@ -157,9 +157,9 @@ public:
}; };
template <typename ChannelT> template <typename ChannelT>
class SerializationTraits<ChannelT, std::string, std::string, class SerializationTraits<
typename std::enable_if<std::is_base_of< ChannelT, std::string, std::string,
RawByteChannel, ChannelT>::value>::type> { std::enable_if_t<std::is_base_of<RawByteChannel, ChannelT>::value>> {
public: public:
/// RPC channel serialization for std::strings. /// RPC channel serialization for std::strings.
static Error serialize(RawByteChannel &C, const std::string &S) { static Error serialize(RawByteChannel &C, const std::string &S) {

View File

@ -32,7 +32,7 @@ template <typename T, typename GenT> T uniform(GenT &Gen) {
/// elements, which may each be weighted to be more likely choices. /// elements, which may each be weighted to be more likely choices.
template <typename T, typename GenT> class ReservoirSampler { template <typename T, typename GenT> class ReservoirSampler {
GenT &RandGen; GenT &RandGen;
typename std::remove_const<T>::type Selection = {}; std::remove_const_t<T> Selection = {};
uint64_t TotalWeight = 0; uint64_t TotalWeight = 0;
public: public:
@ -70,8 +70,8 @@ public:
}; };
template <typename GenT, typename RangeT, template <typename GenT, typename RangeT,
typename ElT = typename std::remove_reference< typename ElT = std::remove_reference_t<
decltype(*std::begin(std::declval<RangeT>()))>::type> decltype(*std::begin(std::declval<RangeT>()))>>
ReservoirSampler<ElT, GenT> makeSampler(GenT &RandGen, RangeT &&Items) { ReservoirSampler<ElT, GenT> makeSampler(GenT &RandGen, RangeT &&Items) {
ReservoirSampler<ElT, GenT> RS(RandGen); ReservoirSampler<ElT, GenT> RS(RandGen);
RS.sample(Items); RS.sample(Items);

View File

@ -460,8 +460,7 @@ public:
static Constant *get(StructType *T, ArrayRef<Constant*> V); static Constant *get(StructType *T, ArrayRef<Constant*> V);
template <typename... Csts> template <typename... Csts>
static typename std::enable_if<are_base_of<Constant, Csts...>::value, static std::enable_if_t<are_base_of<Constant, Csts...>::value, Constant *>
Constant *>::type
get(StructType *T, Csts *... Vs) { get(StructType *T, Csts *... Vs) {
SmallVector<Constant *, 8> Values({Vs...}); SmallVector<Constant *, 8> Values({Vs...});
return get(T, Values); return get(T, Values);

View File

@ -267,8 +267,7 @@ public:
StringRef Name, bool isPacked = false); StringRef Name, bool isPacked = false);
static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements); static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements);
template <class... Tys> template <class... Tys>
static typename std::enable_if<are_base_of<Type, Tys...>::value, static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
StructType *>::type
create(StringRef Name, Type *elt1, Tys *... elts) { create(StringRef Name, Type *elt1, Tys *... elts) {
assert(elt1 && "Cannot create a struct type with no elements with this"); assert(elt1 && "Cannot create a struct type with no elements with this");
SmallVector<llvm::Type *, 8> StructFields({elt1, elts...}); SmallVector<llvm::Type *, 8> StructFields({elt1, elts...});
@ -286,8 +285,7 @@ public:
/// specifying the elements as arguments. Note that this method always returns /// specifying the elements as arguments. Note that this method always returns
/// a non-packed struct, and requires at least one element type. /// a non-packed struct, and requires at least one element type.
template <class... Tys> template <class... Tys>
static typename std::enable_if<are_base_of<Type, Tys...>::value, static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
StructType *>::type
get(Type *elt1, Tys *... elts) { get(Type *elt1, Tys *... elts) {
assert(elt1 && "Cannot create a struct type with no elements with this"); assert(elt1 && "Cannot create a struct type with no elements with this");
LLVMContext &Ctx = elt1->getContext(); LLVMContext &Ctx = elt1->getContext();
@ -324,7 +322,7 @@ public:
void setBody(ArrayRef<Type*> Elements, bool isPacked = false); void setBody(ArrayRef<Type*> Elements, bool isPacked = false);
template <typename... Tys> template <typename... Tys>
typename std::enable_if<are_base_of<Type, Tys...>::value, void>::type std::enable_if_t<are_base_of<Type, Tys...>::value, void>
setBody(Type *elt1, Tys *... elts) { setBody(Type *elt1, Tys *... elts) {
assert(elt1 && "Cannot create a struct type with no elements with this"); assert(elt1 && "Cannot create a struct type with no elements with this");
SmallVector<llvm::Type *, 8> StructFields({elt1, elts...}); SmallVector<llvm::Type *, 8> StructFields({elt1, elts...});

View File

@ -531,9 +531,10 @@ protected:
template <class RemarkT> template <class RemarkT>
RemarkT & RemarkT &
operator<<(RemarkT &R, operator<<(RemarkT &R,
typename std::enable_if< std::enable_if_t<
std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value, std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
StringRef>::type S) { StringRef>
S) {
R.insert(S); R.insert(S);
return R; return R;
} }
@ -543,9 +544,10 @@ operator<<(RemarkT &R,
template <class RemarkT> template <class RemarkT>
RemarkT & RemarkT &
operator<<(RemarkT &&R, operator<<(RemarkT &&R,
typename std::enable_if< std::enable_if_t<
std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value, std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
StringRef>::type S) { StringRef>
S) {
R.insert(S); R.insert(S);
return R; return R;
} }
@ -553,9 +555,10 @@ operator<<(RemarkT &&R,
template <class RemarkT> template <class RemarkT>
RemarkT & RemarkT &
operator<<(RemarkT &R, operator<<(RemarkT &R,
typename std::enable_if< std::enable_if_t<
std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value, std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
DiagnosticInfoOptimizationBase::Argument>::type A) { DiagnosticInfoOptimizationBase::Argument>
A) {
R.insert(A); R.insert(A);
return R; return R;
} }
@ -563,9 +566,10 @@ operator<<(RemarkT &R,
template <class RemarkT> template <class RemarkT>
RemarkT & RemarkT &
operator<<(RemarkT &&R, operator<<(RemarkT &&R,
typename std::enable_if< std::enable_if_t<
std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value, std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
DiagnosticInfoOptimizationBase::Argument>::type A) { DiagnosticInfoOptimizationBase::Argument>
A) {
R.insert(A); R.insert(A);
return R; return R;
} }
@ -573,9 +577,10 @@ operator<<(RemarkT &&R,
template <class RemarkT> template <class RemarkT>
RemarkT & RemarkT &
operator<<(RemarkT &R, operator<<(RemarkT &R,
typename std::enable_if< std::enable_if_t<
std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value, std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
DiagnosticInfoOptimizationBase::setIsVerbose>::type V) { DiagnosticInfoOptimizationBase::setIsVerbose>
V) {
R.insert(V); R.insert(V);
return R; return R;
} }
@ -583,9 +588,10 @@ operator<<(RemarkT &R,
template <class RemarkT> template <class RemarkT>
RemarkT & RemarkT &
operator<<(RemarkT &&R, operator<<(RemarkT &&R,
typename std::enable_if< std::enable_if_t<
std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value, std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
DiagnosticInfoOptimizationBase::setIsVerbose>::type V) { DiagnosticInfoOptimizationBase::setIsVerbose>
V) {
R.insert(V); R.insert(V);
return R; return R;
} }
@ -593,9 +599,10 @@ operator<<(RemarkT &&R,
template <class RemarkT> template <class RemarkT>
RemarkT & RemarkT &
operator<<(RemarkT &R, operator<<(RemarkT &R,
typename std::enable_if< std::enable_if_t<
std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value, std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
DiagnosticInfoOptimizationBase::setExtraArgs>::type EA) { DiagnosticInfoOptimizationBase::setExtraArgs>
EA) {
R.insert(EA); R.insert(EA);
return R; return R;
} }

View File

@ -527,7 +527,7 @@ template <class V, class M> struct IsValidReference {
/// As an analogue to \a isa(), check whether \c MD has an \a Value inside of /// As an analogue to \a isa(), check whether \c MD has an \a Value inside of
/// type \c X. /// type \c X.
template <class X, class Y> template <class X, class Y>
inline typename std::enable_if<detail::IsValidPointer<X, Y>::value, bool>::type inline std::enable_if_t<detail::IsValidPointer<X, Y>::value, bool>
hasa(Y &&MD) { hasa(Y &&MD) {
assert(MD && "Null pointer sent into hasa"); assert(MD && "Null pointer sent into hasa");
if (auto *V = dyn_cast<ConstantAsMetadata>(MD)) if (auto *V = dyn_cast<ConstantAsMetadata>(MD))
@ -535,9 +535,8 @@ hasa(Y &&MD) {
return false; return false;
} }
template <class X, class Y> template <class X, class Y>
inline inline std::enable_if_t<detail::IsValidReference<X, Y &>::value, bool>
typename std::enable_if<detail::IsValidReference<X, Y &>::value, bool>::type hasa(Y &MD) {
hasa(Y &MD) {
return hasa(&MD); return hasa(&MD);
} }
@ -545,14 +544,13 @@ inline
/// ///
/// As an analogue to \a cast(), extract the \a Value subclass \c X from \c MD. /// As an analogue to \a cast(), extract the \a Value subclass \c X from \c MD.
template <class X, class Y> template <class X, class Y>
inline typename std::enable_if<detail::IsValidPointer<X, Y>::value, X *>::type inline std::enable_if_t<detail::IsValidPointer<X, Y>::value, X *>
extract(Y &&MD) { extract(Y &&MD) {
return cast<X>(cast<ConstantAsMetadata>(MD)->getValue()); return cast<X>(cast<ConstantAsMetadata>(MD)->getValue());
} }
template <class X, class Y> template <class X, class Y>
inline inline std::enable_if_t<detail::IsValidReference<X, Y &>::value, X *>
typename std::enable_if<detail::IsValidReference<X, Y &>::value, X *>::type extract(Y &MD) {
extract(Y &MD) {
return extract(&MD); return extract(&MD);
} }
@ -561,7 +559,7 @@ inline
/// As an analogue to \a cast_or_null(), extract the \a Value subclass \c X /// As an analogue to \a cast_or_null(), extract the \a Value subclass \c X
/// from \c MD, allowing \c MD to be null. /// from \c MD, allowing \c MD to be null.
template <class X, class Y> template <class X, class Y>
inline typename std::enable_if<detail::IsValidPointer<X, Y>::value, X *>::type inline std::enable_if_t<detail::IsValidPointer<X, Y>::value, X *>
extract_or_null(Y &&MD) { extract_or_null(Y &&MD) {
if (auto *V = cast_or_null<ConstantAsMetadata>(MD)) if (auto *V = cast_or_null<ConstantAsMetadata>(MD))
return cast<X>(V->getValue()); return cast<X>(V->getValue());
@ -574,7 +572,7 @@ extract_or_null(Y &&MD) {
/// from \c MD, return null if \c MD doesn't contain a \a Value or if the \a /// 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. /// Value it does contain is of the wrong subclass.
template <class X, class Y> template <class X, class Y>
inline typename std::enable_if<detail::IsValidPointer<X, Y>::value, X *>::type inline std::enable_if_t<detail::IsValidPointer<X, Y>::value, X *>
dyn_extract(Y &&MD) { dyn_extract(Y &&MD) {
if (auto *V = dyn_cast<ConstantAsMetadata>(MD)) if (auto *V = dyn_cast<ConstantAsMetadata>(MD))
return dyn_cast<X>(V->getValue()); return dyn_cast<X>(V->getValue());
@ -587,7 +585,7 @@ dyn_extract(Y &&MD) {
/// from \c MD, return null if \c MD doesn't contain a \a Value or if the \a /// 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. /// Value it does contain is of the wrong subclass, allowing \c MD to be null.
template <class X, class Y> template <class X, class Y>
inline typename std::enable_if<detail::IsValidPointer<X, Y>::value, X *>::type inline std::enable_if_t<detail::IsValidPointer<X, Y>::value, X *>
dyn_extract_or_null(Y &&MD) { dyn_extract_or_null(Y &&MD) {
if (auto *V = dyn_cast_or_null<ConstantAsMetadata>(MD)) if (auto *V = dyn_cast_or_null<ConstantAsMetadata>(MD))
return dyn_cast<X>(V->getValue()); return dyn_cast<X>(V->getValue());
@ -976,7 +974,7 @@ public:
/// Try to create a uniqued version of \c N -- in place, if possible -- and /// 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. /// return it. If \c N cannot be uniqued, return a distinct node instead.
template <class T> template <class T>
static typename std::enable_if<std::is_base_of<MDNode, T>::value, T *>::type static std::enable_if_t<std::is_base_of<MDNode, T>::value, T *>
replaceWithPermanent(std::unique_ptr<T, TempMDNodeDeleter> N) { replaceWithPermanent(std::unique_ptr<T, TempMDNodeDeleter> N) {
return cast<T>(N.release()->replaceWithPermanentImpl()); return cast<T>(N.release()->replaceWithPermanentImpl());
} }
@ -988,7 +986,7 @@ public:
/// ///
/// \pre N does not self-reference. /// \pre N does not self-reference.
template <class T> template <class T>
static typename std::enable_if<std::is_base_of<MDNode, T>::value, T *>::type static std::enable_if_t<std::is_base_of<MDNode, T>::value, T *>
replaceWithUniqued(std::unique_ptr<T, TempMDNodeDeleter> N) { replaceWithUniqued(std::unique_ptr<T, TempMDNodeDeleter> N) {
return cast<T>(N.release()->replaceWithUniquedImpl()); return cast<T>(N.release()->replaceWithUniquedImpl());
} }
@ -998,7 +996,7 @@ public:
/// Create a distinct version of \c N -- in place, if possible -- and return /// Create a distinct version of \c N -- in place, if possible -- and return
/// it. Takes ownership of the temporary node. /// it. Takes ownership of the temporary node.
template <class T> template <class T>
static typename std::enable_if<std::is_base_of<MDNode, T>::value, T *>::type static std::enable_if_t<std::is_base_of<MDNode, T>::value, T *>
replaceWithDistinct(std::unique_ptr<T, TempMDNodeDeleter> N) { replaceWithDistinct(std::unique_ptr<T, TempMDNodeDeleter> N) {
return cast<T>(N.release()->replaceWithDistinctImpl()); return cast<T>(N.release()->replaceWithDistinctImpl());
} }
@ -1237,15 +1235,13 @@ public:
template <class U> template <class U>
MDTupleTypedArrayWrapper( MDTupleTypedArrayWrapper(
const MDTupleTypedArrayWrapper<U> &Other, const MDTupleTypedArrayWrapper<U> &Other,
typename std::enable_if<std::is_convertible<U *, T *>::value>::type * = std::enable_if_t<std::is_convertible<U *, T *>::value> * = nullptr)
nullptr)
: N(Other.get()) {} : N(Other.get()) {}
template <class U> template <class U>
explicit MDTupleTypedArrayWrapper( explicit MDTupleTypedArrayWrapper(
const MDTupleTypedArrayWrapper<U> &Other, const MDTupleTypedArrayWrapper<U> &Other,
typename std::enable_if<!std::is_convertible<U *, T *>::value>::type * = std::enable_if_t<!std::is_convertible<U *, T *>::value> * = nullptr)
nullptr)
: N(Other.get()) {} : N(Other.get()) {}
explicit operator bool() const { return get(); } explicit operator bool() const { return get(); }

View File

@ -243,7 +243,7 @@ class ValueMapCallbackVH final : public CallbackVH {
friend struct DenseMapInfo<ValueMapCallbackVH>; friend struct DenseMapInfo<ValueMapCallbackVH>;
using ValueMapT = ValueMap<KeyT, ValueT, Config>; using ValueMapT = ValueMap<KeyT, ValueT, Config>;
using KeySansPointerT = typename std::remove_pointer<KeyT>::type; using KeySansPointerT = std::remove_pointer_t<KeyT>;
ValueMapT *Map; ValueMapT *Map;

View File

@ -53,7 +53,7 @@ public:
static const endianness TargetEndianness = E; static const endianness TargetEndianness = E;
static const bool Is64Bits = Is64; static const bool Is64Bits = Is64;
using uint = typename std::conditional<Is64, uint64_t, uint32_t>::type; using uint = std::conditional_t<Is64, uint64_t, uint32_t>;
using Ehdr = Elf_Ehdr_Impl<ELFType<E, Is64>>; using Ehdr = Elf_Ehdr_Impl<ELFType<E, Is64>>;
using Shdr = Elf_Shdr_Impl<ELFType<E, Is64>>; using Shdr = Elf_Shdr_Impl<ELFType<E, Is64>>;
using Sym = Elf_Sym_Impl<ELFType<E, Is64>>; using Sym = Elf_Sym_Impl<ELFType<E, Is64>>;
@ -346,10 +346,8 @@ template <class ELFT>
struct Elf_Dyn_Impl : Elf_Dyn_Base<ELFT> { struct Elf_Dyn_Impl : Elf_Dyn_Base<ELFT> {
using Elf_Dyn_Base<ELFT>::d_tag; using Elf_Dyn_Base<ELFT>::d_tag;
using Elf_Dyn_Base<ELFT>::d_un; using Elf_Dyn_Base<ELFT>::d_un;
using intX_t = typename std::conditional<ELFT::Is64Bits, using intX_t = std::conditional_t<ELFT::Is64Bits, int64_t, int32_t>;
int64_t, int32_t>::type; using uintX_t = std::conditional_t<ELFT::Is64Bits, uint64_t, uint32_t>;
using uintX_t = typename std::conditional<ELFT::Is64Bits,
uint64_t, uint32_t>::type;
intX_t getTag() const { return d_tag; } intX_t getTag() const { return d_tag; }
uintX_t getVal() const { return d_un.d_val; } uintX_t getVal() const { return d_un.d_val; }
uintX_t getPtr() const { return d_un.d_ptr; } uintX_t getPtr() const { return d_un.d_ptr; }

View File

@ -70,8 +70,7 @@ public:
/// Deallocate space for a sequence of objects without constructing them. /// Deallocate space for a sequence of objects without constructing them.
template <typename T> template <typename T>
typename std::enable_if< std::enable_if_t<!std::is_same<std::remove_cv_t<T>, void>::value, void>
!std::is_same<typename std::remove_cv<T>::type, void>::value, void>::type
Deallocate(T *Ptr, size_t Num = 1) { Deallocate(T *Ptr, size_t Num = 1) {
Deallocate(static_cast<const void *>(Ptr), Num * sizeof(T)); Deallocate(static_cast<const void *>(Ptr), Num * sizeof(T));
} }

View File

@ -90,7 +90,7 @@ public:
template <typename T> Error readEnum(T &Dest) { template <typename T> Error readEnum(T &Dest) {
static_assert(std::is_enum<T>::value, static_assert(std::is_enum<T>::value,
"Cannot call readEnum with non-enum value!"); "Cannot call readEnum with non-enum value!");
typename std::underlying_type<T>::type N; std::underlying_type_t<T> N;
if (auto EC = readInteger(N)) if (auto EC = readInteger(N))
return EC; return EC;
Dest = static_cast<T>(N); Dest = static_cast<T>(N);

View File

@ -75,7 +75,7 @@ public:
static_assert(std::is_enum<T>::value, static_assert(std::is_enum<T>::value,
"Cannot call writeEnum with non-Enum type"); "Cannot call writeEnum with non-Enum type");
using U = typename std::underlying_type<T>::type; using U = std::underlying_type_t<T>;
return writeInteger<U>(static_cast<U>(Num)); return writeInteger<U>(static_cast<U>(Num));
} }

View File

@ -61,8 +61,7 @@ struct isa_impl {
/// Always allow upcasts, and perform no dynamic check for them. /// Always allow upcasts, and perform no dynamic check for them.
template <typename To, typename From> template <typename To, typename From>
struct isa_impl< struct isa_impl<To, From, std::enable_if_t<std::is_base_of<To, From>::value>> {
To, From, typename std::enable_if<std::is_base_of<To, From>::value>::type> {
static inline bool doit(const From &) { return true; } static inline bool doit(const From &) { return true; }
}; };
@ -184,7 +183,7 @@ template <class To, class From>
struct cast_retty_impl<To, std::unique_ptr<From>> { struct cast_retty_impl<To, std::unique_ptr<From>> {
private: private:
using PointerType = typename cast_retty_impl<To, From *>::ret_type; using PointerType = typename cast_retty_impl<To, From *>::ret_type;
using ResultType = typename std::remove_pointer<PointerType>::type; using ResultType = std::remove_pointer_t<PointerType>;
public: public:
using ret_type = std::unique_ptr<ResultType>; using ret_type = std::unique_ptr<ResultType>;
@ -244,8 +243,8 @@ template <class X> struct is_simple_type {
// cast<Instruction>(myVal)->getParent() // cast<Instruction>(myVal)->getParent()
// //
template <class X, class Y> template <class X, class Y>
inline typename std::enable_if<!is_simple_type<Y>::value, inline std::enable_if_t<!is_simple_type<Y>::value,
typename cast_retty<X, const Y>::ret_type>::type typename cast_retty<X, const Y>::ret_type>
cast(const Y &Val) { cast(const Y &Val) {
assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!"); assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
return cast_convert_val< return cast_convert_val<
@ -280,10 +279,9 @@ cast(std::unique_ptr<Y> &&Val) {
// accepted. // accepted.
// //
template <class X, class Y> template <class X, class Y>
LLVM_NODISCARD inline LLVM_NODISCARD inline std::enable_if_t<
typename std::enable_if<!is_simple_type<Y>::value, !is_simple_type<Y>::value, typename cast_retty<X, const Y>::ret_type>
typename cast_retty<X, const Y>::ret_type>::type cast_or_null(const Y &Val) {
cast_or_null(const Y &Val) {
if (!Val) if (!Val)
return nullptr; return nullptr;
assert(isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!"); assert(isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!");
@ -291,10 +289,9 @@ LLVM_NODISCARD inline
} }
template <class X, class Y> template <class X, class Y>
LLVM_NODISCARD inline LLVM_NODISCARD inline std::enable_if_t<!is_simple_type<Y>::value,
typename std::enable_if<!is_simple_type<Y>::value, typename cast_retty<X, Y>::ret_type>
typename cast_retty<X, Y>::ret_type>::type cast_or_null(Y &Val) {
cast_or_null(Y &Val) {
if (!Val) if (!Val)
return nullptr; return nullptr;
assert(isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!"); assert(isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!");
@ -326,10 +323,9 @@ cast_or_null(std::unique_ptr<Y> &&Val) {
// //
template <class X, class Y> template <class X, class Y>
LLVM_NODISCARD inline LLVM_NODISCARD inline std::enable_if_t<
typename std::enable_if<!is_simple_type<Y>::value, !is_simple_type<Y>::value, typename cast_retty<X, const Y>::ret_type>
typename cast_retty<X, const Y>::ret_type>::type dyn_cast(const Y &Val) {
dyn_cast(const Y &Val) {
return isa<X>(Val) ? cast<X>(Val) : nullptr; return isa<X>(Val) ? cast<X>(Val) : nullptr;
} }
@ -347,18 +343,16 @@ LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
// value is accepted. // value is accepted.
// //
template <class X, class Y> template <class X, class Y>
LLVM_NODISCARD inline LLVM_NODISCARD inline std::enable_if_t<
typename std::enable_if<!is_simple_type<Y>::value, !is_simple_type<Y>::value, typename cast_retty<X, const Y>::ret_type>
typename cast_retty<X, const Y>::ret_type>::type dyn_cast_or_null(const Y &Val) {
dyn_cast_or_null(const Y &Val) {
return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr; return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
} }
template <class X, class Y> template <class X, class Y>
LLVM_NODISCARD inline LLVM_NODISCARD inline std::enable_if_t<!is_simple_type<Y>::value,
typename std::enable_if<!is_simple_type<Y>::value, typename cast_retty<X, Y>::ret_type>
typename cast_retty<X, Y>::ret_type>::type dyn_cast_or_null(Y &Val) {
dyn_cast_or_null(Y &Val) {
return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr; return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
} }

View File

@ -25,8 +25,8 @@ namespace {
/// \p RHS. /// \p RHS.
/// \return Empty optional if the operation overflows, or result otherwise. /// \return Empty optional if the operation overflows, or result otherwise.
template <typename T, typename F> template <typename T, typename F>
typename std::enable_if<std::is_integral<T>::value && sizeof(T) * 8 <= 64, std::enable_if_t<std::is_integral<T>::value && sizeof(T) * 8 <= 64,
llvm::Optional<T>>::type llvm::Optional<T>>
checkedOp(T LHS, T RHS, F Op, bool Signed = true) { checkedOp(T LHS, T RHS, F Op, bool Signed = true) {
llvm::APInt ALHS(/*BitSize=*/sizeof(T) * 8, LHS, Signed); llvm::APInt ALHS(/*BitSize=*/sizeof(T) * 8, LHS, Signed);
llvm::APInt ARHS(/*BitSize=*/sizeof(T) * 8, RHS, Signed); llvm::APInt ARHS(/*BitSize=*/sizeof(T) * 8, RHS, Signed);
@ -44,7 +44,7 @@ namespace llvm {
/// \return Optional of sum if no signed overflow occurred, /// \return Optional of sum if no signed overflow occurred,
/// \c None otherwise. /// \c None otherwise.
template <typename T> template <typename T>
typename std::enable_if<std::is_signed<T>::value, llvm::Optional<T>>::type std::enable_if_t<std::is_signed<T>::value, llvm::Optional<T>>
checkedAdd(T LHS, T RHS) { checkedAdd(T LHS, T RHS) {
return checkedOp(LHS, RHS, &llvm::APInt::sadd_ov); return checkedOp(LHS, RHS, &llvm::APInt::sadd_ov);
} }
@ -53,7 +53,7 @@ checkedAdd(T LHS, T RHS) {
/// \return Optional of sum if no signed overflow occurred, /// \return Optional of sum if no signed overflow occurred,
/// \c None otherwise. /// \c None otherwise.
template <typename T> template <typename T>
typename std::enable_if<std::is_signed<T>::value, llvm::Optional<T>>::type std::enable_if_t<std::is_signed<T>::value, llvm::Optional<T>>
checkedSub(T LHS, T RHS) { checkedSub(T LHS, T RHS) {
return checkedOp(LHS, RHS, &llvm::APInt::ssub_ov); return checkedOp(LHS, RHS, &llvm::APInt::ssub_ov);
} }
@ -62,7 +62,7 @@ checkedSub(T LHS, T RHS) {
/// \return Optional of product if no signed overflow occurred, /// \return Optional of product if no signed overflow occurred,
/// \c None otherwise. /// \c None otherwise.
template <typename T> template <typename T>
typename std::enable_if<std::is_signed<T>::value, llvm::Optional<T>>::type std::enable_if_t<std::is_signed<T>::value, llvm::Optional<T>>
checkedMul(T LHS, T RHS) { checkedMul(T LHS, T RHS) {
return checkedOp(LHS, RHS, &llvm::APInt::smul_ov); return checkedOp(LHS, RHS, &llvm::APInt::smul_ov);
} }
@ -71,7 +71,7 @@ checkedMul(T LHS, T RHS) {
/// \return Optional of result if no signed overflow occurred, /// \return Optional of result if no signed overflow occurred,
/// \c None otherwise. /// \c None otherwise.
template <typename T> template <typename T>
typename std::enable_if<std::is_signed<T>::value, llvm::Optional<T>>::type std::enable_if_t<std::is_signed<T>::value, llvm::Optional<T>>
checkedMulAdd(T A, T B, T C) { checkedMulAdd(T A, T B, T C) {
if (auto Product = checkedMul(A, B)) if (auto Product = checkedMul(A, B))
return checkedAdd(*Product, C); return checkedAdd(*Product, C);
@ -82,7 +82,7 @@ checkedMulAdd(T A, T B, T C) {
/// \return Optional of sum if no unsigned overflow occurred, /// \return Optional of sum if no unsigned overflow occurred,
/// \c None otherwise. /// \c None otherwise.
template <typename T> template <typename T>
typename std::enable_if<std::is_unsigned<T>::value, llvm::Optional<T>>::type std::enable_if_t<std::is_unsigned<T>::value, llvm::Optional<T>>
checkedAddUnsigned(T LHS, T RHS) { checkedAddUnsigned(T LHS, T RHS) {
return checkedOp(LHS, RHS, &llvm::APInt::uadd_ov, /*Signed=*/false); return checkedOp(LHS, RHS, &llvm::APInt::uadd_ov, /*Signed=*/false);
} }
@ -91,7 +91,7 @@ checkedAddUnsigned(T LHS, T RHS) {
/// \return Optional of product if no unsigned overflow occurred, /// \return Optional of product if no unsigned overflow occurred,
/// \c None otherwise. /// \c None otherwise.
template <typename T> template <typename T>
typename std::enable_if<std::is_unsigned<T>::value, llvm::Optional<T>>::type std::enable_if_t<std::is_unsigned<T>::value, llvm::Optional<T>>
checkedMulUnsigned(T LHS, T RHS) { checkedMulUnsigned(T LHS, T RHS) {
return checkedOp(LHS, RHS, &llvm::APInt::umul_ov, /*Signed=*/false); return checkedOp(LHS, RHS, &llvm::APInt::umul_ov, /*Signed=*/false);
} }
@ -100,7 +100,7 @@ checkedMulUnsigned(T LHS, T RHS) {
/// \return Optional of result if no unsigned overflow occurred, /// \return Optional of result if no unsigned overflow occurred,
/// \c None otherwise. /// \c None otherwise.
template <typename T> template <typename T>
typename std::enable_if<std::is_unsigned<T>::value, llvm::Optional<T>>::type std::enable_if_t<std::is_unsigned<T>::value, llvm::Optional<T>>
checkedMulAddUnsigned(T A, T B, T C) { checkedMulAddUnsigned(T A, T B, T C) {
if (auto Product = checkedMulUnsigned(A, B)) if (auto Product = checkedMulUnsigned(A, B))
return checkedAddUnsigned(*Product, C); return checkedAddUnsigned(*Product, C);

View File

@ -112,8 +112,8 @@ template <typename Rep, typename Period>
struct format_provider<std::chrono::duration<Rep, Period>> { struct format_provider<std::chrono::duration<Rep, Period>> {
private: private:
typedef std::chrono::duration<Rep, Period> Dur; typedef std::chrono::duration<Rep, Period> Dur;
typedef typename std::conditional< typedef std::conditional_t<std::chrono::treat_as_floating_point<Rep>::value,
std::chrono::treat_as_floating_point<Rep>::value, double, intmax_t>::type double, intmax_t>
InternalRep; InternalRep;
template <typename AsPeriod> static InternalRep getAs(const Dur &D) { template <typename AsPeriod> static InternalRep getAs(const Dur &D) {

View File

@ -488,14 +488,13 @@ struct callback_traits : public callback_traits<decltype(&F::operator())> {};
template <typename R, typename C, typename... Args> template <typename R, typename C, typename... Args>
struct callback_traits<R (C::*)(Args...) const> { struct callback_traits<R (C::*)(Args...) const> {
using result_type = R; using result_type = R;
using arg_type = typename std::tuple_element<0, std::tuple<Args...>>::type; using arg_type = std::tuple_element_t<0, std::tuple<Args...>>;
static_assert(sizeof...(Args) == 1, "callback function must have one and only one parameter"); static_assert(sizeof...(Args) == 1, "callback function must have one and only one parameter");
static_assert(std::is_same<result_type, void>::value, static_assert(std::is_same<result_type, void>::value,
"callback return type must be void"); "callback return type must be void");
static_assert( static_assert(std::is_lvalue_reference<arg_type>::value &&
std::is_lvalue_reference<arg_type>::value && std::is_const<std::remove_reference_t<arg_type>>::value,
std::is_const<typename std::remove_reference<arg_type>::type>::value, "callback arg_type must be a const lvalue reference");
"callback arg_type must be a const lvalue reference");
}; };
} // namespace detail } // namespace detail
@ -1453,16 +1452,16 @@ class opt : public Option,
} }
} }
template <class T, class = typename std::enable_if< template <class T,
std::is_assignable<T&, T>::value>::type> class = std::enable_if_t<std::is_assignable<T &, T>::value>>
void setDefaultImpl() { void setDefaultImpl() {
const OptionValue<DataType> &V = this->getDefault(); const OptionValue<DataType> &V = this->getDefault();
if (V.hasValue()) if (V.hasValue())
this->setValue(V.getValue()); this->setValue(V.getValue());
} }
template <class T, class = typename std::enable_if< template <class T,
!std::is_assignable<T&, T>::value>::type> class = std::enable_if_t<!std::is_assignable<T &, T>::value>>
void setDefaultImpl(...) {} void setDefaultImpl(...) {}
void setDefault() override { setDefaultImpl<DataType>(); } void setDefault() override { setDefaultImpl<DataType>(); }

View File

@ -111,7 +111,7 @@ inline void write(void *memory, value_type value) {
} }
template <typename value_type> template <typename value_type>
using make_unsigned_t = typename std::make_unsigned<value_type>::type; using make_unsigned_t = std::make_unsigned_t<value_type>;
/// Read a value of a particular endianness from memory, for a location /// Read a value of a particular endianness from memory, for a location
/// that starts at the given bit offset within the first byte. /// that starts at the given bit offset within the first byte.

View File

@ -436,19 +436,19 @@ template <class T> class LLVM_NODISCARD Expected {
static const bool isRef = std::is_reference<T>::value; static const bool isRef = std::is_reference<T>::value;
using wrap = std::reference_wrapper<typename std::remove_reference<T>::type>; using wrap = std::reference_wrapper<std::remove_reference_t<T>>;
using error_type = std::unique_ptr<ErrorInfoBase>; using error_type = std::unique_ptr<ErrorInfoBase>;
public: public:
using storage_type = typename std::conditional<isRef, wrap, T>::type; using storage_type = std::conditional_t<isRef, wrap, T>;
using value_type = T; using value_type = T;
private: private:
using reference = typename std::remove_reference<T>::type &; using reference = std::remove_reference_t<T> &;
using const_reference = const typename std::remove_reference<T>::type &; using const_reference = const std::remove_reference_t<T> &;
using pointer = typename std::remove_reference<T>::type *; using pointer = std::remove_reference_t<T> *;
using const_pointer = const typename std::remove_reference<T>::type *; using const_pointer = const std::remove_reference_t<T> *;
public: public:
/// Create an Expected<T> error value from the given Error. /// Create an Expected<T> error value from the given Error.
@ -472,12 +472,12 @@ public:
/// must be convertible to T. /// must be convertible to T.
template <typename OtherT> template <typename OtherT>
Expected(OtherT &&Val, Expected(OtherT &&Val,
typename std::enable_if<std::is_convertible<OtherT, T>::value>::type std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
* = nullptr)
: HasError(false) : HasError(false)
#if LLVM_ENABLE_ABI_BREAKING_CHECKS #if LLVM_ENABLE_ABI_BREAKING_CHECKS
// Expected is unchecked upon construction in Debug builds. // Expected is unchecked upon construction in Debug builds.
, Unchecked(true) ,
Unchecked(true)
#endif #endif
{ {
new (getStorage()) storage_type(std::forward<OtherT>(Val)); new (getStorage()) storage_type(std::forward<OtherT>(Val));
@ -489,9 +489,9 @@ public:
/// Move construct an Expected<T> value from an Expected<OtherT>, where OtherT /// Move construct an Expected<T> value from an Expected<OtherT>, where OtherT
/// must be convertible to T. /// must be convertible to T.
template <class OtherT> template <class OtherT>
Expected(Expected<OtherT> &&Other, Expected(
typename std::enable_if<std::is_convertible<OtherT, T>::value>::type Expected<OtherT> &&Other,
* = nullptr) { std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr) {
moveConstruct(std::move(Other)); moveConstruct(std::move(Other));
} }
@ -500,8 +500,7 @@ public:
template <class OtherT> template <class OtherT>
explicit Expected( explicit Expected(
Expected<OtherT> &&Other, Expected<OtherT> &&Other,
typename std::enable_if<!std::is_convertible<OtherT, T>::value>::type * = std::enable_if_t<!std::is_convertible<OtherT, T>::value> * = nullptr) {
nullptr) {
moveConstruct(std::move(Other)); moveConstruct(std::move(Other));
} }

View File

@ -58,23 +58,23 @@ class ErrorOr {
static const bool isRef = std::is_reference<T>::value; static const bool isRef = std::is_reference<T>::value;
using wrap = std::reference_wrapper<typename std::remove_reference<T>::type>; using wrap = std::reference_wrapper<std::remove_reference_t<T>>;
public: public:
using storage_type = typename std::conditional<isRef, wrap, T>::type; using storage_type = std::conditional_t<isRef, wrap, T>;
private: private:
using reference = typename std::remove_reference<T>::type &; using reference = std::remove_reference_t<T> &;
using const_reference = const typename std::remove_reference<T>::type &; using const_reference = const std::remove_reference_t<T> &;
using pointer = typename std::remove_reference<T>::type *; using pointer = std::remove_reference_t<T> *;
using const_pointer = const typename std::remove_reference<T>::type *; using const_pointer = const std::remove_reference_t<T> *;
public: public:
template <class E> template <class E>
ErrorOr(E ErrorCode, ErrorOr(E ErrorCode,
typename std::enable_if<std::is_error_code_enum<E>::value || std::enable_if_t<std::is_error_code_enum<E>::value ||
std::is_error_condition_enum<E>::value, std::is_error_condition_enum<E>::value,
void *>::type = nullptr) void *> = nullptr)
: HasError(true) { : HasError(true) {
new (getErrorStorage()) std::error_code(make_error_code(ErrorCode)); new (getErrorStorage()) std::error_code(make_error_code(ErrorCode));
} }
@ -85,8 +85,7 @@ public:
template <class OtherT> template <class OtherT>
ErrorOr(OtherT &&Val, ErrorOr(OtherT &&Val,
typename std::enable_if<std::is_convertible<OtherT, T>::value>::type std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
* = nullptr)
: HasError(false) { : HasError(false) {
new (getStorage()) storage_type(std::forward<OtherT>(Val)); new (getStorage()) storage_type(std::forward<OtherT>(Val));
} }
@ -96,18 +95,16 @@ public:
} }
template <class OtherT> template <class OtherT>
ErrorOr( ErrorOr(const ErrorOr<OtherT> &Other,
const ErrorOr<OtherT> &Other, std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr) {
typename std::enable_if<std::is_convertible<OtherT, T>::value>::type * =
nullptr) {
copyConstruct(Other); copyConstruct(Other);
} }
template <class OtherT> template <class OtherT>
explicit ErrorOr( explicit ErrorOr(
const ErrorOr<OtherT> &Other, const ErrorOr<OtherT> &Other,
typename std::enable_if< std::enable_if_t<!std::is_convertible<OtherT, const T &>::value> * =
!std::is_convertible<OtherT, const T &>::value>::type * = nullptr) { nullptr) {
copyConstruct(Other); copyConstruct(Other);
} }
@ -116,10 +113,8 @@ public:
} }
template <class OtherT> template <class OtherT>
ErrorOr( ErrorOr(ErrorOr<OtherT> &&Other,
ErrorOr<OtherT> &&Other, std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr) {
typename std::enable_if<std::is_convertible<OtherT, T>::value>::type * =
nullptr) {
moveConstruct(std::move(Other)); moveConstruct(std::move(Other));
} }
@ -128,8 +123,7 @@ public:
template <class OtherT> template <class OtherT>
explicit ErrorOr( explicit ErrorOr(
ErrorOr<OtherT> &&Other, ErrorOr<OtherT> &&Other,
typename std::enable_if<!std::is_convertible<OtherT, T>::value>::type * = std::enable_if_t<!std::is_convertible<OtherT, T>::value> * = nullptr) {
nullptr) {
moveConstruct(std::move(Other)); moveConstruct(std::move(Other));
} }
@ -266,9 +260,9 @@ private:
}; };
template <class T, class E> template <class T, class E>
typename std::enable_if<std::is_error_code_enum<E>::value || std::enable_if_t<std::is_error_code_enum<E>::value ||
std::is_error_condition_enum<E>::value, std::is_error_condition_enum<E>::value,
bool>::type bool>
operator==(const ErrorOr<T> &Err, E Code) { operator==(const ErrorOr<T> &Err, E Code) {
return Err.getError() == Code; return Err.getError() == Code;
} }

View File

@ -124,7 +124,7 @@ protected:
template <typename T> template <typename T>
struct format_provider< struct format_provider<
T, typename std::enable_if<detail::use_integral_formatter<T>::value>::type> T, std::enable_if_t<detail::use_integral_formatter<T>::value>>
: public detail::HelperFunctions { : public detail::HelperFunctions {
private: private:
public: public:
@ -173,7 +173,7 @@ public:
/// cases indicates the minimum number of nibbles to print. /// cases indicates the minimum number of nibbles to print.
template <typename T> template <typename T>
struct format_provider< struct format_provider<
T, typename std::enable_if<detail::use_pointer_formatter<T>::value>::type> T, std::enable_if_t<detail::use_pointer_formatter<T>::value>>
: public detail::HelperFunctions { : public detail::HelperFunctions {
private: private:
public: public:
@ -198,7 +198,7 @@ public:
template <typename T> template <typename T>
struct format_provider< struct format_provider<
T, typename std::enable_if<detail::use_string_formatter<T>::value>::type> { T, std::enable_if_t<detail::use_string_formatter<T>::value>> {
static void format(const T &V, llvm::raw_ostream &Stream, StringRef Style) { static void format(const T &V, llvm::raw_ostream &Stream, StringRef Style) {
size_t N = StringRef::npos; size_t N = StringRef::npos;
if (!Style.empty() && Style.getAsInteger(10, N)) { if (!Style.empty() && Style.getAsInteger(10, N)) {
@ -230,8 +230,8 @@ template <> struct format_provider<Twine> {
/// character. Otherwise, it is treated as an integer options string. /// character. Otherwise, it is treated as an integer options string.
/// ///
template <typename T> template <typename T>
struct format_provider< struct format_provider<T,
T, typename std::enable_if<detail::use_char_formatter<T>::value>::type> { std::enable_if_t<detail::use_char_formatter<T>::value>> {
static void format(const char &V, llvm::raw_ostream &Stream, static void format(const char &V, llvm::raw_ostream &Stream,
StringRef Style) { StringRef Style) {
if (Style.empty()) if (Style.empty())
@ -296,8 +296,8 @@ template <> struct format_provider<bool> {
/// else. /// else.
template <typename T> template <typename T>
struct format_provider< struct format_provider<T,
T, typename std::enable_if<detail::use_double_formatter<T>::value>::type> std::enable_if_t<detail::use_double_formatter<T>::value>>
: public detail::HelperFunctions { : public detail::HelperFunctions {
static void format(const T &V, llvm::raw_ostream &Stream, StringRef Style) { static void format(const T &V, llvm::raw_ostream &Stream, StringRef Style) {
FloatStyle S; FloatStyle S;

View File

@ -36,7 +36,7 @@ public:
explicit provider_format_adapter(T &&Item) : Item(std::forward<T>(Item)) {} explicit provider_format_adapter(T &&Item) : Item(std::forward<T>(Item)) {}
void format(llvm::raw_ostream &S, StringRef Options) override { void format(llvm::raw_ostream &S, StringRef Options) override {
format_provider<typename std::decay<T>::type>::format(Item, S, Options); format_provider<std::decay_t<T>>::format(Item, S, Options);
} }
}; };
@ -59,7 +59,7 @@ template <typename T> class missing_format_adapter;
// //
template <class T> class has_FormatProvider { template <class T> class has_FormatProvider {
public: public:
using Decayed = typename std::decay<T>::type; using Decayed = std::decay_t<T>;
typedef void (*Signature_format)(const Decayed &, llvm::raw_ostream &, typedef void (*Signature_format)(const Decayed &, llvm::raw_ostream &,
StringRef); StringRef);
@ -75,14 +75,14 @@ public:
// Test if raw_ostream& << T -> raw_ostream& is findable via ADL. // Test if raw_ostream& << T -> raw_ostream& is findable via ADL.
template <class T> class has_StreamOperator { template <class T> class has_StreamOperator {
public: public:
using ConstRefT = const typename std::decay<T>::type &; using ConstRefT = const std::decay_t<T> &;
template <typename U> template <typename U>
static char test(typename std::enable_if< static char test(
std::is_same<decltype(std::declval<llvm::raw_ostream &>() std::enable_if_t<std::is_same<decltype(std::declval<llvm::raw_ostream &>()
<< std::declval<U>()), << std::declval<U>()),
llvm::raw_ostream &>::value, llvm::raw_ostream &>::value,
int *>::type); int *>);
template <typename U> static double test(...); template <typename U> static double test(...);
@ -95,8 +95,8 @@ template <typename T>
struct uses_format_member struct uses_format_member
: public std::integral_constant< : public std::integral_constant<
bool, bool,
std::is_base_of<format_adapter, std::is_base_of<format_adapter, std::remove_reference_t<T>>::value> {
typename std::remove_reference<T>::type>::value> {}; };
// Simple template that decides whether a type T should use the format_provider // Simple template that decides whether a type T should use the format_provider
// based format() invocation. The member function takes priority, so this test // based format() invocation. The member function takes priority, so this test
@ -127,34 +127,32 @@ struct uses_missing_provider
}; };
template <typename T> template <typename T>
typename std::enable_if<uses_format_member<T>::value, T>::type std::enable_if_t<uses_format_member<T>::value, T>
build_format_adapter(T &&Item) { build_format_adapter(T &&Item) {
return std::forward<T>(Item); return std::forward<T>(Item);
} }
template <typename T> template <typename T>
typename std::enable_if<uses_format_provider<T>::value, std::enable_if_t<uses_format_provider<T>::value, provider_format_adapter<T>>
provider_format_adapter<T>>::type
build_format_adapter(T &&Item) { build_format_adapter(T &&Item) {
return provider_format_adapter<T>(std::forward<T>(Item)); return provider_format_adapter<T>(std::forward<T>(Item));
} }
template <typename T> template <typename T>
typename std::enable_if<uses_stream_operator<T>::value, std::enable_if_t<uses_stream_operator<T>::value,
stream_operator_format_adapter<T>>::type stream_operator_format_adapter<T>>
build_format_adapter(T &&Item) { build_format_adapter(T &&Item) {
// If the caller passed an Error by value, then stream_operator_format_adapter // If the caller passed an Error by value, then stream_operator_format_adapter
// would be responsible for consuming it. // would be responsible for consuming it.
// Make the caller opt into this by calling fmt_consume(). // Make the caller opt into this by calling fmt_consume().
static_assert( static_assert(
!std::is_same<llvm::Error, typename std::remove_cv<T>::type>::value, !std::is_same<llvm::Error, std::remove_cv_t<T>>::value,
"llvm::Error-by-value must be wrapped in fmt_consume() for formatv"); "llvm::Error-by-value must be wrapped in fmt_consume() for formatv");
return stream_operator_format_adapter<T>(std::forward<T>(Item)); return stream_operator_format_adapter<T>(std::forward<T>(Item));
} }
template <typename T> template <typename T>
typename std::enable_if<uses_missing_provider<T>::value, std::enable_if_t<uses_missing_provider<T>::value, missing_format_adapter<T>>
missing_format_adapter<T>>::type
build_format_adapter(T &&Item) { build_format_adapter(T &&Item) {
return missing_format_adapter<T>(); return missing_format_adapter<T>();
} }

View File

@ -225,7 +225,7 @@ class DominatorTreeBase {
using ParentPtr = decltype(std::declval<NodeT *>()->getParent()); using ParentPtr = decltype(std::declval<NodeT *>()->getParent());
static_assert(std::is_pointer<ParentPtr>::value, static_assert(std::is_pointer<ParentPtr>::value,
"Currently NodeT's parent must be a pointer type"); "Currently NodeT's parent must be a pointer type");
using ParentType = typename std::remove_pointer<ParentPtr>::type; using ParentType = std::remove_pointer_t<ParentPtr>;
static constexpr bool IsPostDominator = IsPostDom; static constexpr bool IsPostDominator = IsPostDom;
using UpdateType = cfg::Update<NodePtr>; using UpdateType = cfg::Update<NodePtr>;

View File

@ -57,7 +57,7 @@ template <class NodeTy, bool IsPostDom> struct ChildrenGetterTy {
template <class NodeTy, bool IsPostDom> class IDFCalculatorBase { template <class NodeTy, bool IsPostDom> class IDFCalculatorBase {
public: public:
using OrderedNodeTy = using OrderedNodeTy =
typename std::conditional<IsPostDom, Inverse<NodeTy *>, NodeTy *>::type; std::conditional_t<IsPostDom, Inverse<NodeTy *>, NodeTy *>;
using ChildrenGetterTy = using ChildrenGetterTy =
IDFCalculatorDetail::ChildrenGetterTy<NodeTy, IsPostDom>; IDFCalculatorDetail::ChildrenGetterTy<NodeTy, IsPostDom>;

View File

@ -329,25 +329,21 @@ public:
Value(std::nullptr_t) : Type(T_Null) {} Value(std::nullptr_t) : Type(T_Null) {}
// Boolean (disallow implicit conversions). // Boolean (disallow implicit conversions).
// (The last template parameter is a dummy to keep templates distinct.) // (The last template parameter is a dummy to keep templates distinct.)
template < template <typename T,
typename T, typename = std::enable_if_t<std::is_same<T, bool>::value>,
typename = typename std::enable_if<std::is_same<T, bool>::value>::type, bool = false>
bool = false>
Value(T B) : Type(T_Boolean) { Value(T B) : Type(T_Boolean) {
create<bool>(B); create<bool>(B);
} }
// Integers (except boolean). Must be non-narrowing convertible to int64_t. // Integers (except boolean). Must be non-narrowing convertible to int64_t.
template < template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>,
typename T, typename = std::enable_if_t<!std::is_same<T, bool>::value>>
typename = typename std::enable_if<std::is_integral<T>::value>::type,
typename = typename std::enable_if<!std::is_same<T, bool>::value>::type>
Value(T I) : Type(T_Integer) { Value(T I) : Type(T_Integer) {
create<int64_t>(int64_t{I}); create<int64_t>(int64_t{I});
} }
// Floating point. Must be non-narrowing convertible to double. // Floating point. Must be non-narrowing convertible to double.
template <typename T, template <typename T,
typename = typename = std::enable_if_t<std::is_floating_point<T>::value>,
typename std::enable_if<std::is_floating_point<T>::value>::type,
double * = nullptr> double * = nullptr>
Value(T D) : Type(T_Double) { Value(T D) : Type(T_Double) {
create<double>(double{D}); create<double>(double{D});

View File

@ -59,22 +59,19 @@ public:
template <typename OtherT> template <typename OtherT>
MSVCPExpected( MSVCPExpected(
OtherT &&Val, OtherT &&Val,
typename std::enable_if<std::is_convertible<OtherT, T>::value>::type * = std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
nullptr)
: Expected<T>(std::move(Val)) {} : Expected<T>(std::move(Val)) {}
template <class OtherT> template <class OtherT>
MSVCPExpected( MSVCPExpected(
Expected<OtherT> &&Other, Expected<OtherT> &&Other,
typename std::enable_if<std::is_convertible<OtherT, T>::value>::type * = std::enable_if_t<std::is_convertible<OtherT, T>::value> * = nullptr)
nullptr)
: Expected<T>(std::move(Other)) {} : Expected<T>(std::move(Other)) {}
template <class OtherT> template <class OtherT>
explicit MSVCPExpected( explicit MSVCPExpected(
Expected<OtherT> &&Other, Expected<OtherT> &&Other,
typename std::enable_if<!std::is_convertible<OtherT, T>::value>::type * = std::enable_if_t<!std::is_convertible<OtherT, T>::value> * = nullptr)
nullptr)
: Expected<T>(std::move(Other)) {} : Expected<T>(std::move(Other)) {}
}; };

View File

@ -364,14 +364,12 @@ constexpr inline bool isShiftedInt(int64_t x) {
/// to keep MSVC from (incorrectly) warning on isUInt<64> that we're shifting /// to keep MSVC from (incorrectly) warning on isUInt<64> that we're shifting
/// left too many places. /// left too many places.
template <unsigned N> template <unsigned N>
constexpr inline typename std::enable_if<(N < 64), bool>::type constexpr inline std::enable_if_t<(N < 64), bool> isUInt(uint64_t X) {
isUInt(uint64_t X) {
static_assert(N > 0, "isUInt<0> doesn't make sense"); static_assert(N > 0, "isUInt<0> doesn't make sense");
return X < (UINT64_C(1) << (N)); return X < (UINT64_C(1) << (N));
} }
template <unsigned N> template <unsigned N>
constexpr inline typename std::enable_if<N >= 64, bool>::type constexpr inline std::enable_if_t<N >= 64, bool> isUInt(uint64_t X) {
isUInt(uint64_t X) {
return true; return true;
} }
@ -780,8 +778,7 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) {
/// Subtract two unsigned integers, X and Y, of type T and return the absolute /// Subtract two unsigned integers, X and Y, of type T and return the absolute
/// value of the result. /// value of the result.
template <typename T> template <typename T>
typename std::enable_if<std::is_unsigned<T>::value, T>::type std::enable_if_t<std::is_unsigned<T>::value, T> AbsoluteDifference(T X, T Y) {
AbsoluteDifference(T X, T Y) {
return std::max(X, Y) - std::min(X, Y); return std::max(X, Y) - std::min(X, Y);
} }
@ -789,7 +786,7 @@ AbsoluteDifference(T X, T Y) {
/// maximum representable value of T on overflow. ResultOverflowed indicates if /// maximum representable value of T on overflow. ResultOverflowed indicates if
/// the result is larger than the maximum representable value of type T. /// the result is larger than the maximum representable value of type T.
template <typename T> template <typename T>
typename std::enable_if<std::is_unsigned<T>::value, T>::type std::enable_if_t<std::is_unsigned<T>::value, T>
SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) { SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) {
bool Dummy; bool Dummy;
bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy; bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy;
@ -806,7 +803,7 @@ SaturatingAdd(T X, T Y, bool *ResultOverflowed = nullptr) {
/// maximum representable value of T on overflow. ResultOverflowed indicates if /// maximum representable value of T on overflow. ResultOverflowed indicates if
/// the result is larger than the maximum representable value of type T. /// the result is larger than the maximum representable value of type T.
template <typename T> template <typename T>
typename std::enable_if<std::is_unsigned<T>::value, T>::type std::enable_if_t<std::is_unsigned<T>::value, T>
SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) { SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) {
bool Dummy; bool Dummy;
bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy; bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy;
@ -852,7 +849,7 @@ SaturatingMultiply(T X, T Y, bool *ResultOverflowed = nullptr) {
/// overflow. ResultOverflowed indicates if the result is larger than the /// overflow. ResultOverflowed indicates if the result is larger than the
/// maximum representable value of type T. /// maximum representable value of type T.
template <typename T> template <typename T>
typename std::enable_if<std::is_unsigned<T>::value, T>::type std::enable_if_t<std::is_unsigned<T>::value, T>
SaturatingMultiplyAdd(T X, T Y, T A, bool *ResultOverflowed = nullptr) { SaturatingMultiplyAdd(T X, T Y, T A, bool *ResultOverflowed = nullptr) {
bool Dummy; bool Dummy;
bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy; bool &Overflowed = ResultOverflowed ? *ResultOverflowed : Dummy;
@ -871,13 +868,12 @@ extern const float huge_valf;
/// Add two signed integers, computing the two's complement truncated result, /// Add two signed integers, computing the two's complement truncated result,
/// returning true if overflow occured. /// returning true if overflow occured.
template <typename T> template <typename T>
typename std::enable_if<std::is_signed<T>::value, T>::type std::enable_if_t<std::is_signed<T>::value, T> AddOverflow(T X, T Y, T &Result) {
AddOverflow(T X, T Y, T &Result) {
#if __has_builtin(__builtin_add_overflow) #if __has_builtin(__builtin_add_overflow)
return __builtin_add_overflow(X, Y, &Result); return __builtin_add_overflow(X, Y, &Result);
#else #else
// Perform the unsigned addition. // Perform the unsigned addition.
using U = typename std::make_unsigned<T>::type; using U = std::make_unsigned_t<T>;
const U UX = static_cast<U>(X); const U UX = static_cast<U>(X);
const U UY = static_cast<U>(Y); const U UY = static_cast<U>(Y);
const U UResult = UX + UY; const U UResult = UX + UY;
@ -898,13 +894,12 @@ AddOverflow(T X, T Y, T &Result) {
/// Subtract two signed integers, computing the two's complement truncated /// Subtract two signed integers, computing the two's complement truncated
/// result, returning true if an overflow ocurred. /// result, returning true if an overflow ocurred.
template <typename T> template <typename T>
typename std::enable_if<std::is_signed<T>::value, T>::type std::enable_if_t<std::is_signed<T>::value, T> SubOverflow(T X, T Y, T &Result) {
SubOverflow(T X, T Y, T &Result) {
#if __has_builtin(__builtin_sub_overflow) #if __has_builtin(__builtin_sub_overflow)
return __builtin_sub_overflow(X, Y, &Result); return __builtin_sub_overflow(X, Y, &Result);
#else #else
// Perform the unsigned addition. // Perform the unsigned addition.
using U = typename std::make_unsigned<T>::type; using U = std::make_unsigned_t<T>;
const U UX = static_cast<U>(X); const U UX = static_cast<U>(X);
const U UY = static_cast<U>(Y); const U UY = static_cast<U>(Y);
const U UResult = UX - UY; const U UResult = UX - UY;
@ -922,14 +917,12 @@ SubOverflow(T X, T Y, T &Result) {
#endif #endif
} }
/// Multiply two signed integers, computing the two's complement truncated /// Multiply two signed integers, computing the two's complement truncated
/// result, returning true if an overflow ocurred. /// result, returning true if an overflow ocurred.
template <typename T> template <typename T>
typename std::enable_if<std::is_signed<T>::value, T>::type std::enable_if_t<std::is_signed<T>::value, T> MulOverflow(T X, T Y, T &Result) {
MulOverflow(T X, T Y, T &Result) {
// Perform the unsigned multiplication on absolute values. // Perform the unsigned multiplication on absolute values.
using U = typename std::make_unsigned<T>::type; using U = std::make_unsigned_t<T>;
const U UX = X < 0 ? (0 - static_cast<U>(X)) : static_cast<U>(X); const U UX = X < 0 ? (0 - static_cast<U>(X)) : static_cast<U>(X);
const U UY = Y < 0 ? (0 - static_cast<U>(Y)) : static_cast<U>(Y); const U UY = Y < 0 ? (0 - static_cast<U>(Y)) : static_cast<U>(Y);
const U UResult = UX * UY; const U UResult = UX * UY;

View File

@ -143,10 +143,9 @@ inline double getSwappedBytes(double C) {
} }
template <typename T> template <typename T>
inline typename std::enable_if<std::is_enum<T>::value, T>::type inline std::enable_if_t<std::is_enum<T>::value, T> getSwappedBytes(T C) {
getSwappedBytes(T C) {
return static_cast<T>( return static_cast<T>(
getSwappedBytes(static_cast<typename std::underlying_type<T>::type>(C))); getSwappedBytes(static_cast<std::underlying_type_t<T>>(C)));
} }
template<typename T> template<typename T>

View File

@ -38,7 +38,7 @@ class TaskQueue {
// type-specialized domain (before type erasure) and then erase this into a // type-specialized domain (before type erasure) and then erase this into a
// std::function. // std::function.
template <typename Callable> struct Task { template <typename Callable> struct Task {
using ResultTy = typename std::result_of<Callable()>::type; using ResultTy = std::result_of_t<Callable()>;
explicit Task(Callable C, TaskQueue &Parent) explicit Task(Callable C, TaskQueue &Parent)
: C(std::move(C)), P(std::make_shared<std::promise<ResultTy>>()), : C(std::move(C)), P(std::make_shared<std::promise<ResultTy>>()),
Parent(&Parent) {} Parent(&Parent) {}
@ -78,13 +78,13 @@ public:
/// used to wait for the task (and all previous tasks that have not yet /// used to wait for the task (and all previous tasks that have not yet
/// completed) to finish. /// completed) to finish.
template <typename Callable> template <typename Callable>
std::future<typename std::result_of<Callable()>::type> async(Callable &&C) { std::future<std::result_of_t<Callable()>> async(Callable &&C) {
#if !LLVM_ENABLE_THREADS #if !LLVM_ENABLE_THREADS
static_assert(false, static_assert(false,
"TaskQueue requires building with LLVM_ENABLE_THREADS!"); "TaskQueue requires building with LLVM_ENABLE_THREADS!");
#endif #endif
Task<Callable> T{std::move(C), *this}; Task<Callable> T{std::move(C), *this};
using ResultTy = typename std::result_of<Callable()>::type; using ResultTy = std::result_of_t<Callable()>;
std::future<ResultTy> F = T.P->get_future(); std::future<ResultTy> F = T.P->get_future();
{ {
std::lock_guard<std::mutex> Lock(QueueLock); std::lock_guard<std::mutex> Lock(QueueLock);

View File

@ -326,8 +326,8 @@ public:
/// used in the class; they are supplied here redundantly only so /// used in the class; they are supplied here redundantly only so
/// that it's clear what the counts are counting in callers. /// that it's clear what the counts are counting in callers.
template <typename... Tys> template <typename... Tys>
static constexpr typename std::enable_if< static constexpr std::enable_if_t<
std::is_same<Foo<TrailingTys...>, Foo<Tys...>>::value, size_t>::type std::is_same<Foo<TrailingTys...>, Foo<Tys...>>::value, size_t>
additionalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< additionalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType<
TrailingTys, size_t>::type... Counts) { TrailingTys, size_t>::type... Counts) {
return ParentType::additionalSizeToAllocImpl(0, Counts...); return ParentType::additionalSizeToAllocImpl(0, Counts...);
@ -338,8 +338,8 @@ public:
/// additionalSizeToAlloc, except it *does* include the size of the base /// additionalSizeToAlloc, except it *does* include the size of the base
/// object. /// object.
template <typename... Tys> template <typename... Tys>
static constexpr typename std::enable_if< static constexpr std::enable_if_t<
std::is_same<Foo<TrailingTys...>, Foo<Tys...>>::value, size_t>::type std::is_same<Foo<TrailingTys...>, Foo<Tys...>>::value, size_t>
totalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< totalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType<
TrailingTys, size_t>::type... Counts) { TrailingTys, size_t>::type... Counts) {
return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, Counts...); return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, Counts...);

View File

@ -868,7 +868,7 @@ public:
} }
template <typename T, typename Context> template <typename T, typename Context>
typename std::enable_if<has_SequenceTraits<T>::value, void>::type std::enable_if_t<has_SequenceTraits<T>::value, void>
mapOptionalWithContext(const char *Key, T &Val, Context &Ctx) { mapOptionalWithContext(const char *Key, T &Val, Context &Ctx) {
// omit key/value instead of outputting empty sequence // omit key/value instead of outputting empty sequence
if (this->canElideEmptySequence() && !(Val.begin() != Val.end())) if (this->canElideEmptySequence() && !(Val.begin() != Val.end()))
@ -883,7 +883,7 @@ public:
} }
template <typename T, typename Context> template <typename T, typename Context>
typename std::enable_if<!has_SequenceTraits<T>::value, void>::type std::enable_if_t<!has_SequenceTraits<T>::value, void>
mapOptionalWithContext(const char *Key, T &Val, Context &Ctx) { mapOptionalWithContext(const char *Key, T &Val, Context &Ctx) {
this->processKey(Key, Val, false, Ctx); this->processKey(Key, Val, false, Ctx);
} }
@ -965,7 +965,7 @@ template <typename T> void doMapping(IO &io, T &Val, EmptyContext &Ctx) {
} // end namespace detail } // end namespace detail
template <typename T> template <typename T>
typename std::enable_if<has_ScalarEnumerationTraits<T>::value, void>::type std::enable_if_t<has_ScalarEnumerationTraits<T>::value, void>
yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
io.beginEnumScalar(); io.beginEnumScalar();
ScalarEnumerationTraits<T>::enumeration(io, Val); ScalarEnumerationTraits<T>::enumeration(io, Val);
@ -973,7 +973,7 @@ yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
} }
template <typename T> template <typename T>
typename std::enable_if<has_ScalarBitSetTraits<T>::value, void>::type std::enable_if_t<has_ScalarBitSetTraits<T>::value, void>
yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
bool DoClear; bool DoClear;
if ( io.beginBitSetScalar(DoClear) ) { if ( io.beginBitSetScalar(DoClear) ) {
@ -985,8 +985,8 @@ yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
} }
template <typename T> template <typename T>
typename std::enable_if<has_ScalarTraits<T>::value, void>::type std::enable_if_t<has_ScalarTraits<T>::value, void> yamlize(IO &io, T &Val, bool,
yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { EmptyContext &Ctx) {
if ( io.outputting() ) { if ( io.outputting() ) {
std::string Storage; std::string Storage;
raw_string_ostream Buffer(Storage); raw_string_ostream Buffer(Storage);
@ -1005,7 +1005,7 @@ yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
} }
template <typename T> template <typename T>
typename std::enable_if<has_BlockScalarTraits<T>::value, void>::type std::enable_if_t<has_BlockScalarTraits<T>::value, void>
yamlize(IO &YamlIO, T &Val, bool, EmptyContext &Ctx) { yamlize(IO &YamlIO, T &Val, bool, EmptyContext &Ctx) {
if (YamlIO.outputting()) { if (YamlIO.outputting()) {
std::string Storage; std::string Storage;
@ -1024,7 +1024,7 @@ yamlize(IO &YamlIO, T &Val, bool, EmptyContext &Ctx) {
} }
template <typename T> template <typename T>
typename std::enable_if<has_TaggedScalarTraits<T>::value, void>::type std::enable_if_t<has_TaggedScalarTraits<T>::value, void>
yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
if (io.outputting()) { if (io.outputting()) {
std::string ScalarStorage, TagStorage; std::string ScalarStorage, TagStorage;
@ -1049,7 +1049,7 @@ yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
} }
template <typename T, typename Context> template <typename T, typename Context>
typename std::enable_if<validatedMappingTraits<T, Context>::value, void>::type std::enable_if_t<validatedMappingTraits<T, Context>::value, void>
yamlize(IO &io, T &Val, bool, Context &Ctx) { yamlize(IO &io, T &Val, bool, Context &Ctx) {
if (has_FlowTraits<MappingTraits<T>>::value) if (has_FlowTraits<MappingTraits<T>>::value)
io.beginFlowMapping(); io.beginFlowMapping();
@ -1075,7 +1075,7 @@ yamlize(IO &io, T &Val, bool, Context &Ctx) {
} }
template <typename T, typename Context> template <typename T, typename Context>
typename std::enable_if<unvalidatedMappingTraits<T, Context>::value, void>::type std::enable_if_t<unvalidatedMappingTraits<T, Context>::value, void>
yamlize(IO &io, T &Val, bool, Context &Ctx) { yamlize(IO &io, T &Val, bool, Context &Ctx) {
if (has_FlowTraits<MappingTraits<T>>::value) { if (has_FlowTraits<MappingTraits<T>>::value) {
io.beginFlowMapping(); io.beginFlowMapping();
@ -1089,7 +1089,7 @@ yamlize(IO &io, T &Val, bool, Context &Ctx) {
} }
template <typename T> template <typename T>
typename std::enable_if<has_CustomMappingTraits<T>::value, void>::type std::enable_if_t<has_CustomMappingTraits<T>::value, void>
yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
if ( io.outputting() ) { if ( io.outputting() ) {
io.beginMapping(); io.beginMapping();
@ -1104,7 +1104,7 @@ yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
} }
template <typename T> template <typename T>
typename std::enable_if<has_PolymorphicTraits<T>::value, void>::type std::enable_if_t<has_PolymorphicTraits<T>::value, void>
yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
switch (io.outputting() ? PolymorphicTraits<T>::getKind(Val) switch (io.outputting() ? PolymorphicTraits<T>::getKind(Val)
: io.getNodeKind()) { : io.getNodeKind()) {
@ -1118,13 +1118,13 @@ yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
} }
template <typename T> template <typename T>
typename std::enable_if<missingTraits<T, EmptyContext>::value, void>::type std::enable_if_t<missingTraits<T, EmptyContext>::value, void>
yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) { yamlize(IO &io, T &Val, bool, EmptyContext &Ctx) {
char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)]; char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)];
} }
template <typename T, typename Context> template <typename T, typename Context>
typename std::enable_if<has_SequenceTraits<T>::value, void>::type std::enable_if_t<has_SequenceTraits<T>::value, void>
yamlize(IO &io, T &Seq, bool, Context &Ctx) { yamlize(IO &io, T &Seq, bool, Context &Ctx) {
if ( has_FlowTraits< SequenceTraits<T>>::value ) { if ( has_FlowTraits< SequenceTraits<T>>::value ) {
unsigned incnt = io.beginFlowSequence(); unsigned incnt = io.beginFlowSequence();
@ -1247,10 +1247,9 @@ struct ScalarTraits<double> {
// type. This way endian aware types are supported whenever the traits are // type. This way endian aware types are supported whenever the traits are
// defined for the underlying type. // defined for the underlying type.
template <typename value_type, support::endianness endian, size_t alignment> template <typename value_type, support::endianness endian, size_t alignment>
struct ScalarTraits< struct ScalarTraits<support::detail::packed_endian_specific_integral<
support::detail::packed_endian_specific_integral<value_type, endian, value_type, endian, alignment>,
alignment>, std::enable_if_t<has_ScalarTraits<value_type>::value>> {
typename std::enable_if<has_ScalarTraits<value_type>::value>::type> {
using endian_type = using endian_type =
support::detail::packed_endian_specific_integral<value_type, endian, support::detail::packed_endian_specific_integral<value_type, endian,
alignment>; alignment>;
@ -1275,8 +1274,7 @@ template <typename value_type, support::endianness endian, size_t alignment>
struct ScalarEnumerationTraits< struct ScalarEnumerationTraits<
support::detail::packed_endian_specific_integral<value_type, endian, support::detail::packed_endian_specific_integral<value_type, endian,
alignment>, alignment>,
typename std::enable_if< std::enable_if_t<has_ScalarEnumerationTraits<value_type>::value>> {
has_ScalarEnumerationTraits<value_type>::value>::type> {
using endian_type = using endian_type =
support::detail::packed_endian_specific_integral<value_type, endian, support::detail::packed_endian_specific_integral<value_type, endian,
alignment>; alignment>;
@ -1292,7 +1290,7 @@ template <typename value_type, support::endianness endian, size_t alignment>
struct ScalarBitSetTraits< struct ScalarBitSetTraits<
support::detail::packed_endian_specific_integral<value_type, endian, support::detail::packed_endian_specific_integral<value_type, endian,
alignment>, alignment>,
typename std::enable_if<has_ScalarBitSetTraits<value_type>::value>::type> { std::enable_if_t<has_ScalarBitSetTraits<value_type>::value>> {
using endian_type = using endian_type =
support::detail::packed_endian_specific_integral<value_type, endian, support::detail::packed_endian_specific_integral<value_type, endian,
alignment>; alignment>;
@ -1688,8 +1686,7 @@ struct ScalarTraits<Hex64> {
// Define non-member operator>> so that Input can stream in a document list. // Define non-member operator>> so that Input can stream in a document list.
template <typename T> template <typename T>
inline inline std::enable_if_t<has_DocumentListTraits<T>::value, Input &>
typename std::enable_if<has_DocumentListTraits<T>::value, Input &>::type
operator>>(Input &yin, T &docList) { operator>>(Input &yin, T &docList) {
int i = 0; int i = 0;
EmptyContext Ctx; EmptyContext Ctx;
@ -1705,8 +1702,7 @@ operator>>(Input &yin, T &docList) {
// Define non-member operator>> so that Input can stream in a map as a document. // Define non-member operator>> so that Input can stream in a map as a document.
template <typename T> template <typename T>
inline typename std::enable_if<has_MappingTraits<T, EmptyContext>::value, inline std::enable_if_t<has_MappingTraits<T, EmptyContext>::value, Input &>
Input &>::type
operator>>(Input &yin, T &docMap) { operator>>(Input &yin, T &docMap) {
EmptyContext Ctx; EmptyContext Ctx;
yin.setCurrentDocument(); yin.setCurrentDocument();
@ -1717,8 +1713,7 @@ operator>>(Input &yin, T &docMap) {
// Define non-member operator>> so that Input can stream in a sequence as // Define non-member operator>> so that Input can stream in a sequence as
// a document. // a document.
template <typename T> template <typename T>
inline inline std::enable_if_t<has_SequenceTraits<T>::value, Input &>
typename std::enable_if<has_SequenceTraits<T>::value, Input &>::type
operator>>(Input &yin, T &docSeq) { operator>>(Input &yin, T &docSeq) {
EmptyContext Ctx; EmptyContext Ctx;
if (yin.setCurrentDocument()) if (yin.setCurrentDocument())
@ -1728,8 +1723,7 @@ operator>>(Input &yin, T &docSeq) {
// Define non-member operator>> so that Input can stream in a block scalar. // Define non-member operator>> so that Input can stream in a block scalar.
template <typename T> template <typename T>
inline inline std::enable_if_t<has_BlockScalarTraits<T>::value, Input &>
typename std::enable_if<has_BlockScalarTraits<T>::value, Input &>::type
operator>>(Input &In, T &Val) { operator>>(Input &In, T &Val) {
EmptyContext Ctx; EmptyContext Ctx;
if (In.setCurrentDocument()) if (In.setCurrentDocument())
@ -1739,8 +1733,7 @@ operator>>(Input &In, T &Val) {
// Define non-member operator>> so that Input can stream in a string map. // Define non-member operator>> so that Input can stream in a string map.
template <typename T> template <typename T>
inline inline std::enable_if_t<has_CustomMappingTraits<T>::value, Input &>
typename std::enable_if<has_CustomMappingTraits<T>::value, Input &>::type
operator>>(Input &In, T &Val) { operator>>(Input &In, T &Val) {
EmptyContext Ctx; EmptyContext Ctx;
if (In.setCurrentDocument()) if (In.setCurrentDocument())
@ -1750,7 +1743,7 @@ operator>>(Input &In, T &Val) {
// Define non-member operator>> so that Input can stream in a polymorphic type. // Define non-member operator>> so that Input can stream in a polymorphic type.
template <typename T> template <typename T>
inline typename std::enable_if<has_PolymorphicTraits<T>::value, Input &>::type inline std::enable_if_t<has_PolymorphicTraits<T>::value, Input &>
operator>>(Input &In, T &Val) { operator>>(Input &In, T &Val) {
EmptyContext Ctx; EmptyContext Ctx;
if (In.setCurrentDocument()) if (In.setCurrentDocument())
@ -1760,8 +1753,7 @@ operator>>(Input &In, T &Val) {
// Provide better error message about types missing a trait specialization // Provide better error message about types missing a trait specialization
template <typename T> template <typename T>
inline typename std::enable_if<missingTraits<T, EmptyContext>::value, inline std::enable_if_t<missingTraits<T, EmptyContext>::value, Input &>
Input &>::type
operator>>(Input &yin, T &docSeq) { operator>>(Input &yin, T &docSeq) {
char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)]; char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)];
return yin; return yin;
@ -1769,8 +1761,7 @@ operator>>(Input &yin, T &docSeq) {
// Define non-member operator<< so that Output can stream out document list. // Define non-member operator<< so that Output can stream out document list.
template <typename T> template <typename T>
inline inline std::enable_if_t<has_DocumentListTraits<T>::value, Output &>
typename std::enable_if<has_DocumentListTraits<T>::value, Output &>::type
operator<<(Output &yout, T &docList) { operator<<(Output &yout, T &docList) {
EmptyContext Ctx; EmptyContext Ctx;
yout.beginDocuments(); yout.beginDocuments();
@ -1788,8 +1779,7 @@ operator<<(Output &yout, T &docList) {
// Define non-member operator<< so that Output can stream out a map. // Define non-member operator<< so that Output can stream out a map.
template <typename T> template <typename T>
inline typename std::enable_if<has_MappingTraits<T, EmptyContext>::value, inline std::enable_if_t<has_MappingTraits<T, EmptyContext>::value, Output &>
Output &>::type
operator<<(Output &yout, T &map) { operator<<(Output &yout, T &map) {
EmptyContext Ctx; EmptyContext Ctx;
yout.beginDocuments(); yout.beginDocuments();
@ -1803,8 +1793,7 @@ operator<<(Output &yout, T &map) {
// Define non-member operator<< so that Output can stream out a sequence. // Define non-member operator<< so that Output can stream out a sequence.
template <typename T> template <typename T>
inline inline std::enable_if_t<has_SequenceTraits<T>::value, Output &>
typename std::enable_if<has_SequenceTraits<T>::value, Output &>::type
operator<<(Output &yout, T &seq) { operator<<(Output &yout, T &seq) {
EmptyContext Ctx; EmptyContext Ctx;
yout.beginDocuments(); yout.beginDocuments();
@ -1818,8 +1807,7 @@ operator<<(Output &yout, T &seq) {
// Define non-member operator<< so that Output can stream out a block scalar. // Define non-member operator<< so that Output can stream out a block scalar.
template <typename T> template <typename T>
inline inline std::enable_if_t<has_BlockScalarTraits<T>::value, Output &>
typename std::enable_if<has_BlockScalarTraits<T>::value, Output &>::type
operator<<(Output &Out, T &Val) { operator<<(Output &Out, T &Val) {
EmptyContext Ctx; EmptyContext Ctx;
Out.beginDocuments(); Out.beginDocuments();
@ -1833,8 +1821,7 @@ operator<<(Output &Out, T &Val) {
// Define non-member operator<< so that Output can stream out a string map. // Define non-member operator<< so that Output can stream out a string map.
template <typename T> template <typename T>
inline inline std::enable_if_t<has_CustomMappingTraits<T>::value, Output &>
typename std::enable_if<has_CustomMappingTraits<T>::value, Output &>::type
operator<<(Output &Out, T &Val) { operator<<(Output &Out, T &Val) {
EmptyContext Ctx; EmptyContext Ctx;
Out.beginDocuments(); Out.beginDocuments();
@ -1849,7 +1836,7 @@ operator<<(Output &Out, T &Val) {
// Define non-member operator<< so that Output can stream out a polymorphic // Define non-member operator<< so that Output can stream out a polymorphic
// type. // type.
template <typename T> template <typename T>
inline typename std::enable_if<has_PolymorphicTraits<T>::value, Output &>::type inline std::enable_if_t<has_PolymorphicTraits<T>::value, Output &>
operator<<(Output &Out, T &Val) { operator<<(Output &Out, T &Val) {
EmptyContext Ctx; EmptyContext Ctx;
Out.beginDocuments(); Out.beginDocuments();
@ -1866,8 +1853,7 @@ operator<<(Output &Out, T &Val) {
// Provide better error message about types missing a trait specialization // Provide better error message about types missing a trait specialization
template <typename T> template <typename T>
inline typename std::enable_if<missingTraits<T, EmptyContext>::value, inline std::enable_if_t<missingTraits<T, EmptyContext>::value, Output &>
Output &>::type
operator<<(Output &yout, T &seq) { operator<<(Output &yout, T &seq) {
char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)]; char missing_yaml_trait_for_type[sizeof(MissingTrait<T>)];
return yout; return yout;
@ -1898,25 +1884,25 @@ template <bool> struct CheckIsBool { static const bool value = true; };
// If T has SequenceElementTraits, then vector<T> and SmallVector<T, N> have // If T has SequenceElementTraits, then vector<T> and SmallVector<T, N> have
// SequenceTraits that do the obvious thing. // SequenceTraits that do the obvious thing.
template <typename T> template <typename T>
struct SequenceTraits<std::vector<T>, struct SequenceTraits<
typename std::enable_if<CheckIsBool< std::vector<T>,
SequenceElementTraits<T>::flow>::value>::type> std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
: SequenceTraitsImpl<std::vector<T>, SequenceElementTraits<T>::flow> {}; : SequenceTraitsImpl<std::vector<T>, SequenceElementTraits<T>::flow> {};
template <typename T, unsigned N> template <typename T, unsigned N>
struct SequenceTraits<SmallVector<T, N>, struct SequenceTraits<
typename std::enable_if<CheckIsBool< SmallVector<T, N>,
SequenceElementTraits<T>::flow>::value>::type> std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
: SequenceTraitsImpl<SmallVector<T, N>, SequenceElementTraits<T>::flow> {}; : SequenceTraitsImpl<SmallVector<T, N>, SequenceElementTraits<T>::flow> {};
template <typename T> template <typename T>
struct SequenceTraits<SmallVectorImpl<T>, struct SequenceTraits<
typename std::enable_if<CheckIsBool< SmallVectorImpl<T>,
SequenceElementTraits<T>::flow>::value>::type> std::enable_if_t<CheckIsBool<SequenceElementTraits<T>::flow>::value>>
: SequenceTraitsImpl<SmallVectorImpl<T>, SequenceElementTraits<T>::flow> {}; : SequenceTraitsImpl<SmallVectorImpl<T>, SequenceElementTraits<T>::flow> {};
// Sequences of fundamental types use flow formatting. // Sequences of fundamental types use flow formatting.
template <typename T> template <typename T>
struct SequenceElementTraits< struct SequenceElementTraits<T,
T, typename std::enable_if<std::is_fundamental<T>::value>::type> { std::enable_if_t<std::is_fundamental<T>::value>> {
static const bool flow = true; static const bool flow = true;
}; };

View File

@ -358,9 +358,9 @@ private:
/// Call the appropriate insertion operator, given an rvalue reference to a /// 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. /// raw_ostream object and return a stream of the same type as the argument.
template <typename OStream, typename T> template <typename OStream, typename T>
typename std::enable_if<!std::is_reference<OStream>::value && std::enable_if_t<!std::is_reference<OStream>::value &&
std::is_base_of<raw_ostream, OStream>::value, std::is_base_of<raw_ostream, OStream>::value,
OStream &&>::type OStream &&>
operator<<(OStream &&OS, const T &Value) { operator<<(OStream &&OS, const T &Value) {
OS << Value; OS << Value;
return std::move(OS); return std::move(OS);

View File

@ -28,7 +28,7 @@ namespace llvm {
/// Also note that enum classes aren't implicitly convertible to integral types, /// Also note that enum classes aren't implicitly convertible to integral types,
/// the value may therefore need to be explicitly converted before being used. /// the value may therefore need to be explicitly converted before being used.
template <typename T> class is_integral_or_enum { template <typename T> class is_integral_or_enum {
using UnderlyingT = typename std::remove_reference<T>::type; using UnderlyingT = std::remove_reference_t<T>;
public: public:
static const bool value = static const bool value =
@ -45,7 +45,7 @@ struct add_lvalue_reference_if_not_pointer { using type = T &; };
template <typename T> template <typename T>
struct add_lvalue_reference_if_not_pointer< struct add_lvalue_reference_if_not_pointer<
T, typename std::enable_if<std::is_pointer<T>::value>::type> { T, std::enable_if_t<std::is_pointer<T>::value>> {
using type = T; using type = T;
}; };
@ -55,9 +55,8 @@ template<typename T, typename Enable = void>
struct add_const_past_pointer { using type = const T; }; struct add_const_past_pointer { using type = const T; };
template <typename T> template <typename T>
struct add_const_past_pointer< struct add_const_past_pointer<T, std::enable_if_t<std::is_pointer<T>::value>> {
T, typename std::enable_if<std::is_pointer<T>::value>::type> { using type = const std::remove_pointer_t<T> *;
using type = const typename std::remove_pointer<T>::type *;
}; };
template <typename T, typename Enable = void> template <typename T, typename Enable = void>
@ -65,8 +64,8 @@ struct const_pointer_or_const_ref {
using type = const T &; using type = const T &;
}; };
template <typename T> template <typename T>
struct const_pointer_or_const_ref< struct const_pointer_or_const_ref<T,
T, typename std::enable_if<std::is_pointer<T>::value>::type> { std::enable_if_t<std::is_pointer<T>::value>> {
using type = typename add_const_past_pointer<T>::type; using type = typename add_const_past_pointer<T>::type;
}; };

View File

@ -126,14 +126,14 @@ private:
/// set. /// set.
template <bool IsConst, bool IsOut, template <bool IsConst, bool IsOut,
typename BaseIt = typename NeighborSetT::const_iterator, typename BaseIt = typename NeighborSetT::const_iterator,
typename T = typename std::conditional<IsConst, const EdgeValueType, typename T =
EdgeValueType>::type> std::conditional_t<IsConst, const EdgeValueType, EdgeValueType>>
class NeighborEdgeIteratorT class NeighborEdgeIteratorT
: public iterator_adaptor_base< : public iterator_adaptor_base<
NeighborEdgeIteratorT<IsConst, IsOut>, BaseIt, NeighborEdgeIteratorT<IsConst, IsOut>, BaseIt,
typename std::iterator_traits<BaseIt>::iterator_category, T> { typename std::iterator_traits<BaseIt>::iterator_category, T> {
using InternalEdgeMapT = using InternalEdgeMapT =
typename std::conditional<IsConst, const EdgeMapT, EdgeMapT>::type; std::conditional_t<IsConst, const EdgeMapT, EdgeMapT>;
friend class NeighborEdgeIteratorT<false, IsOut, BaseIt, EdgeValueType>; friend class NeighborEdgeIteratorT<false, IsOut, BaseIt, EdgeValueType>;
friend class NeighborEdgeIteratorT<true, IsOut, BaseIt, friend class NeighborEdgeIteratorT<true, IsOut, BaseIt,
@ -144,7 +144,7 @@ private:
public: public:
template <bool IsConstDest, template <bool IsConstDest,
typename = typename std::enable_if<IsConstDest && !IsConst>::type> typename = std::enable_if<IsConstDest && !IsConst>>
operator NeighborEdgeIteratorT<IsConstDest, IsOut, BaseIt, operator NeighborEdgeIteratorT<IsConstDest, IsOut, BaseIt,
const EdgeValueType>() const { const EdgeValueType>() const {
return NeighborEdgeIteratorT<IsConstDest, IsOut, BaseIt, return NeighborEdgeIteratorT<IsConstDest, IsOut, BaseIt,
@ -199,9 +199,9 @@ public:
public: public:
using iterator = NeighborEdgeIteratorT<isConst, isOut>; using iterator = NeighborEdgeIteratorT<isConst, isOut>;
using const_iterator = NeighborEdgeIteratorT<true, isOut>; using const_iterator = NeighborEdgeIteratorT<true, isOut>;
using GraphT = typename std::conditional<isConst, const Graph, Graph>::type; using GraphT = std::conditional_t<isConst, const Graph, Graph>;
using InternalEdgeMapT = using InternalEdgeMapT =
typename std::conditional<isConst, const EdgeMapT, EdgeMapT>::type; std::conditional_t<isConst, const EdgeMapT, EdgeMapT>;
private: private:
InternalEdgeMapT &M; InternalEdgeMapT &M;
@ -272,10 +272,10 @@ public:
/// the number of elements in the range and whether the range is empty. /// the number of elements in the range and whether the range is empty.
template <bool isConst> class VertexView { template <bool isConst> class VertexView {
public: public:
using iterator = typename std::conditional<isConst, ConstVertexIterator, using iterator =
VertexIterator>::type; std::conditional_t<isConst, ConstVertexIterator, VertexIterator>;
using const_iterator = ConstVertexIterator; using const_iterator = ConstVertexIterator;
using GraphT = typename std::conditional<isConst, const Graph, Graph>::type; using GraphT = std::conditional_t<isConst, const Graph, Graph>;
private: private:
GraphT &G; GraphT &G;
@ -309,10 +309,10 @@ public:
/// the number of elements in the range and whether the range is empty. /// the number of elements in the range and whether the range is empty.
template <bool isConst> class EdgeView { template <bool isConst> class EdgeView {
public: public:
using iterator = typename std::conditional<isConst, ConstEdgeIterator, using iterator =
EdgeIterator>::type; std::conditional_t<isConst, ConstEdgeIterator, EdgeIterator>;
using const_iterator = ConstEdgeIterator; using const_iterator = ConstEdgeIterator;
using GraphT = typename std::conditional<isConst, const Graph, Graph>::type; using GraphT = std::conditional_t<isConst, const Graph, Graph>;
private: private:
GraphT &G; GraphT &G;

View File

@ -107,13 +107,11 @@ struct DumpVisitor {
// Overload used when T is exactly 'bool', not merely convertible to 'bool'. // Overload used when T is exactly 'bool', not merely convertible to 'bool'.
void print(bool B) { printStr(B ? "true" : "false"); } void print(bool B) { printStr(B ? "true" : "false"); }
template <class T> template <class T> std::enable_if_t<std::is_unsigned<T>::value> print(T N) {
typename std::enable_if<std::is_unsigned<T>::value>::type print(T N) {
fprintf(stderr, "%llu", (unsigned long long)N); fprintf(stderr, "%llu", (unsigned long long)N);
} }
template <class T> template <class T> std::enable_if_t<std::is_signed<T>::value> print(T N) {
typename std::enable_if<std::is_signed<T>::value>::type print(T N) {
fprintf(stderr, "%lld", (long long)N); fprintf(stderr, "%lld", (long long)N);
} }

View File

@ -30,9 +30,8 @@ struct FoldingSetNodeIDBuilder {
void operator()(StringView Str) { void operator()(StringView Str) {
ID.AddString(llvm::StringRef(Str.begin(), Str.size())); ID.AddString(llvm::StringRef(Str.begin(), Str.size()));
} }
template<typename T> template <typename T>
typename std::enable_if<std::is_integral<T>::value || std::enable_if_t<std::is_integral<T>::value || std::is_enum<T>::value>
std::is_enum<T>::value>::type
operator()(T V) { operator()(T V) {
ID.AddInteger((unsigned long long)V); ID.AddInteger((unsigned long long)V);
} }

View File

@ -89,7 +89,7 @@ static void write_signed(raw_ostream &S, T N, size_t MinDigits,
IntegerStyle Style) { IntegerStyle Style) {
static_assert(std::is_signed<T>::value, "Value is not signed!"); static_assert(std::is_signed<T>::value, "Value is not signed!");
using UnsignedT = typename std::make_unsigned<T>::type; using UnsignedT = std::make_unsigned_t<T>;
if (N >= 0) { if (N >= 0) {
write_unsigned(S, static_cast<UnsignedT>(N), MinDigits, Style); write_unsigned(S, static_cast<UnsignedT>(N), MinDigits, Style);

View File

@ -757,8 +757,8 @@ public:
return false; return false;
int64_t Val = MCE->getValue(); int64_t Val = MCE->getValue();
int64_t SVal = typename std::make_signed<T>::type(Val); int64_t SVal = std::make_signed_t<T>(Val);
int64_t UVal = typename std::make_unsigned<T>::type(Val); int64_t UVal = std::make_unsigned_t<T>(Val);
if (Val != SVal && Val != UVal) if (Val != SVal && Val != UVal)
return false; return false;
@ -854,8 +854,7 @@ public:
if (!isShiftedImm() && (!isImm() || !isa<MCConstantExpr>(getImm()))) if (!isShiftedImm() && (!isImm() || !isa<MCConstantExpr>(getImm())))
return DiagnosticPredicateTy::NoMatch; return DiagnosticPredicateTy::NoMatch;
bool IsByte = bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value;
std::is_same<int8_t, typename std::make_signed<T>::type>::value;
if (auto ShiftedImm = getShiftedVal<8>()) if (auto ShiftedImm = getShiftedVal<8>())
if (!(IsByte && ShiftedImm->second) && if (!(IsByte && ShiftedImm->second) &&
AArch64_AM::isSVECpyImm<T>(uint64_t(ShiftedImm->first) AArch64_AM::isSVECpyImm<T>(uint64_t(ShiftedImm->first)
@ -872,8 +871,7 @@ public:
if (!isShiftedImm() && (!isImm() || !isa<MCConstantExpr>(getImm()))) if (!isShiftedImm() && (!isImm() || !isa<MCConstantExpr>(getImm())))
return DiagnosticPredicateTy::NoMatch; return DiagnosticPredicateTy::NoMatch;
bool IsByte = bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value;
std::is_same<int8_t, typename std::make_signed<T>::type>::value;
if (auto ShiftedImm = getShiftedVal<8>()) if (auto ShiftedImm = getShiftedVal<8>())
if (!(IsByte && ShiftedImm->second) && if (!(IsByte && ShiftedImm->second) &&
AArch64_AM::isSVEAddSubImm<T>(ShiftedImm->first AArch64_AM::isSVEAddSubImm<T>(ShiftedImm->first
@ -1610,7 +1608,7 @@ public:
void addLogicalImmOperands(MCInst &Inst, unsigned N) const { void addLogicalImmOperands(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!"); assert(N == 1 && "Invalid number of operands!");
const MCConstantExpr *MCE = cast<MCConstantExpr>(getImm()); const MCConstantExpr *MCE = cast<MCConstantExpr>(getImm());
typename std::make_unsigned<T>::type Val = MCE->getValue(); std::make_unsigned_t<T> Val = MCE->getValue();
uint64_t encoding = AArch64_AM::encodeLogicalImmediate(Val, sizeof(T) * 8); uint64_t encoding = AArch64_AM::encodeLogicalImmediate(Val, sizeof(T) * 8);
Inst.addOperand(MCOperand::createImm(encoding)); Inst.addOperand(MCOperand::createImm(encoding));
} }
@ -1619,7 +1617,7 @@ public:
void addLogicalImmNotOperands(MCInst &Inst, unsigned N) const { void addLogicalImmNotOperands(MCInst &Inst, unsigned N) const {
assert(N == 1 && "Invalid number of operands!"); assert(N == 1 && "Invalid number of operands!");
const MCConstantExpr *MCE = cast<MCConstantExpr>(getImm()); const MCConstantExpr *MCE = cast<MCConstantExpr>(getImm());
typename std::make_unsigned<T>::type Val = ~MCE->getValue(); std::make_unsigned_t<T> Val = ~MCE->getValue();
uint64_t encoding = AArch64_AM::encodeLogicalImmediate(Val, sizeof(T) * 8); uint64_t encoding = AArch64_AM::encodeLogicalImmediate(Val, sizeof(T) * 8);
Inst.addOperand(MCOperand::createImm(encoding)); Inst.addOperand(MCOperand::createImm(encoding));
} }

View File

@ -763,10 +763,10 @@ static inline bool isSVECpyImm(int64_t Imm) {
bool IsImm8 = int8_t(Imm) == Imm; bool IsImm8 = int8_t(Imm) == Imm;
bool IsImm16 = int16_t(Imm & ~0xff) == Imm; bool IsImm16 = int16_t(Imm & ~0xff) == Imm;
if (std::is_same<int8_t, typename std::make_signed<T>::type>::value) if (std::is_same<int8_t, std::make_signed_t<T>>::value)
return IsImm8 || uint8_t(Imm) == Imm; return IsImm8 || uint8_t(Imm) == Imm;
if (std::is_same<int16_t, typename std::make_signed<T>::type>::value) if (std::is_same<int16_t, std::make_signed_t<T>>::value)
return IsImm8 || IsImm16 || uint16_t(Imm & ~0xff) == Imm; return IsImm8 || IsImm16 || uint16_t(Imm & ~0xff) == Imm;
return IsImm8 || IsImm16; return IsImm8 || IsImm16;
@ -775,8 +775,7 @@ static inline bool isSVECpyImm(int64_t Imm) {
/// Returns true if Imm is valid for ADD/SUB. /// Returns true if Imm is valid for ADD/SUB.
template <typename T> template <typename T>
static inline bool isSVEAddSubImm(int64_t Imm) { static inline bool isSVEAddSubImm(int64_t Imm) {
bool IsInt8t = bool IsInt8t = std::is_same<int8_t, std::make_signed_t<T>>::value;
std::is_same<int8_t, typename std::make_signed<T>::type>::value;
return uint8_t(Imm) == Imm || (!IsInt8t && uint16_t(Imm & ~0xff) == Imm); return uint8_t(Imm) == Imm || (!IsInt8t && uint16_t(Imm & ~0xff) == Imm);
} }

View File

@ -1511,7 +1511,7 @@ void AArch64InstPrinter::printSVERegOp(const MCInst *MI, unsigned OpNum,
template <typename T> template <typename T>
void AArch64InstPrinter::printImmSVE(T Value, raw_ostream &O) { void AArch64InstPrinter::printImmSVE(T Value, raw_ostream &O) {
typename std::make_unsigned<T>::type HexValue = Value; std::make_unsigned_t<T> HexValue = Value;
if (getPrintImmHex()) if (getPrintImmHex())
O << '#' << formatHex((uint64_t)HexValue); O << '#' << formatHex((uint64_t)HexValue);
@ -1556,8 +1556,8 @@ template <typename T>
void AArch64InstPrinter::printSVELogicalImm(const MCInst *MI, unsigned OpNum, void AArch64InstPrinter::printSVELogicalImm(const MCInst *MI, unsigned OpNum,
const MCSubtargetInfo &STI, const MCSubtargetInfo &STI,
raw_ostream &O) { raw_ostream &O) {
typedef typename std::make_signed<T>::type SignedT; typedef std::make_signed_t<T> SignedT;
typedef typename std::make_unsigned<T>::type UnsignedT; typedef std::make_unsigned_t<T> UnsignedT;
uint64_t Val = MI->getOperand(OpNum).getImm(); uint64_t Val = MI->getOperand(OpNum).getImm();
UnsignedT PrintVal = AArch64_AM::decodeLogicalImmediate(Val, 64); UnsignedT PrintVal = AArch64_AM::decodeLogicalImmediate(Val, 64);

View File

@ -20,10 +20,9 @@ namespace {
template <size_t Index> struct IndexedWriter { template <size_t Index> struct IndexedWriter {
template < template <
class Tuple, class Tuple,
typename std::enable_if< std::enable_if_t<(Index <
(Index < std::tuple_size<std::remove_reference_t<Tuple>>::value),
std::tuple_size<typename std::remove_reference<Tuple>::type>::value), int> = 0>
int>::type = 0>
static size_t write(support::endian::Writer &OS, Tuple &&T) { static size_t write(support::endian::Writer &OS, Tuple &&T) {
OS.write(std::get<Index>(T)); OS.write(std::get<Index>(T));
return sizeof(std::get<Index>(T)) + IndexedWriter<Index + 1>::write(OS, T); return sizeof(std::get<Index>(T)) + IndexedWriter<Index + 1>::write(OS, T);
@ -31,10 +30,9 @@ template <size_t Index> struct IndexedWriter {
template < template <
class Tuple, class Tuple,
typename std::enable_if< std::enable_if_t<(Index >=
(Index >= std::tuple_size<std::remove_reference_t<Tuple>>::value),
std::tuple_size<typename std::remove_reference<Tuple>::type>::value), int> = 0>
int>::type = 0>
static size_t write(support::endian::Writer &OS, Tuple &&) { static size_t write(support::endian::Writer &OS, Tuple &&) {
return 0; return 0;
} }

View File

@ -34,9 +34,8 @@ template <typename T> struct CFDeleter {
/// any valid pointer it owns unless that pointer is explicitly released using /// any valid pointer it owns unless that pointer is explicitly released using
/// the release() member function. /// the release() member function.
template <typename T> template <typename T>
using CFReleaser = using CFReleaser = std::unique_ptr<std::remove_pointer_t<T>,
std::unique_ptr<typename std::remove_pointer<T>::type, CFDeleter<std::remove_pointer_t<T>>>;
CFDeleter<typename std::remove_pointer<T>::type>>;
/// RAII wrapper around CFBundleRef. /// RAII wrapper around CFBundleRef.
class CFString : public CFReleaser<CFStringRef> { class CFString : public CFReleaser<CFStringRef> {

View File

@ -42,8 +42,7 @@ std::string truncateQuotedNameBack(StringRef Label, StringRef Name,
return Ret; return Ret;
template <typename T> std::string formatUnknownEnum(T Value) { template <typename T> std::string formatUnknownEnum(T Value) {
return formatv("unknown ({0})", return formatv("unknown ({0})", static_cast<std::underlying_type_t<T>>(Value))
static_cast<typename std::underlying_type<T>::type>(Value))
.str(); .str();
} }

View File

@ -48,7 +48,7 @@ template <typename T, typename Callable>
TrieNode<T> * TrieNode<T> *
mergeTrieNodes(const TrieNode<T> &Left, const TrieNode<T> &Right, mergeTrieNodes(const TrieNode<T> &Left, const TrieNode<T> &Right,
/*Non-deduced pointer type for nullptr compatibility*/ /*Non-deduced pointer type for nullptr compatibility*/
typename std::remove_reference<TrieNode<T> *>::type NewParent, std::remove_reference_t<TrieNode<T> *> NewParent,
std::forward_list<TrieNode<T>> &NodeStore, std::forward_list<TrieNode<T>> &NodeStore,
Callable &&MergeCallable) { Callable &&MergeCallable) {
llvm::function_ref<T(const T &, const T &)> MergeFn( llvm::function_ref<T(const T &, const T &)> MergeFn(

View File

@ -52,7 +52,7 @@ protected:
private: private:
static T GetTestSet() { static T GetTestSet() {
typename std::remove_const<T>::type Set; std::remove_const_t<T> Set;
Set.insert(0); Set.insert(0);
Set.insert(1); Set.insert(1);
Set.insert(2); Set.insert(2);

View File

@ -1319,8 +1319,8 @@ TYPED_TEST_CASE(MutableConstTest, MutableConstTestTypes);
TYPED_TEST(MutableConstTest, ICmp) { TYPED_TEST(MutableConstTest, ICmp) {
auto &IRB = PatternMatchTest::IRB; auto &IRB = PatternMatchTest::IRB;
typedef typename std::tuple_element<0, TypeParam>::type ValueType; typedef std::tuple_element_t<0, TypeParam> ValueType;
typedef typename std::tuple_element<1, TypeParam>::type InstructionType; typedef std::tuple_element_t<1, TypeParam> InstructionType;
Value *L = IRB.getInt32(1); Value *L = IRB.getInt32(1);
Value *R = IRB.getInt32(2); Value *R = IRB.getInt32(2);

View File

@ -34,7 +34,7 @@ protected:
private: private:
static T getTestGraph() { static T getTestGraph() {
using std::make_pair; using std::make_pair;
typename std::remove_const<T>::type G; std::remove_const_t<T> G;
G.insert(make_pair(1u, VAttr({3u}))); G.insert(make_pair(1u, VAttr({3u})));
G.insert(make_pair(2u, VAttr({5u}))); G.insert(make_pair(2u, VAttr({5u})));
G.insert(make_pair(3u, VAttr({7u}))); G.insert(make_pair(3u, VAttr({7u})));

View File

@ -990,8 +990,7 @@ inline internal::Benchmark* RegisterBenchmark(const char* name,
#ifdef BENCHMARK_HAS_CXX11 #ifdef BENCHMARK_HAS_CXX11
template <class Lambda> template <class Lambda>
internal::Benchmark* RegisterBenchmark(const char* name, Lambda&& fn) { internal::Benchmark* RegisterBenchmark(const char* name, Lambda&& fn) {
using BenchType = using BenchType = internal::LambdaBenchmark<std::decay_t<Lambda>>;
internal::LambdaBenchmark<typename std::decay<Lambda>::type>;
return internal::RegisterBenchmarkInternal( return internal::RegisterBenchmarkInternal(
::new BenchType(name, std::forward<Lambda>(fn))); ::new BenchType(name, std::forward<Lambda>(fn)));
} }

View File

@ -176,9 +176,8 @@ bool GetSysctl(std::string const& Name, std::string* Out) {
return true; return true;
} }
template <class Tp, template <class Tp, class = std::enable_if_t<std::is_integral<Tp>::value>>
class = typename std::enable_if<std::is_integral<Tp>::value>::type> bool GetSysctl(std::string const &Name, Tp *Out) {
bool GetSysctl(std::string const& Name, Tp* Out) {
*Out = 0; *Out = 0;
auto Buff = GetSysctlImp(Name); auto Buff = GetSysctlImp(Name);
if (!Buff) return false; if (!Buff) return false;

View File

@ -3118,8 +3118,9 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
typedef typename View::const_reference StlContainerReference; typedef typename View::const_reference StlContainerReference;
typedef decltype(std::begin( typedef decltype(std::begin(
std::declval<StlContainerReference>())) StlContainerConstIterator; std::declval<StlContainerReference>())) StlContainerConstIterator;
typedef typename std::remove_reference<decltype( typedef std::remove_reference_t<decltype(
*std::declval<StlContainerConstIterator &>())>::type Element; *std::declval<StlContainerConstIterator &>())>
Element;
// Constructs the matcher from a sequence of element values or // Constructs the matcher from a sequence of element values or
// element matchers. // element matchers.
@ -3360,8 +3361,9 @@ class UnorderedElementsAreMatcherImpl
typedef typename View::const_reference StlContainerReference; typedef typename View::const_reference StlContainerReference;
typedef decltype(std::begin( typedef decltype(std::begin(
std::declval<StlContainerReference>())) StlContainerConstIterator; std::declval<StlContainerReference>())) StlContainerConstIterator;
typedef typename std::remove_reference<decltype( typedef std::remove_reference_t<decltype(
*std::declval<StlContainerConstIterator &>())>::type Element; *std::declval<StlContainerConstIterator &>())>
Element;
// Constructs the matcher from a sequence of element values or // Constructs the matcher from a sequence of element values or
// element matchers. // element matchers.
@ -3470,8 +3472,9 @@ class UnorderedElementsAreMatcher {
typedef typename View::const_reference StlContainerReference; typedef typename View::const_reference StlContainerReference;
typedef decltype(std::begin( typedef decltype(std::begin(
std::declval<StlContainerReference>())) StlContainerConstIterator; std::declval<StlContainerReference>())) StlContainerConstIterator;
typedef typename std::remove_reference<decltype( typedef std::remove_reference_t<decltype(
*std::declval<StlContainerConstIterator &>())>::type Element; *std::declval<StlContainerConstIterator &>())>
Element;
typedef ::std::vector<Matcher<const Element&> > MatcherVec; typedef ::std::vector<Matcher<const Element&> > MatcherVec;
MatcherVec matchers; MatcherVec matchers;
matchers.reserve(::testing::tuple_size<MatcherTuple>::value); matchers.reserve(::testing::tuple_size<MatcherTuple>::value);
@ -3499,8 +3502,9 @@ class ElementsAreMatcher {
typedef typename View::const_reference StlContainerReference; typedef typename View::const_reference StlContainerReference;
typedef decltype(std::begin( typedef decltype(std::begin(
std::declval<StlContainerReference>())) StlContainerConstIterator; std::declval<StlContainerReference>())) StlContainerConstIterator;
typedef typename std::remove_reference<decltype( typedef std::remove_reference_t<decltype(
*std::declval<StlContainerConstIterator &>())>::type Element; *std::declval<StlContainerConstIterator &>())>
Element;
typedef ::std::vector<Matcher<const Element&> > MatcherVec; typedef ::std::vector<Matcher<const Element&> > MatcherVec;
MatcherVec matchers; MatcherVec matchers;
matchers.reserve(::testing::tuple_size<MatcherTuple>::value); matchers.reserve(::testing::tuple_size<MatcherTuple>::value);