[clang-tools-extra] 3e720fa - Use std::decay_t (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 18 10:25:25 PDT 2022


Author: Kazu Hirata
Date: 2022-09-18T10:25:08-07:00
New Revision: 3e720fa9dce6cf4020c498c1e75be4c94dd5075d

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

LOG: Use std::decay_t (NFC)

Added: 
    

Modified: 
    clang-tools-extra/clangd/support/Context.h
    llvm/include/llvm/ADT/ScopeExit.h
    llvm/include/llvm/Support/thread.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/support/Context.h b/clang-tools-extra/clangd/support/Context.h
index a33a9ff8fffa7..926add18d88aa 100644
--- a/clang-tools-extra/clangd/support/Context.h
+++ b/clang-tools-extra/clangd/support/Context.h
@@ -116,33 +116,31 @@ class Context {
   /// It is safe to move or destroy a parent context after calling derive().
   /// The child will keep its parent alive, and its data remains accessible.
   template <class Type>
-  Context derive(const Key<Type> &Key,
-                 typename std::decay<Type>::type Value) const & {
+  Context derive(const Key<Type> &Key, std::decay_t<Type> Value) const & {
     return Context(std::make_shared<Data>(
         Data{/*Parent=*/DataPtr, &Key,
-             std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
+             std::make_unique<TypedAnyStorage<std::decay_t<Type>>>(
                  std::move(Value))}));
   }
 
   template <class Type>
-  Context
-  derive(const Key<Type> &Key,
-         typename std::decay<Type>::type Value) && /* takes ownership */ {
+  Context derive(const Key<Type> &Key,
+                 std::decay_t<Type> Value) && /* takes ownership */ {
     return Context(std::make_shared<Data>(
         Data{/*Parent=*/std::move(DataPtr), &Key,
-             std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
+             std::make_unique<TypedAnyStorage<std::decay_t<Type>>>(
                  std::move(Value))}));
   }
 
   /// Derives a child context, using an anonymous key.
   /// Intended for objects stored only for their destructor's side-effect.
   template <class Type> Context derive(Type &&Value) const & {
-    static Key<typename std::decay<Type>::type> Private;
+    static Key<std::decay_t<Type>> Private;
     return derive(Private, std::forward<Type>(Value));
   }
 
   template <class Type> Context derive(Type &&Value) && {
-    static Key<typename std::decay<Type>::type> Private;
+    static Key<std::decay_t<Type>> Private;
     return std::move(*this).derive(Private, std::forward<Type>(Value));
   }
 

diff  --git a/llvm/include/llvm/ADT/ScopeExit.h b/llvm/include/llvm/ADT/ScopeExit.h
index e2a19db1686d1..2f13fb65d34d8 100644
--- a/llvm/include/llvm/ADT/ScopeExit.h
+++ b/llvm/include/llvm/ADT/ScopeExit.h
@@ -55,10 +55,9 @@ template <typename Callable> class scope_exit {
 //
 // Interface is specified by p0052r2.
 template <typename Callable>
-[[nodiscard]] detail::scope_exit<typename std::decay<Callable>::type>
+[[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/Support/thread.h b/llvm/include/llvm/Support/thread.h
index 66a55db592033..660d31573a866 100644
--- a/llvm/include/llvm/Support/thread.h
+++ b/llvm/include/llvm/Support/thread.h
@@ -129,9 +129,7 @@ thread::id llvm_thread_get_current_id_impl();
 template <class Function, class... Args>
 thread::thread(llvm::Optional<unsigned> StackSizeInBytes, Function &&f,
                Args &&...args) {
-  typedef std::tuple<typename std::decay<Function>::type,
-                     typename std::decay<Args>::type...>
-      CalleeTuple;
+  typedef std::tuple<std::decay_t<Function>, std::decay_t<Args>...> CalleeTuple;
   std::unique_ptr<CalleeTuple> Callee(
       new CalleeTuple(std::forward<Function>(f), std::forward<Args>(args)...));
 


        


More information about the cfe-commits mailing list