[libcxx-commits] [libcxx] dcdcc7c - [libc++][NFC] Replace typedefs with using in the math headers

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 3 08:51:58 PDT 2023


Author: Nikolas Klauser
Date: 2023-08-03T08:51:50-07:00
New Revision: dcdcc7c8046fa1380d6f1dc2a9c2487ed24ee491

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

LOG: [libc++][NFC] Replace typedefs with using in the math headers

Reviewed By: #libc, Mordante, ldionne

Spies: Mordante, libcxx-commits

Differential Revision: https://reviews.llvm.org/D155382

Added: 
    

Modified: 
    libcxx/include/__math/exponential_functions.h
    libcxx/include/__math/fdim.h
    libcxx/include/__math/fma.h
    libcxx/include/__math/hypot.h
    libcxx/include/__math/inverse_trigonometric_functions.h
    libcxx/include/__math/min_max.h
    libcxx/include/__math/modulo.h
    libcxx/include/__math/remainder.h
    libcxx/include/__math/rounding_functions.h
    libcxx/include/__math/traits.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__math/exponential_functions.h b/libcxx/include/__math/exponential_functions.h
index 741347899c7dd8..f8d611b9e486e4 100644
--- a/libcxx/include/__math/exponential_functions.h
+++ b/libcxx/include/__math/exponential_functions.h
@@ -159,7 +159,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type pow(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::pow((__result_type)__x, (__result_type)__y);
 }

diff  --git a/libcxx/include/__math/fdim.h b/libcxx/include/__math/fdim.h
index 175427e57e8ce0..6f90809302d7bc 100644
--- a/libcxx/include/__math/fdim.h
+++ b/libcxx/include/__math/fdim.h
@@ -36,7 +36,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double fdim(long double __x, long double __y)
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fdim(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::fdim((__result_type)__x, (__result_type)__y);
 }

diff  --git a/libcxx/include/__math/fma.h b/libcxx/include/__math/fma.h
index 4fa68e9b100b1c..9e14f72dcaa080 100644
--- a/libcxx/include/__math/fma.h
+++ b/libcxx/include/__math/fma.h
@@ -41,7 +41,7 @@ template <class _A1,
           class _A3,
           __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2, _A3>::type fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2, _A3>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2, _A3>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value &&
                    _IsSame<_A3, __result_type>::value)),
                 "");

diff  --git a/libcxx/include/__math/hypot.h b/libcxx/include/__math/hypot.h
index 8d740faac6e27c..8e2c0f5b6b6d81 100644
--- a/libcxx/include/__math/hypot.h
+++ b/libcxx/include/__math/hypot.h
@@ -36,7 +36,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y)
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type hypot(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::hypot((__result_type)__x, (__result_type)__y);
 }

diff  --git a/libcxx/include/__math/inverse_trigonometric_functions.h b/libcxx/include/__math/inverse_trigonometric_functions.h
index 16fb929eebc5aa..30b1440b0b1193 100644
--- a/libcxx/include/__math/inverse_trigonometric_functions.h
+++ b/libcxx/include/__math/inverse_trigonometric_functions.h
@@ -87,7 +87,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x)
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type atan2(_A1 __y, _A2 __x) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::atan2((__result_type)__y, (__result_type)__x);
 }

diff  --git a/libcxx/include/__math/min_max.h b/libcxx/include/__math/min_max.h
index 8d06fba60958d7..381b2af4a56cf0 100644
--- a/libcxx/include/__math/min_max.h
+++ b/libcxx/include/__math/min_max.h
@@ -40,7 +40,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmax(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::fmax((__result_type)__x, (__result_type)__y);
 }
@@ -62,7 +62,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmin(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::fmin((__result_type)__x, (__result_type)__y);
 }

diff  --git a/libcxx/include/__math/modulo.h b/libcxx/include/__math/modulo.h
index 2783f845fe11c0..f6cdb956cf883f 100644
--- a/libcxx/include/__math/modulo.h
+++ b/libcxx/include/__math/modulo.h
@@ -38,7 +38,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double fmod(long double __x, long double __y)
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type fmod(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::fmod((__result_type)__x, (__result_type)__y);
 }

diff  --git a/libcxx/include/__math/remainder.h b/libcxx/include/__math/remainder.h
index de649b1f1f467f..025fb53aaa2015 100644
--- a/libcxx/include/__math/remainder.h
+++ b/libcxx/include/__math/remainder.h
@@ -39,7 +39,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double remainder(long double __x, long double
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type remainder(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::remainder((__result_type)__x, (__result_type)__y);
 }
@@ -61,7 +61,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double remquo(long double __x, long double __y
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::remquo((__result_type)__x, (__result_type)__y, __z);
 }

diff  --git a/libcxx/include/__math/rounding_functions.h b/libcxx/include/__math/rounding_functions.h
index dadb8a76390af2..29e42fd80b00d6 100644
--- a/libcxx/include/__math/rounding_functions.h
+++ b/libcxx/include/__math/rounding_functions.h
@@ -159,7 +159,7 @@ inline _LIBCPP_HIDE_FROM_ABI long double nextafter(long double __x, long double
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type nextafter(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type __result_type;
+  using __result_type = typename __promote<_A1, _A2>::type;
   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value)), "");
   return __math::nextafter((__result_type)__x, (__result_type)__y);
 }

diff  --git a/libcxx/include/__math/traits.h b/libcxx/include/__math/traits.h
index 8b3ce2a1e43971..da585af8837f0c 100644
--- a/libcxx/include/__math/traits.h
+++ b/libcxx/include/__math/traits.h
@@ -125,7 +125,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool i
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type type;
+  using type = typename __promote<_A1, _A2>::type;
   return __builtin_isgreater((type)__x, (type)__y);
 }
 
@@ -133,7 +133,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 _
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type type;
+  using type = typename __promote<_A1, _A2>::type;
   return __builtin_isgreaterequal((type)__x, (type)__y);
 }
 
@@ -141,7 +141,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x,
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type type;
+  using type = typename __promote<_A1, _A2>::type;
   return __builtin_isless((type)__x, (type)__y);
 }
 
@@ -149,7 +149,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y)
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type type;
+  using type = typename __promote<_A1, _A2>::type;
   return __builtin_islessequal((type)__x, (type)__y);
 }
 
@@ -157,7 +157,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type type;
+  using type = typename __promote<_A1, _A2>::type;
   return __builtin_islessgreater((type)__x, (type)__y);
 }
 
@@ -165,7 +165,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _
 
 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
 _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) _NOEXCEPT {
-  typedef typename __promote<_A1, _A2>::type type;
+  using type = typename __promote<_A1, _A2>::type;
   return __builtin_isunordered((type)__x, (type)__y);
 }
 


        


More information about the libcxx-commits mailing list