Convert Decay to standard version. The `traits::Decay` helper is just a wrapper around what is now `std::decay_t`. Convert to the std version. Change-Id: I34d6728f0f0f0eeca278a777374b75421df1d550 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/239095 Reviewed-by: James Price <jrprice@google.com> Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/core/ir/builder.h b/src/tint/lang/core/ir/builder.h index 075c7fc..57918bc 100644 --- a/src/tint/lang/core/ir/builder.h +++ b/src/tint/lang/core/ir/builder.h
@@ -117,13 +117,13 @@ /// VectorRef. template <typename... TYPES> using EnableIfVectorLike = std::enable_if_t< - tint::IsVectorLike<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>; + tint::IsVectorLike<std::decay_t<tint::traits::NthTypeOf<0, TYPES..., void>>>>; /// A helper used to disable overloads if the first type in `TYPES` is a Vector or /// VectorRef. template <typename... TYPES> using DisableIfVectorLike = std::enable_if_t< - !tint::IsVectorLike<tint::traits::Decay<tint::traits::NthTypeOf<0, TYPES..., void>>>>; + !tint::IsVectorLike<std::decay_t<tint::traits::NthTypeOf<0, TYPES..., void>>>>; /// A namespace for the various instruction insertion method struct InsertionPoints { @@ -559,7 +559,7 @@ /// Pass-through overload for Values() with vector-like argument /// @param vec the vector of ir::Value* /// @return @p vec - template <typename VEC, typename = EnableIfVectorLike<tint::traits::Decay<VEC>>> + template <typename VEC, typename = EnableIfVectorLike<std::decay_t<VEC>>> auto Values(VEC&& vec) { return std::forward<VEC>(vec); }
diff --git a/src/tint/lang/core/ir/operand_instruction.h b/src/tint/lang/core/ir/operand_instruction.h index 9ae0b22..1daf3f4 100644 --- a/src/tint/lang/core/ir/operand_instruction.h +++ b/src/tint/lang/core/ir/operand_instruction.h
@@ -125,8 +125,8 @@ /// Sets the results of the instruction /// @param values the new result values template <typename... ARGS, - typename = std::enable_if_t<!tint::IsVectorLike< - tint::traits::Decay<tint::traits::NthTypeOf<0, ARGS..., void>>>>> + typename = std::enable_if_t< + !tint::IsVectorLike<std::decay_t<tint::traits::NthTypeOf<0, ARGS..., void>>>>> void SetResults(ARGS&&... values) { SetResults(Vector{std::forward<ARGS>(values)...}); }
diff --git a/src/tint/lang/wgsl/ast/builder.h b/src/tint/lang/wgsl/ast/builder.h index e19df59..c18d84c 100644 --- a/src/tint/lang/wgsl/ast/builder.h +++ b/src/tint/lang/wgsl/ast/builder.h
@@ -153,44 +153,44 @@ /// perfectly-forward the first argument. template <typename... TYPES> using DisableIfSource = - std::enable_if_t<!IsSource<traits::Decay<traits::NthTypeOf<0, TYPES..., void>>>>; + std::enable_if_t<!IsSource<std::decay_t<traits::NthTypeOf<0, TYPES..., void>>>>; /// A helper used to disable overloads if the first type in `TYPES` is a scalar type. Used to /// avoid ambiguities in overloads that take a scalar as the first parameter and those that /// perfectly-forward the first argument. template <typename... TYPES> using DisableIfScalar = - std::enable_if_t<!IsScalar<traits::Decay<traits::NthTypeOf<0, TYPES..., void>>>>; + std::enable_if_t<!IsScalar<std::decay_t<traits::NthTypeOf<0, TYPES..., void>>>>; /// A helper used to enable overloads if the first type in `TYPES` is a scalar type. Used to /// avoid ambiguities in overloads that take a scalar as the first parameter and those that /// perfectly-forward the first argument. template <typename... TYPES> using EnableIfScalar = - std::enable_if_t<IsScalar<traits::Decay<traits::NthTypeOf<0, TYPES..., void>>>>; + std::enable_if_t<IsScalar<std::decay_t<traits::NthTypeOf<0, TYPES..., void>>>>; /// A helper used to disable overloads if the first type in `TYPES` is a Vector or /// VectorRef. template <typename... TYPES> using DisableIfVectorLike = - std::enable_if_t<!IsVectorLike<traits::Decay<traits::NthTypeOf<0, TYPES..., void>>>>; + std::enable_if_t<!IsVectorLike<std::decay_t<traits::NthTypeOf<0, TYPES..., void>>>>; /// A helper used to enable overloads if the first type in `TYPES` is identifier-like. template <typename... TYPES> using EnableIfIdentifierLike = - std::enable_if_t<IsIdentifierLike<traits::Decay<traits::NthTypeOf<0, TYPES..., void>>>>; + std::enable_if_t<IsIdentifierLike<std::decay_t<traits::NthTypeOf<0, TYPES..., void>>>>; /// A helper used to disable overloads if the first type in `TYPES` is Infer or an abstract /// numeric. template <typename... TYPES> using DisableIfInferOrAbstract = - std::enable_if_t<!IsInferOrAbstract<traits::Decay<traits::NthTypeOf<0, TYPES..., void>>>>; + std::enable_if_t<!IsInferOrAbstract<std::decay_t<traits::NthTypeOf<0, TYPES..., void>>>>; /// A helper used to enable overloads if the first type in `TYPES` is Infer or an abstract /// numeric. template <typename... TYPES> using EnableIfInferOrAbstract = - std::enable_if_t<IsInferOrAbstract<traits::Decay<traits::NthTypeOf<0, TYPES..., void>>>>; + std::enable_if_t<IsInferOrAbstract<std::decay_t<traits::NthTypeOf<0, TYPES..., void>>>>; /// VarOptions is a helper for accepting an arbitrary number of order independent options for /// constructing an ast::Var.
diff --git a/src/tint/utils/rtti/traits.h b/src/tint/utils/rtti/traits.h index 7956ab4..11830eb 100644 --- a/src/tint/utils/rtti/traits.h +++ b/src/tint/utils/rtti/traits.h
@@ -41,10 +41,6 @@ namespace tint::traits { -/// Convience type definition for std::decay<T>::type -template <typename T> -using Decay = typename std::decay<T>::type; - /// NthTypeOf returns the `N`th type in `Types` template <int N, typename... Types> using NthTypeOf = typename std::tuple_element<N, std::tuple<Types...>>::type; @@ -94,30 +90,30 @@ /// SignatureOfT is an alias to `typename SignatureOf<F>::type`. template <typename F> -using SignatureOfT = typename SignatureOf<Decay<F>>::type; +using SignatureOfT = typename SignatureOf<std::decay_t<F>>::type; /// ParameterType is an alias to `typename SignatureOf<F>::type::parameter<N>`. template <typename F, std::size_t N> -using ParameterType = typename SignatureOfT<Decay<F>>::template parameter<N>; +using ParameterType = typename SignatureOfT<std::decay_t<F>>::template parameter<N>; /// LastParameterType returns the type of the last parameter of `F`. `F` must have at least one /// parameter. template <typename F> -using LastParameterType = ParameterType<F, SignatureOfT<Decay<F>>::parameter_count - 1>; +using LastParameterType = ParameterType<F, SignatureOfT<std::decay_t<F>>::parameter_count - 1>; /// ReturnType is an alias to `typename SignatureOf<F>::type::ret`. template <typename F> -using ReturnType = typename SignatureOfT<Decay<F>>::ret; +using ReturnType = typename SignatureOfT<std::decay_t<F>>::ret; /// Returns true iff decayed T and decayed U are the same. template <typename T, typename U> -static constexpr bool IsType = std::is_same<Decay<T>, Decay<U>>::value; +static constexpr bool IsType = std::is_same<std::decay_t<T>, std::decay_t<U>>::value; /// IsTypeOrDerived<T, BASE> is true iff `T` is of type `BASE`, or derives from /// `BASE`. template <typename T, typename BASE> static constexpr bool IsTypeOrDerived = - std::is_base_of<BASE, Decay<T>>::value || std::is_same<BASE, Decay<T>>::value; + std::is_base_of<BASE, std::decay_t<T>>::value || std::is_same<BASE, std::decay_t<T>>::value; /// If `T` is of type `BASE`, or derives from `BASE`, then EnableIfIsType /// resolves to type `T`, otherwise an invalid type. @@ -189,14 +185,15 @@ /// Evaluates to the decayed pointer element type, or the decayed type T if T is not a pointer. template <typename T> -using PtrElTy = Decay<std::remove_pointer_t<Decay<T>>>; +using PtrElTy = std::decay_t<std::remove_pointer_t<std::decay_t<T>>>; /// Evaluates to true if `T` decayed is a `std::string`, `std::string_view`, `const char*` or /// `char*` template <typename T> static constexpr bool IsStringLike = - std::is_same_v<Decay<T>, std::string> || std::is_same_v<Decay<T>, std::string_view> || - std::is_same_v<Decay<T>, const char*> || std::is_same_v<Decay<T>, char*>; + std::is_same_v<std::decay_t<T>, std::string> || + std::is_same_v<std::decay_t<T>, std::string_view> || + std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*>; namespace detail { /// Helper for CharArrayToCharPtr