From afd38f0c617d6f89b2b4532c6c44f116617e2b6f Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Wed, 27 Sep 2023 17:46:17 +0100 Subject: Apply clang-format on repository Code is formatted as per a revised clang format configuration file(not part of this delivery). Version 14.0.6 is used. Exclusion List: - files with .cl extension - files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...) And the following directories - compute_kernel_writer/validation/ - tests/ - include/ - src/core/NEON/kernels/convolution/ - src/core/NEON/kernels/arm_gemm/ - src/core/NEON/kernels/arm_conv/ - data/ There will be a follow up for formatting of .cl files and the files under tests/ and compute_kernel_writer/validation/. Signed-off-by: Felix Thomasmathibalan Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Gunes Bayir --- support/DeepCopy.h | 56 +++++++++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 36 deletions(-) (limited to 'support/DeepCopy.h') diff --git a/support/DeepCopy.h b/support/DeepCopy.h index 0117897901..c0279284c0 100644 --- a/support/DeepCopy.h +++ b/support/DeepCopy.h @@ -40,9 +40,8 @@ namespace template Base *default_polymorphic_copy(const Base *ptr) { - static_assert(std::is_base_of::value, - "Derived is not a specialization of Base"); - if(ptr == nullptr) + static_assert(std::is_base_of::value, "Derived is not a specialization of Base"); + if (ptr == nullptr) { return nullptr; } @@ -62,25 +61,18 @@ class deep_unique_ptr public: using CopyFunc = std::function; - deep_unique_ptr(std::nullptr_t val = nullptr) noexcept - : _val{ val }, - _copy{} + deep_unique_ptr(std::nullptr_t val = nullptr) noexcept : _val{val}, _copy{} { } template - deep_unique_ptr(Derived *value, const CopyFuncDerived ©) noexcept - : _val{ value }, - _copy{ std::move(copy) } + deep_unique_ptr(Derived *value, const CopyFuncDerived ©) noexcept : _val{value}, _copy{std::move(copy)} { - static_assert(std::is_base_of::value, - "Derived is not a specialization of Base"); - static_assert( - std::is_constructible::value, - "CopyFuncDerived is not valid for a copy functor"); + static_assert(std::is_base_of::value, "Derived is not a specialization of Base"); + static_assert(std::is_constructible::value, + "CopyFuncDerived is not valid for a copy functor"); } - deep_unique_ptr(const deep_unique_ptr &ptr) - : deep_unique_ptr(ptr.clone()) + deep_unique_ptr(const deep_unique_ptr &ptr) : deep_unique_ptr(ptr.clone()) { } deep_unique_ptr &operator=(const deep_unique_ptr &ptr) @@ -90,7 +82,7 @@ public: return *this; } - deep_unique_ptr(deep_unique_ptr &&ptr) = default; + deep_unique_ptr(deep_unique_ptr &&ptr) = default; deep_unique_ptr &operator=(deep_unique_ptr &&ptr) = default; ~deep_unique_ptr() = default; friend void swap(deep_unique_ptr &ptr0, deep_unique_ptr &ptr1) noexcept @@ -135,11 +127,11 @@ public: bool operator==(const deep_unique_ptr &rhs) const { - if(rhs.get() == nullptr && _val == nullptr) + if (rhs.get() == nullptr && _val == nullptr) { return true; } - else if(rhs.get() == nullptr || _val == nullptr) + else if (rhs.get() == nullptr || _val == nullptr) { return false; } @@ -152,9 +144,9 @@ public: private: deep_unique_ptr clone() const { - return { _copy(_val.get()), CopyFunc(_copy) }; + return {_copy(_val.get()), CopyFunc(_copy)}; } - std::unique_ptr _val{ nullptr }; + std::unique_ptr _val{nullptr}; CopyFunc _copy{}; }; @@ -170,34 +162,26 @@ private: template deep_unique_ptr make_deep_unique(Derived &&temp, CopyFunc copy) { - return - { - new Derived(std::move(temp)), - CopyFunc{ std::move(copy) } - }; + return {new Derived(std::move(temp)), CopyFunc{std::move(copy)}}; } template deep_unique_ptr make_deep_unique(Derived &&temp) { - static_assert(std::is_base_of::value, - "Derived is not a specialization of Base"); + static_assert(std::is_base_of::value, "Derived is not a specialization of Base"); - return make_deep_unique( - std::move(temp), default_polymorphic_copy); + return make_deep_unique(std::move(temp), default_polymorphic_copy); } template -deep_unique_ptr make_deep_unique(Args &&... args) +deep_unique_ptr make_deep_unique(Args &&...args) { - static_assert(std::is_constructible::value, - "Cannot instantiate Derived from arguments"); + static_assert(std::is_constructible::value, "Cannot instantiate Derived from arguments"); - return make_deep_unique( - std::move(Derived{ std::forward(args)... })); + return make_deep_unique(std::move(Derived{std::forward(args)...})); } } // namespace memory } // namespace utils } // namespace arm_compute -#endif // ARM_COMPUTE_MISC_ITERABLE_H \ No newline at end of file +#endif // ARM_COMPUTE_MISC_ITERABLE_H -- cgit v1.2.1