[libcxx-commits] [libcxx] [libc++][mdspan][NFC] Remove redundant syntax and keywords (PR #175024)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 9 09:59:15 PST 2026
https://github.com/eiytoq updated https://github.com/llvm/llvm-project/pull/175024
>From a290ff8aa2d8455f697987c9bc7553a8c03998e5 Mon Sep 17 00:00:00 2001
From: eiytoq <eiytoq at outlook.com>
Date: Sat, 10 Jan 2026 01:53:02 +0800
Subject: [PATCH] nfc
---
libcxx/include/__mdspan/layout_stride.h | 9 ++++-----
libcxx/include/__mdspan/mdspan.h | 25 ++++++++++++-------------
2 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/libcxx/include/__mdspan/layout_stride.h b/libcxx/include/__mdspan/layout_stride.h
index 9d77d71bc3598..eb22475756fde 100644
--- a/libcxx/include/__mdspan/layout_stride.h
+++ b/libcxx/include/__mdspan/layout_stride.h
@@ -272,11 +272,10 @@ class layout_stride::mapping {
return [&]<size_t... _Pos>(index_sequence<_Pos...>) {
if ((__extents_.extent(_Pos) * ... * 1) == 0)
return static_cast<index_type>(0);
- else
- return static_cast<index_type>(
- static_cast<index_type>(1) +
- (((__extents_.extent(_Pos) - static_cast<index_type>(1)) * __strides_[_Pos]) + ... +
- static_cast<index_type>(0)));
+
+ return static_cast<index_type>(
+ static_cast<index_type>(1) + (((__extents_.extent(_Pos) - static_cast<index_type>(1)) * __strides_[_Pos]) +
+ ... + static_cast<index_type>(0)));
}(make_index_sequence<__rank_>());
}
}
diff --git a/libcxx/include/__mdspan/mdspan.h b/libcxx/include/__mdspan/mdspan.h
index 9d3d35cd558a1..449baea43f2d7 100644
--- a/libcxx/include/__mdspan/mdspan.h
+++ b/libcxx/include/__mdspan/mdspan.h
@@ -96,9 +96,8 @@ class mdspan {
}
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr index_type extent(rank_type __r) const noexcept {
return __map_.extents().extent(__r);
- };
+ }
-public:
//--------------------------------------------------------------------------------
// [mdspan.mdspan.cons], mdspan constructors, assignment, and destructor
@@ -242,26 +241,26 @@ class mdspan {
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const extents_type& extents() const noexcept {
return __map_.extents();
- };
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const data_handle_type& data_handle() const noexcept { return __ptr_; };
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const mapping_type& mapping() const noexcept { return __map_; };
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const accessor_type& accessor() const noexcept { return __acc_; };
+ }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const data_handle_type& data_handle() const noexcept { return __ptr_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const mapping_type& mapping() const noexcept { return __map_; }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const accessor_type& accessor() const noexcept { return __acc_; }
// per LWG-4021 "mdspan::is_always_meow() should be noexcept"
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_unique() noexcept {
return mapping_type::is_always_unique();
- };
+ }
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_exhaustive() noexcept {
return mapping_type::is_always_exhaustive();
- };
+ }
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI static constexpr bool is_always_strided() noexcept {
return mapping_type::is_always_strided();
- };
+ }
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_unique() const { return __map_.is_unique(); };
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const { return __map_.is_exhaustive(); };
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_strided() const { return __map_.is_strided(); };
- [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const { return __map_.stride(__r); };
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_unique() const { return __map_.is_unique(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_exhaustive() const { return __map_.is_exhaustive(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool is_strided() const { return __map_.is_strided(); }
+ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr index_type stride(rank_type __r) const { return __map_.stride(__r); }
private:
_LIBCPP_NO_UNIQUE_ADDRESS data_handle_type __ptr_{};
More information about the libcxx-commits
mailing list