From 1995fc56e18d43e03c34dc769c185bed0a52de95 Mon Sep 17 00:00:00 2001 From: Andrei Elovikov Date: Tue, 27 Feb 2024 15:19:27 -0800 Subject: [PATCH] Simplify mock_compile_time_properties.hpp by fakePropKind helper --- .../mock_compile_time_properties.hpp | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/sycl/test/extensions/properties/mock_compile_time_properties.hpp b/sycl/test/extensions/properties/mock_compile_time_properties.hpp index 7af3615038d4b..5b64951bae24c 100644 --- a/sycl/test/extensions/properties/mock_compile_time_properties.hpp +++ b/sycl/test/extensions/properties/mock_compile_time_properties.hpp @@ -16,29 +16,25 @@ namespace sycl { namespace ext { namespace oneapi { namespace experimental { +inline constexpr detail::PropKind fakePropKind(int N) { + return static_cast( + static_cast(detail::PropKind::PropKindSize) + N); +} -struct bar_key - : detail::compile_time_property_key( - static_cast(detail::PropKind::PropKindSize) + 0)> { +struct bar_key : detail::compile_time_property_key { using value_t = property_value; }; -struct baz_key - : detail::compile_time_property_key( - static_cast(detail::PropKind::PropKindSize) + 1)> { +struct baz_key : detail::compile_time_property_key { template using value_t = property_value>; }; -struct boo_key - : detail::compile_time_property_key( - static_cast(detail::PropKind::PropKindSize) + 2)> { +struct boo_key : detail::compile_time_property_key { template using value_t = property_value; }; -struct foo - : detail::run_time_property_key( - static_cast(detail::PropKind::PropKindSize) + 3)> { +struct foo : detail::run_time_property_key { constexpr foo(int v) : value(v) {} int value; }; @@ -48,9 +44,7 @@ inline bool operator==(const foo &lhs, const foo &rhs) { } inline bool operator!=(const foo &lhs, const foo &rhs) { return !(lhs == rhs); } -struct foz - : detail::run_time_property_key( - static_cast(detail::PropKind::PropKindSize) + 4)> { +struct foz : detail::run_time_property_key { constexpr foz(float v1, bool v2) : value1(v1), value2(v2) {} // Define copy constructor to make foz non-trivially copyable constexpr foz(const foz &f) { @@ -66,9 +60,7 @@ inline bool operator==(const foz &lhs, const foz &rhs) { } inline bool operator!=(const foz &lhs, const foz &rhs) { return !(lhs == rhs); } -struct fir - : detail::run_time_property_key( - static_cast(detail::PropKind::PropKindSize) + 5)> { +struct fir : detail::run_time_property_key { // Intentionally not constexpr to test for properties that cannot be constexpr fir(float v1, bool v2) : value1(v1), value2(v2) {} // Define copy constructor to make foz non-trivially copyable