Skip to content

Commit a4384c7

Browse files
committed
Replace std::foo with std::foo_t in LLVM.
This patch is replacements missed in my last change doing this across LLVM. No functional change, although I think there was a missing typename in struct conjunction that is now fixed.
1 parent 91e194d commit a4384c7

File tree

6 files changed

+41
-48
lines changed

6 files changed

+41
-48
lines changed

llvm/include/llvm/ADT/DenseMap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,8 +1164,7 @@ class DenseMapIterator : DebugEpochBase::HandleBase {
11641164

11651165
public:
11661166
using difference_type = ptrdiff_t;
1167-
using value_type =
1168-
typename std::conditional<IsConst, const Bucket, Bucket>::type;
1167+
using value_type = std::conditional_t<IsConst, const Bucket, Bucket>;
11691168
using pointer = value_type *;
11701169
using reference = value_type &;
11711170
using iterator_category = std::forward_iterator_tag;

llvm/include/llvm/ADT/FunctionExtras.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ class unique_function<ReturnT(ParamTs...)> {
6262
// It doesn't have to be exact though, and in one way it is more strict
6363
// because we want to still be able to observe either moves *or* copies.
6464
template <typename T>
65-
using AdjustedParamT = typename std::conditional<
66-
!std::is_reference<T>::value &&
67-
llvm::is_trivially_copy_constructible<T>::value &&
68-
llvm::is_trivially_move_constructible<T>::value &&
69-
IsSizeLessThanThresholdT<T>::value,
70-
T, T &>::type;
65+
using AdjustedParamT =
66+
std::conditional_t<!std::is_reference<T>::value &&
67+
llvm::is_trivially_copy_constructible<T>::value &&
68+
llvm::is_trivially_move_constructible<T>::value &&
69+
IsSizeLessThanThresholdT<T>::value,
70+
T, T &>;
7171

7272
// The type of the erased function pointer we use as a callback to dispatch to
7373
// the stored callable when it is trivial to move and destroy.
@@ -112,8 +112,7 @@ class unique_function<ReturnT(ParamTs...)> {
112112

113113
// For in-line storage, we just provide an aligned character buffer. We
114114
// provide three pointers worth of storage here.
115-
typename std::aligned_storage<InlineStorageSize, alignof(void *)>::type
116-
InlineStorage;
115+
std::aligned_storage_t<InlineStorageSize, alignof(void *)> InlineStorage;
117116
} StorageUnion;
118117

119118
// A compressed pointer to either our dispatching callback or our table of

llvm/include/llvm/ADT/ImmutableList.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ImmutableList {
9393
bool operator==(const iterator& I) const { return L == I.L; }
9494
bool operator!=(const iterator& I) const { return L != I.L; }
9595
const value_type& operator*() const { return L->getHead(); }
96-
const typename std::remove_reference<value_type>::type* operator->() const {
96+
const std::remove_reference_t<value_type> *operator->() const {
9797
return &L->getHead();
9898
}
9999

llvm/include/llvm/ADT/STLExtras.h

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,14 @@ template <typename...> struct conjunction : std::true_type {};
6363
template <typename B1> struct conjunction<B1> : B1 {};
6464
template <typename B1, typename... Bn>
6565
struct conjunction<B1, Bn...>
66-
: std::conditional<bool(B1::value), conjunction<Bn...>, B1>::type {};
66+
: std::conditional_t<bool(B1::value), conjunction<Bn...>, B1> {};
6767

6868
template <typename T> struct make_const_ptr {
69-
using type =
70-
typename std::add_pointer<typename std::add_const<T>::type>::type;
69+
using type = std::add_pointer_t<std::add_const_t<T>>;
7170
};
7271

7372
template <typename T> struct make_const_ref {
74-
using type = typename std::add_lvalue_reference<
75-
typename std::add_const<T>::type>::type;
73+
using type = std::add_lvalue_reference_t<std::add_const_t<T>>;
7674
};
7775

7876
//===----------------------------------------------------------------------===//
@@ -117,7 +115,7 @@ class function_ref<Ret(Params...)> {
117115
function_ref(Callable &&callable,
118116
std::enable_if_t<!std::is_same<std::remove_reference_t<Callable>,
119117
function_ref>::value> * = nullptr)
120-
: callback(callback_fn<typename std::remove_reference<Callable>::type>),
118+
: callback(callback_fn<std::remove_reference_t<Callable>>),
121119
callable(reinterpret_cast<intptr_t>(&callable)) {}
122120

123121
Ret operator()(Params ...params) const {
@@ -200,12 +198,12 @@ template <typename T> auto drop_begin(T &&RangeOrContainer, size_t N) {
200198

201199
template <typename ItTy, typename FuncTy,
202200
typename FuncReturnTy =
203-
decltype(std::declval<FuncTy>()(*std::declval<ItTy>()))>
201+
decltype(std::declval<FuncTy>()(*std::declval<ItTy>()))>
204202
class mapped_iterator
205203
: public iterator_adaptor_base<
206-
mapped_iterator<ItTy, FuncTy>, ItTy,
207-
typename std::iterator_traits<ItTy>::iterator_category,
208-
typename std::remove_reference<FuncReturnTy>::type> {
204+
mapped_iterator<ItTy, FuncTy>, ItTy,
205+
typename std::iterator_traits<ItTy>::iterator_category,
206+
std::remove_reference_t<FuncReturnTy>> {
209207
public:
210208
mapped_iterator(ItTy U, FuncTy F)
211209
: mapped_iterator::iterator_adaptor_base(std::move(U)), F(std::move(F)) {}
@@ -247,8 +245,7 @@ template <typename Ty> class has_rbegin_impl {
247245

248246
/// Metafunction to determine if T& or T has a member called rbegin().
249247
template <typename Ty>
250-
struct has_rbegin : has_rbegin_impl<typename std::remove_reference<Ty>::type> {
251-
};
248+
struct has_rbegin : has_rbegin_impl<std::remove_reference_t<Ty>> {};
252249

253250
// Returns an iterator_range over the given container which iterates in reverse.
254251
// Note that the container must have rbegin()/rend() methods for this to work.
@@ -295,15 +292,14 @@ class filter_iterator_base
295292
: public iterator_adaptor_base<
296293
filter_iterator_base<WrappedIteratorT, PredicateT, IterTag>,
297294
WrappedIteratorT,
298-
typename std::common_type<
299-
IterTag, typename std::iterator_traits<
300-
WrappedIteratorT>::iterator_category>::type> {
295+
std::common_type_t<IterTag,
296+
typename std::iterator_traits<
297+
WrappedIteratorT>::iterator_category>> {
301298
using BaseT = iterator_adaptor_base<
302299
filter_iterator_base<WrappedIteratorT, PredicateT, IterTag>,
303300
WrappedIteratorT,
304-
typename std::common_type<
305-
IterTag, typename std::iterator_traits<
306-
WrappedIteratorT>::iterator_category>::type>;
301+
std::common_type_t<IterTag, typename std::iterator_traits<
302+
WrappedIteratorT>::iterator_category>>;
307303

308304
protected:
309305
WrappedIteratorT End;
@@ -521,9 +517,10 @@ template<typename... Iters> struct ZipTupleType {
521517

522518
template <typename ZipType, typename... Iters>
523519
using zip_traits = iterator_facade_base<
524-
ZipType, typename std::common_type<std::bidirectional_iterator_tag,
525-
typename std::iterator_traits<
526-
Iters>::iterator_category...>::type,
520+
ZipType,
521+
std::common_type_t<
522+
std::bidirectional_iterator_tag,
523+
typename std::iterator_traits<Iters>::iterator_category...>,
527524
// ^ TODO: Implement random access methods.
528525
typename ZipTupleType<Iters...>::type,
529526
typename std::iterator_traits<typename std::tuple_element<
@@ -675,9 +672,8 @@ static auto deref_or_none(const Iter &I, const Iter &End) -> llvm::Optional<
675672
}
676673

677674
template <typename Iter> struct ZipLongestItemType {
678-
using type =
679-
llvm::Optional<typename std::remove_const<typename std::remove_reference<
680-
decltype(*std::declval<Iter>())>::type>::type>;
675+
using type = llvm::Optional<std::remove_const_t<
676+
std::remove_reference_t<decltype(*std::declval<Iter>())>>>;
681677
};
682678

683679
template <typename... Iters> struct ZipLongestTupleType {
@@ -688,12 +684,12 @@ template <typename... Iters>
688684
class zip_longest_iterator
689685
: public iterator_facade_base<
690686
zip_longest_iterator<Iters...>,
691-
typename std::common_type<
687+
std::common_type_t<
692688
std::forward_iterator_tag,
693-
typename std::iterator_traits<Iters>::iterator_category...>::type,
689+
typename std::iterator_traits<Iters>::iterator_category...>,
694690
typename ZipLongestTupleType<Iters...>::type,
695-
typename std::iterator_traits<typename std::tuple_element<
696-
0, std::tuple<Iters...>>::type>::difference_type,
691+
typename std::iterator_traits<
692+
std::tuple_element_t<0, std::tuple<Iters...>>>::difference_type,
697693
typename ZipLongestTupleType<Iters...>::type *,
698694
typename ZipLongestTupleType<Iters...>::type> {
699695
public:
@@ -1501,8 +1497,8 @@ decltype(auto) apply_tuple_impl(F &&f, Tuple &&t, std::index_sequence<I...>) {
15011497
/// return the result.
15021498
template <typename F, typename Tuple>
15031499
decltype(auto) apply_tuple(F &&f, Tuple &&t) {
1504-
using Indices = std::make_index_sequence<
1505-
std::tuple_size<typename std::decay<Tuple>::type>::value>;
1500+
using Indices =
1501+
std::make_index_sequence<std::tuple_size<std::decay_t<Tuple>>::value>;
15061502

15071503
return detail::apply_tuple_impl(std::forward<F>(f), std::forward<Tuple>(t),
15081504
Indices{});

llvm/include/llvm/ADT/ScopeExit.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ template <typename Callable> class scope_exit {
5454
//
5555
// Interface is specified by p0052r2.
5656
template <typename Callable>
57-
LLVM_NODISCARD detail::scope_exit<typename std::decay<Callable>::type>
57+
LLVM_NODISCARD detail::scope_exit<std::decay_t<Callable>>
5858
make_scope_exit(Callable &&F) {
59-
return detail::scope_exit<typename std::decay<Callable>::type>(
60-
std::forward<Callable>(F));
59+
return detail::scope_exit<std::decay_t<Callable>>(std::forward<Callable>(F));
6160
}
6261

6362
} // end namespace llvm

llvm/include/llvm/ADT/SmallVector.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
284284
template <typename T1, typename T2>
285285
static void uninitialized_copy(
286286
T1 *I, T1 *E, T2 *Dest,
287-
std::enable_if_t<std::is_same<typename std::remove_const<T1>::type,
288-
T2>::value> * = nullptr) {
287+
std::enable_if_t<std::is_same<std::remove_const_t<T1>, T2>::value> * =
288+
nullptr) {
289289
// Use memcpy for PODs iterated by pointers (which includes SmallVector
290290
// iterators): std::uninitialized_copy optimizes to memmove, but we can
291291
// use memcpy here. Note that I and E are iterators and thus might be
@@ -911,8 +911,8 @@ inline size_t capacity_in_bytes(const SmallVector<T, N> &X) {
911911
/// SmallVector with elements of the vector. This is useful, for example,
912912
/// when you want to iterate a range and then sort the results.
913913
template <unsigned Size, typename R>
914-
SmallVector<typename std::remove_const<typename std::remove_reference<
915-
decltype(*std::begin(std::declval<R &>()))>::type>::type,
914+
SmallVector<std::remove_const_t<std::remove_reference_t<
915+
decltype(*std::begin(std::declval<R &>()))>>,
916916
Size>
917917
to_vector(R &&Range) {
918918
return {std::begin(Range), std::end(Range)};

0 commit comments

Comments
 (0)