[llvm] a4384c7 - Replace std::foo with std::foo_t in LLVM.

Caroline Lebar via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 16:15:42 PST 2020


Author: Caroline Lebar
Date: 2020-02-12T16:14:36-08:00
New Revision: a4384c756bd8a819051009b5b273b2a34be8261b

URL: https://github.com/llvm/llvm-project/commit/a4384c756bd8a819051009b5b273b2a34be8261b
DIFF: https://github.com/llvm/llvm-project/commit/a4384c756bd8a819051009b5b273b2a34be8261b.diff

LOG: 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.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/DenseMap.h
    llvm/include/llvm/ADT/FunctionExtras.h
    llvm/include/llvm/ADT/ImmutableList.h
    llvm/include/llvm/ADT/STLExtras.h
    llvm/include/llvm/ADT/ScopeExit.h
    llvm/include/llvm/ADT/SmallVector.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index b73afae4bce6..6bc72341cf38 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -1164,8 +1164,7 @@ class DenseMapIterator : DebugEpochBase::HandleBase {
 
 public:
   using 
diff erence_type = ptr
diff _t;
-  using value_type =
-      typename std::conditional<IsConst, const Bucket, Bucket>::type;
+  using value_type = std::conditional_t<IsConst, const Bucket, Bucket>;
   using pointer = value_type *;
   using reference = value_type &;
   using iterator_category = std::forward_iterator_tag;

diff  --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h
index 121aa527a5da..caed60efefa7 100644
--- a/llvm/include/llvm/ADT/FunctionExtras.h
+++ b/llvm/include/llvm/ADT/FunctionExtras.h
@@ -62,12 +62,12 @@ class unique_function<ReturnT(ParamTs...)> {
   // It doesn't have to be exact though, and in one way it is more strict
   // because we want to still be able to observe either moves *or* copies.
   template <typename T>
-  using AdjustedParamT = typename std::conditional<
-      !std::is_reference<T>::value &&
-          llvm::is_trivially_copy_constructible<T>::value &&
-          llvm::is_trivially_move_constructible<T>::value &&
-          IsSizeLessThanThresholdT<T>::value,
-      T, T &>::type;
+  using AdjustedParamT =
+      std::conditional_t<!std::is_reference<T>::value &&
+                             llvm::is_trivially_copy_constructible<T>::value &&
+                             llvm::is_trivially_move_constructible<T>::value &&
+                             IsSizeLessThanThresholdT<T>::value,
+                         T, T &>;
 
   // The type of the erased function pointer we use as a callback to dispatch to
   // the stored callable when it is trivial to move and destroy.
@@ -112,8 +112,7 @@ class unique_function<ReturnT(ParamTs...)> {
 
     // For in-line storage, we just provide an aligned character buffer. We
     // provide three pointers worth of storage here.
-    typename std::aligned_storage<InlineStorageSize, alignof(void *)>::type
-        InlineStorage;
+    std::aligned_storage_t<InlineStorageSize, alignof(void *)> InlineStorage;
   } StorageUnion;
 
   // A compressed pointer to either our dispatching callback or our table of

diff  --git a/llvm/include/llvm/ADT/ImmutableList.h b/llvm/include/llvm/ADT/ImmutableList.h
index c9ee494734e7..aa672c315a2f 100644
--- a/llvm/include/llvm/ADT/ImmutableList.h
+++ b/llvm/include/llvm/ADT/ImmutableList.h
@@ -93,7 +93,7 @@ class ImmutableList {
     bool operator==(const iterator& I) const { return L == I.L; }
     bool operator!=(const iterator& I) const { return L != I.L; }
     const value_type& operator*() const { return L->getHead(); }
-    const typename std::remove_reference<value_type>::type* operator->() const {
+    const std::remove_reference_t<value_type> *operator->() const {
       return &L->getHead();
     }
 

diff  --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 8888e8d48978..3bb773cb35f7 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -63,16 +63,14 @@ template <typename...> struct conjunction : std::true_type {};
 template <typename B1> struct conjunction<B1> : B1 {};
 template <typename B1, typename... Bn>
 struct conjunction<B1, Bn...>
-    : std::conditional<bool(B1::value), conjunction<Bn...>, B1>::type {};
+    : std::conditional_t<bool(B1::value), conjunction<Bn...>, B1> {};
 
 template <typename T> struct make_const_ptr {
-  using type =
-      typename std::add_pointer<typename std::add_const<T>::type>::type;
+  using type = std::add_pointer_t<std::add_const_t<T>>;
 };
 
 template <typename T> struct make_const_ref {
-  using type = typename std::add_lvalue_reference<
-      typename std::add_const<T>::type>::type;
+  using type = std::add_lvalue_reference_t<std::add_const_t<T>>;
 };
 
 //===----------------------------------------------------------------------===//
@@ -117,7 +115,7 @@ class function_ref<Ret(Params...)> {
   function_ref(Callable &&callable,
                std::enable_if_t<!std::is_same<std::remove_reference_t<Callable>,
                                               function_ref>::value> * = nullptr)
-      : callback(callback_fn<typename std::remove_reference<Callable>::type>),
+      : callback(callback_fn<std::remove_reference_t<Callable>>),
         callable(reinterpret_cast<intptr_t>(&callable)) {}
 
   Ret operator()(Params ...params) const {
@@ -200,12 +198,12 @@ template <typename T> auto drop_begin(T &&RangeOrContainer, size_t N) {
 
 template <typename ItTy, typename FuncTy,
           typename FuncReturnTy =
-            decltype(std::declval<FuncTy>()(*std::declval<ItTy>()))>
+              decltype(std::declval<FuncTy>()(*std::declval<ItTy>()))>
 class mapped_iterator
     : public iterator_adaptor_base<
-             mapped_iterator<ItTy, FuncTy>, ItTy,
-             typename std::iterator_traits<ItTy>::iterator_category,
-             typename std::remove_reference<FuncReturnTy>::type> {
+          mapped_iterator<ItTy, FuncTy>, ItTy,
+          typename std::iterator_traits<ItTy>::iterator_category,
+          std::remove_reference_t<FuncReturnTy>> {
 public:
   mapped_iterator(ItTy U, FuncTy F)
     : mapped_iterator::iterator_adaptor_base(std::move(U)), F(std::move(F)) {}
@@ -247,8 +245,7 @@ template <typename Ty> class has_rbegin_impl {
 
 /// Metafunction to determine if T& or T has a member called rbegin().
 template <typename Ty>
-struct has_rbegin : has_rbegin_impl<typename std::remove_reference<Ty>::type> {
-};
+struct has_rbegin : has_rbegin_impl<std::remove_reference_t<Ty>> {};
 
 // 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.
@@ -295,15 +292,14 @@ class filter_iterator_base
     : public iterator_adaptor_base<
           filter_iterator_base<WrappedIteratorT, PredicateT, IterTag>,
           WrappedIteratorT,
-          typename std::common_type<
-              IterTag, typename std::iterator_traits<
-                           WrappedIteratorT>::iterator_category>::type> {
+          std::common_type_t<IterTag,
+                             typename std::iterator_traits<
+                                 WrappedIteratorT>::iterator_category>> {
   using BaseT = iterator_adaptor_base<
       filter_iterator_base<WrappedIteratorT, PredicateT, IterTag>,
       WrappedIteratorT,
-      typename std::common_type<
-          IterTag, typename std::iterator_traits<
-                       WrappedIteratorT>::iterator_category>::type>;
+      std::common_type_t<IterTag, typename std::iterator_traits<
+                                      WrappedIteratorT>::iterator_category>>;
 
 protected:
   WrappedIteratorT End;
@@ -521,9 +517,10 @@ template<typename... Iters> struct ZipTupleType {
 
 template <typename ZipType, typename... Iters>
 using zip_traits = iterator_facade_base<
-    ZipType, typename std::common_type<std::bidirectional_iterator_tag,
-                                       typename std::iterator_traits<
-                                           Iters>::iterator_category...>::type,
+    ZipType,
+    std::common_type_t<
+        std::bidirectional_iterator_tag,
+        typename std::iterator_traits<Iters>::iterator_category...>,
     // ^ TODO: Implement random access methods.
     typename ZipTupleType<Iters...>::type,
     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<
 }
 
 template <typename Iter> struct ZipLongestItemType {
-  using type =
-      llvm::Optional<typename std::remove_const<typename std::remove_reference<
-          decltype(*std::declval<Iter>())>::type>::type>;
+  using type = llvm::Optional<std::remove_const_t<
+      std::remove_reference_t<decltype(*std::declval<Iter>())>>>;
 };
 
 template <typename... Iters> struct ZipLongestTupleType {
@@ -688,12 +684,12 @@ template <typename... Iters>
 class zip_longest_iterator
     : public iterator_facade_base<
           zip_longest_iterator<Iters...>,
-          typename std::common_type<
+          std::common_type_t<
               std::forward_iterator_tag,
-              typename std::iterator_traits<Iters>::iterator_category...>::type,
+              typename std::iterator_traits<Iters>::iterator_category...>,
           typename ZipLongestTupleType<Iters...>::type,
-          typename std::iterator_traits<typename std::tuple_element<
-              0, std::tuple<Iters...>>::type>::
diff erence_type,
+          typename std::iterator_traits<
+              std::tuple_element_t<0, std::tuple<Iters...>>>::
diff erence_type,
           typename ZipLongestTupleType<Iters...>::type *,
           typename ZipLongestTupleType<Iters...>::type> {
 public:
@@ -1501,8 +1497,8 @@ decltype(auto) apply_tuple_impl(F &&f, Tuple &&t, std::index_sequence<I...>) {
 /// return the result.
 template <typename F, typename Tuple>
 decltype(auto) apply_tuple(F &&f, Tuple &&t) {
-  using Indices = std::make_index_sequence<
-      std::tuple_size<typename std::decay<Tuple>::type>::value>;
+  using Indices =
+      std::make_index_sequence<std::tuple_size<std::decay_t<Tuple>>::value>;
 
   return detail::apply_tuple_impl(std::forward<F>(f), std::forward<Tuple>(t),
                                   Indices{});

diff  --git a/llvm/include/llvm/ADT/ScopeExit.h b/llvm/include/llvm/ADT/ScopeExit.h
index 712d91237739..4e52d969d616 100644
--- a/llvm/include/llvm/ADT/ScopeExit.h
+++ b/llvm/include/llvm/ADT/ScopeExit.h
@@ -54,10 +54,9 @@ template <typename Callable> class scope_exit {
 //
 // Interface is specified by p0052r2.
 template <typename Callable>
-LLVM_NODISCARD detail::scope_exit<typename std::decay<Callable>::type>
+LLVM_NODISCARD detail::scope_exit<std::decay_t<Callable>>
 make_scope_exit(Callable &&F) {
-  return detail::scope_exit<typename std::decay<Callable>::type>(
-      std::forward<Callable>(F));
+  return detail::scope_exit<std::decay_t<Callable>>(std::forward<Callable>(F));
 }
 
 } // end namespace llvm

diff  --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index 28b514d530dc..bcec1720760b 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -284,8 +284,8 @@ class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
   template <typename T1, typename T2>
   static void uninitialized_copy(
       T1 *I, T1 *E, T2 *Dest,
-      std::enable_if_t<std::is_same<typename std::remove_const<T1>::type,
-                                    T2>::value> * = nullptr) {
+      std::enable_if_t<std::is_same<std::remove_const_t<T1>, T2>::value> * =
+          nullptr) {
     // Use memcpy for PODs iterated by pointers (which includes SmallVector
     // iterators): std::uninitialized_copy optimizes to memmove, but we can
     // use memcpy here. Note that I and E are iterators and thus might be
@@ -911,8 +911,8 @@ inline size_t capacity_in_bytes(const SmallVector<T, N> &X) {
 /// SmallVector with elements of the vector.  This is useful, for example,
 /// when you want to iterate a range and then sort the results.
 template <unsigned Size, typename R>
-SmallVector<typename std::remove_const<typename std::remove_reference<
-                decltype(*std::begin(std::declval<R &>()))>::type>::type,
+SmallVector<std::remove_const_t<std::remove_reference_t<
+                decltype(*std::begin(std::declval<R &>()))>>,
             Size>
 to_vector(R &&Range) {
   return {std::begin(Range), std::end(Range)};


        


More information about the llvm-commits mailing list