Remove unused traits.
Remove the trait entries which no longer have usages.
Change-Id: I0cdc6646f0e821555c190681ed1815b83dea2d0a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/239135
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/utils/rtti/traits.h b/src/tint/utils/rtti/traits.h
index 769147b..a9827e0 100644
--- a/src/tint/utils/rtti/traits.h
+++ b/src/tint/utils/rtti/traits.h
@@ -119,14 +119,6 @@
namespace detail {
-/// @returns the tuple `t` swizzled by `INDICES`
-template <typename TUPLE, std::size_t... INDICES>
-constexpr auto Swizzle(TUPLE&& t, std::index_sequence<INDICES...>)
- -> std::tuple<std::tuple_element_t<INDICES, std::remove_reference_t<TUPLE>>...> {
- return {std::forward<std::tuple_element_t<INDICES, std::remove_reference_t<TUPLE>>>(
- std::get<INDICES>(std::forward<TUPLE>(t)))...};
-}
-
/// @returns a nullptr of the tuple type `TUPLE` swizzled by `INDICES`.
/// @note: This function is intended to be used in a `decltype()` expression,
/// and returns a pointer-to-tuple as the tuple may hold non-constructable
@@ -137,22 +129,6 @@
return static_cast<Swizzled*>(nullptr);
}
-} // namespace detail
-
-/// @returns the slice of the tuple `t` with the tuple elements
-/// `[OFFSET..OFFSET+COUNT)`
-template <std::size_t OFFSET, std::size_t COUNT, typename TUPLE>
-constexpr auto Slice(TUPLE&& t) {
- return traits::detail::Swizzle<TUPLE>(std::forward<TUPLE>(t), Range<OFFSET, COUNT>());
-}
-
-/// Resolves to the slice of the tuple `t` with the tuple elements
-/// `[OFFSET..OFFSET+COUNT)`
-template <std::size_t OFFSET, std::size_t COUNT, typename TUPLE>
-using SliceTuple =
- std::remove_pointer_t<decltype(traits::detail::SwizzlePtrTy<TUPLE>(Range<OFFSET, COUNT>()))>;
-
-namespace detail {
/// Base template for IsTypeIn
template <typename T, typename TypeList>
struct IsTypeIn;
@@ -160,38 +136,19 @@
/// Specialization for IsTypeIn
template <typename T, template <typename...> typename TypeContainer, typename... Ts>
struct IsTypeIn<T, TypeContainer<Ts...>> : std::disjunction<std::is_same<T, Ts>...> {};
+
} // namespace detail
+/// Resolves to the slice of the tuple `t` with the tuple elements
+/// `[OFFSET..OFFSET+COUNT)`
+template <std::size_t OFFSET, std::size_t COUNT, typename TUPLE>
+using SliceTuple =
+ std::remove_pointer_t<decltype(traits::detail::SwizzlePtrTy<TUPLE>(Range<OFFSET, COUNT>()))>;
+
/// Evaluates to the decayed pointer element type, or the decayed type T if T is not a pointer.
template <typename T>
using PtrElTy = std::decay_t<std::remove_pointer_t<std::decay_t<T>>>;
-namespace detail {
-/// Helper for CharArrayToCharPtr
-template <typename T>
-struct CharArrayToCharPtrImpl {
- /// Evaluates to T
- using type = T;
-};
-/// Specialization of CharArrayToCharPtrImpl for `char[N]`
-template <size_t N>
-struct CharArrayToCharPtrImpl<char[N]> {
- /// Evaluates to `char*`
- using type = char*;
-};
-/// Specialization of CharArrayToCharPtrImpl for `const char[N]`
-template <size_t N>
-struct CharArrayToCharPtrImpl<const char[N]> {
- /// Evaluates to `const char*`
- using type = const char*;
-};
-} // namespace detail
-
-/// Evaluates to `char*` or `const char*` if `T` is `char[N]` or `const char[N]`, respectively,
-/// otherwise T.
-template <typename T>
-using CharArrayToCharPtr = typename traits::detail::CharArrayToCharPtrImpl<T>::type;
-
////////////////////////////////////////////////////////////////////////////////
/// Concepts
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/tint/utils/rtti/traits_test.cc b/src/tint/utils/rtti/traits_test.cc
index bb045a4..0170244 100644
--- a/src/tint/utils/rtti/traits_test.cc
+++ b/src/tint/utils/rtti/traits_test.cc
@@ -154,68 +154,6 @@
static_assert(SignatureOfT<decltype(l3)>::parameter_count == 3);
}
-TEST(Slice, Empty) {
- auto sliced = Slice<0, 0>(std::make_tuple<>());
- static_assert(std::tuple_size_v<decltype(sliced)> == 0);
-}
-
-TEST(Slice, SingleElementSliceEmpty) {
- auto sliced = Slice<0, 0>(std::make_tuple<int>(1));
- static_assert(std::tuple_size_v<decltype(sliced)> == 0);
-}
-
-TEST(Slice, SingleElementSliceFull) {
- auto sliced = Slice<0, 1>(std::make_tuple<int>(1));
- static_assert(std::tuple_size_v<decltype(sliced)> == 1);
- static_assert(std::is_same_v<std::tuple_element_t<0, decltype(sliced)>, int>, "");
- EXPECT_EQ(std::get<0>(sliced), 1);
-}
-
-TEST(Slice, MixedTupleSliceEmpty) {
- auto sliced = Slice<1, 0>(std::make_tuple<int, bool, float>(1, true, 2.0f));
- static_assert(std::tuple_size_v<decltype(sliced)> == 0);
-}
-
-TEST(Slice, MixedTupleSliceFull) {
- auto sliced = Slice<0, 3>(std::make_tuple<int, bool, float>(1, true, 2.0f));
- static_assert(std::tuple_size_v<decltype(sliced)> == 3);
- static_assert(std::is_same_v<std::tuple_element_t<0, decltype(sliced)>, int>, "");
- static_assert(std::is_same_v<std::tuple_element_t<1, decltype(sliced)>, bool>, "");
- static_assert(std::is_same_v<std::tuple_element_t<2, decltype(sliced)>, float>);
- EXPECT_EQ(std::get<0>(sliced), 1);
- EXPECT_EQ(std::get<1>(sliced), true);
- EXPECT_EQ(std::get<2>(sliced), 2.0f);
-}
-
-TEST(Slice, MixedTupleSliceLowPart) {
- auto sliced = Slice<0, 2>(std::make_tuple<int, bool, float>(1, true, 2.0f));
- static_assert(std::tuple_size_v<decltype(sliced)> == 2);
- static_assert(std::is_same_v<std::tuple_element_t<0, decltype(sliced)>, int>, "");
- static_assert(std::is_same_v<std::tuple_element_t<1, decltype(sliced)>, bool>, "");
- EXPECT_EQ(std::get<0>(sliced), 1);
- EXPECT_EQ(std::get<1>(sliced), true);
-}
-
-TEST(Slice, MixedTupleSliceHighPart) {
- auto sliced = Slice<1, 2>(std::make_tuple<int, bool, float>(1, true, 2.0f));
- static_assert(std::tuple_size_v<decltype(sliced)> == 2);
- static_assert(std::is_same_v<std::tuple_element_t<0, decltype(sliced)>, bool>, "");
- static_assert(std::is_same_v<std::tuple_element_t<1, decltype(sliced)>, float>);
- EXPECT_EQ(std::get<0>(sliced), true);
- EXPECT_EQ(std::get<1>(sliced), 2.0f);
-}
-
-TEST(Slice, PreservesRValueRef) {
- int i;
- int& int_ref = i;
- auto tuple = std::forward_as_tuple(std::move(int_ref));
- static_assert(std::is_same_v<int&&, //
- std::tuple_element_t<0, decltype(tuple)>>);
- auto sliced = Slice<0, 1>(std::move(tuple));
- static_assert(std::is_same_v<int&&, //
- std::tuple_element_t<0, decltype(sliced)>>);
-}
-
TEST(SliceTuple, Empty) {
using sliced = SliceTuple<0, 0, std::tuple<>>;
static_assert(std::tuple_size_v<sliced> == 0);
@@ -259,9 +197,4 @@
static_assert(std::is_same_v<std::tuple_element_t<1, sliced>, float>);
}
-static_assert(std::is_same_v<char*, CharArrayToCharPtr<char[2]>>);
-static_assert(std::is_same_v<const char*, CharArrayToCharPtr<const char[2]>>);
-static_assert(std::is_same_v<int, CharArrayToCharPtr<int>>);
-static_assert(std::is_same_v<int[2], CharArrayToCharPtr<int[2]>>);
-
} // namespace tint::traits