From 819d1e860ea7b10f609ca78099878e6e2dcdeeb1 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Fri, 28 Apr 2023 11:02:46 -0700 Subject: [PATCH] [libc++][PSTL] Fix clang-tidy Reviewed By: ldionne, #libc Spies: libcxx-commits, miyuki, carlosgalvezp Differential Revision: https://reviews.llvm.org/D149500 --- libcxx/include/__pstl/internal/execution_impl.h | 8 +-- .../__pstl/internal/parallel_backend_serial.h | 25 ++++---- libcxx/include/__pstl/internal/parallel_impl.h | 3 +- .../include/__pstl/internal/unseq_backend_simd.h | 75 ++++++++++++---------- libcxx/include/__pstl/internal/utils.h | 36 ++++++----- libcxx/include/execution | 8 +-- libcxx/test/libcxx/clang_tidy.sh.cpp | 3 - 7 files changed, 82 insertions(+), 76 deletions(-) diff --git a/libcxx/include/__pstl/internal/execution_impl.h b/libcxx/include/__pstl/internal/execution_impl.h index 182075c..c930824 100644 --- a/libcxx/include/__pstl/internal/execution_impl.h +++ b/libcxx/include/__pstl/internal/execution_impl.h @@ -60,25 +60,25 @@ using __tag_type = __serial_tag<_IsVector>>::type; template -__serial_tag +_LIBCPP_HIDE_FROM_ABI __serial_tag __select_backend(__pstl::execution::sequenced_policy, _IteratorTypes&&...) { return {}; } template -__serial_tag<__internal::__are_random_access_iterators<_IteratorTypes...>> +_LIBCPP_HIDE_FROM_ABI __serial_tag<__internal::__are_random_access_iterators<_IteratorTypes...>> __select_backend(__pstl::execution::unsequenced_policy, _IteratorTypes&&...) { return {}; } template -__tag_type +_LIBCPP_HIDE_FROM_ABI __tag_type __select_backend(__pstl::execution::parallel_policy, _IteratorTypes&&...) { return {}; } template -__tag_type<__internal::__are_random_access_iterators<_IteratorTypes...>, _IteratorTypes...> +_LIBCPP_HIDE_FROM_ABI __tag_type<__internal::__are_random_access_iterators<_IteratorTypes...>, _IteratorTypes...> __select_backend(__pstl::execution::parallel_unsequenced_policy, _IteratorTypes&&...) { return {}; } diff --git a/libcxx/include/__pstl/internal/parallel_backend_serial.h b/libcxx/include/__pstl/internal/parallel_backend_serial.h index 4225943..c73a45c 100644 --- a/libcxx/include/__pstl/internal/parallel_backend_serial.h +++ b/libcxx/include/__pstl/internal/parallel_backend_serial.h @@ -32,31 +32,32 @@ class __buffer operator=(const __buffer&) = delete; public: + _LIBCPP_HIDE_FROM_ABI __buffer(std::size_t __n) : __allocator_(), __ptr_(__allocator_.allocate(__n)), __buf_size_(__n) {} - operator bool() const { return __ptr_ != nullptr; } - _Tp* + _LIBCPP_HIDE_FROM_ABI operator bool() const { return __ptr_ != nullptr; } + _LIBCPP_HIDE_FROM_ABI _Tp* get() const { return __ptr_; } - ~__buffer() { __allocator_.deallocate(__ptr_, __buf_size_); } + _LIBCPP_HIDE_FROM_ABI ~__buffer() { __allocator_.deallocate(__ptr_, __buf_size_); } }; -inline void +_LIBCPP_HIDE_FROM_ABI inline void __cancel_execution() { } template -void +_LIBCPP_HIDE_FROM_ABI void __parallel_for(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _Index __first, _Index __last, _Fp __f) { __f(__first, __last); } template -_Value +_LIBCPP_HIDE_FROM_ABI _Value __parallel_reduce(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _Index __first, _Index __last, const _Value& __identity, const _RealBody& __real_body, const _Reduction&) { @@ -71,7 +72,7 @@ __parallel_reduce(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, } template -_Tp +_LIBCPP_HIDE_FROM_ABI _Tp __parallel_transform_reduce(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _Index __first, _Index __last, _UnaryOp, _Tp __init, _BinaryOp, _Reduce __reduce) { @@ -79,7 +80,7 @@ __parallel_transform_reduce(__pstl::__internal::__serial_backend_tag, _Execution } template -void +_LIBCPP_HIDE_FROM_ABI void __parallel_strict_scan(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _Index __n, _Tp __initial, _Rp __reduce, _Cp __combine, _Sp __scan, _Ap __apex) { @@ -92,7 +93,7 @@ __parallel_strict_scan(__pstl::__internal::__serial_backend_tag, _ExecutionPolic } template -_Tp +_LIBCPP_HIDE_FROM_ABI _Tp __parallel_transform_scan(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _Index __n, _UnaryOp, _Tp __init, _BinaryOp, _Reduce, _Scan __scan) { @@ -100,7 +101,7 @@ __parallel_transform_scan(__pstl::__internal::__serial_backend_tag, _ExecutionPo } template -void +_LIBCPP_HIDE_FROM_ABI void __parallel_stable_sort(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, _LeafSort __leaf_sort, std::size_t = 0) { @@ -109,7 +110,7 @@ __parallel_stable_sort(__pstl::__internal::__serial_backend_tag, _ExecutionPolic template -void +_LIBCPP_HIDE_FROM_ABI void __parallel_merge(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _RandomAccessIterator3 __outit, _Compare __comp, _LeafMerge __leaf_merge) @@ -118,7 +119,7 @@ __parallel_merge(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _ } template -void +_LIBCPP_HIDE_FROM_ABI void __parallel_invoke(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _F1&& __f1, _F2&& __f2) { std::forward<_F1>(__f1)(); diff --git a/libcxx/include/__pstl/internal/parallel_impl.h b/libcxx/include/__pstl/internal/parallel_impl.h index ff56ae6..4174400 100644 --- a/libcxx/include/__pstl/internal/parallel_impl.h +++ b/libcxx/include/__pstl/internal/parallel_impl.h @@ -28,7 +28,7 @@ namespace __internal /** Return extremum value returned by brick f[i,j) for subranges [i,j) of [first,last) Each f[i,j) must return a value in [i,j). */ template -_Index +_LIBCPP_HIDE_FROM_ABI _Index __parallel_find(_BackendTag __tag, _ExecutionPolicy&& __exec, _Index __first, _Index __last, _Brick __f, _Compare __comp, bool __b_first) { @@ -65,6 +65,7 @@ __parallel_find(_BackendTag __tag, _ExecutionPolicy&& __exec, _Index __first, _I //------------------------------------------------------------------------ //! Return true if brick f[i,j) returns true for some subrange [i,j) of [first,last) template +_LIBCPP_HIDE_FROM_ABI bool __parallel_or(_BackendTag __tag, _ExecutionPolicy&& __exec, _Index __first, _Index __last, _Brick __f) { std::atomic __found(false); __par_backend::__parallel_for(__tag, std::forward<_ExecutionPolicy>(__exec), __first, __last, diff --git a/libcxx/include/__pstl/internal/unseq_backend_simd.h b/libcxx/include/__pstl/internal/unseq_backend_simd.h index 8009f8d..6918f4c 100644 --- a/libcxx/include/__pstl/internal/unseq_backend_simd.h +++ b/libcxx/include/__pstl/internal/unseq_backend_simd.h @@ -28,7 +28,7 @@ namespace __unseq_backend const std::size_t __lane_size = 64; template -_Iterator +_LIBCPP_HIDE_FROM_ABI _Iterator __simd_walk_1(_Iterator __first, _DifferenceType __n, _Function __f) noexcept { _PSTL_PRAGMA_SIMD @@ -39,7 +39,7 @@ __simd_walk_1(_Iterator __first, _DifferenceType __n, _Function __f) noexcept } template -_Iterator2 +_LIBCPP_HIDE_FROM_ABI _Iterator2 __simd_walk_2(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept { _PSTL_PRAGMA_SIMD @@ -49,7 +49,7 @@ __simd_walk_2(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Fu } template -_Iterator3 +_LIBCPP_HIDE_FROM_ABI _Iterator3 __simd_walk_3(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, _Function __f) noexcept { @@ -61,7 +61,7 @@ __simd_walk_3(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _It // TODO: check whether __simd_first() can be used here template -bool +_LIBCPP_HIDE_FROM_ABI bool __simd_or(_Index __first, _DifferenceType __n, _Pred __pred) noexcept { #if defined(_PSTL_EARLYEXIT_PRESENT) @@ -101,7 +101,7 @@ __simd_or(_Index __first, _DifferenceType __n, _Pred __pred) noexcept } template -_Index +_LIBCPP_HIDE_FROM_ABI _Index __simd_first(_Index __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp) noexcept { #if defined(_PSTL_EARLYEXIT_PRESENT) @@ -161,7 +161,7 @@ __simd_first(_Index __first, _DifferenceType __begin, _DifferenceType __end, _Co } template -std::pair<_Index1, _Index2> +_LIBCPP_HIDE_FROM_ABI std::pair<_Index1, _Index2> __simd_first(_Index1 __first1, _DifferenceType __n, _Index2 __first2, _Pred __pred) noexcept { #if defined(_PSTL_EARLYEXIT_PRESENT) @@ -215,7 +215,7 @@ __simd_first(_Index1 __first1, _DifferenceType __n, _Index2 __first2, _Pred __pr } template -_DifferenceType +_LIBCPP_HIDE_FROM_ABI _DifferenceType __simd_count(_Index __index, _DifferenceType __n, _Pred __pred) noexcept { _DifferenceType __count = 0; @@ -228,7 +228,7 @@ __simd_count(_Index __index, _DifferenceType __n, _Pred __pred) noexcept } template -_OutputIterator +_LIBCPP_HIDE_FROM_ABI _OutputIterator __simd_unique_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _BinaryPredicate __pred) noexcept { @@ -252,7 +252,7 @@ __simd_unique_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator } template -_OutputIterator +_LIBCPP_HIDE_FROM_ABI _OutputIterator __simd_assign(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _Assigner __assigner) noexcept { _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED @@ -263,7 +263,7 @@ __simd_assign(_InputIterator __first, _DifferenceType __n, _OutputIterator __res } template -_OutputIterator +_LIBCPP_HIDE_FROM_ABI _OutputIterator __simd_copy_if(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _UnaryPredicate __pred) noexcept { _DifferenceType __cnt = 0; @@ -282,7 +282,7 @@ __simd_copy_if(_InputIterator __first, _DifferenceType __n, _OutputIterator __re } template -_DifferenceType +_LIBCPP_HIDE_FROM_ABI _DifferenceType __simd_calc_mask_2(_InputIterator __first, _DifferenceType __n, bool* __mask, _BinaryPredicate __pred) noexcept { _DifferenceType __count = 0; @@ -297,7 +297,7 @@ __simd_calc_mask_2(_InputIterator __first, _DifferenceType __n, bool* __mask, _B } template -_DifferenceType +_LIBCPP_HIDE_FROM_ABI _DifferenceType __simd_calc_mask_1(_InputIterator __first, _DifferenceType __n, bool* __mask, _UnaryPredicate __pred) noexcept { _DifferenceType __count = 0; @@ -312,7 +312,7 @@ __simd_calc_mask_1(_InputIterator __first, _DifferenceType __n, bool* __mask, _U } template -void +_LIBCPP_HIDE_FROM_ABI void __simd_copy_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, bool* __mask, _Assigner __assigner) noexcept { @@ -332,7 +332,7 @@ __simd_copy_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator } template -void +_LIBCPP_HIDE_FROM_ABI void __simd_partition_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator1 __out_true, _OutputIterator2 __out_false, bool* __mask) noexcept { @@ -355,7 +355,7 @@ __simd_partition_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIte } template -_Index +_LIBCPP_HIDE_FROM_ABI _Index __simd_fill_n(_Index __first, _DifferenceType __n, const _Tp& __value) noexcept { _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED @@ -366,7 +366,7 @@ __simd_fill_n(_Index __first, _DifferenceType __n, const _Tp& __value) noexcept } template -_Index +_LIBCPP_HIDE_FROM_ABI _Index __simd_generate_n(_Index __first, _DifferenceType __size, _Generator __g) noexcept { _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED @@ -377,7 +377,7 @@ __simd_generate_n(_Index __first, _DifferenceType __size, _Generator __g) noexce } template -_Index +_LIBCPP_HIDE_FROM_ABI _Index __simd_adjacent_find(_Index __first, _Index __last, _BinaryPredicate __pred, bool __or_semantic) noexcept { if (__last - __first < 2) @@ -446,7 +446,7 @@ using is_arithmetic_plus = std::integral_constant: std::is_same<_BinaryOperation, std::plus<_Tp>>::value>; template -typename std::enable_if::value, _Tp>::type +_LIBCPP_HIDE_FROM_ABI typename std::enable_if::value, _Tp>::type __simd_transform_reduce(_DifferenceType __n, _Tp __init, _BinaryOperation, _UnaryOperation __f) noexcept { _PSTL_PRAGMA_SIMD_REDUCTION(+ : __init) @@ -456,7 +456,7 @@ __simd_transform_reduce(_DifferenceType __n, _Tp __init, _BinaryOperation, _Unar } template -typename std::enable_if::value, _Tp>::type +_LIBCPP_HIDE_FROM_ABI typename std::enable_if::value, _Tp>::type __simd_transform_reduce(_Size __n, _Tp __init, _BinaryOperation __binary_op, _UnaryOperation __f) noexcept { const _Size __block_size = __lane_size / sizeof(_Tp); @@ -513,6 +513,7 @@ __simd_transform_reduce(_Size __n, _Tp __init, _BinaryOperation __binary_op, _Un // Exclusive scan for "+" and arithmetic types template +_LIBCPP_HIDE_FROM_ABI typename std::enable_if::value, std::pair<_OutputIterator, _Tp>>::type __simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, _BinaryOperation, /*Inclusive*/ std::false_type) @@ -534,11 +535,12 @@ struct _Combiner _Tp __value; _BinaryOp* __bin_op; // Here is a pointer to function because of default ctor - _Combiner() : __value{}, __bin_op(nullptr) {} + _LIBCPP_HIDE_FROM_ABI _Combiner() : __value{}, __bin_op(nullptr) {} + _LIBCPP_HIDE_FROM_ABI _Combiner(const _Tp& value, const _BinaryOp* bin_op) : __value(value), __bin_op(const_cast<_BinaryOp*>(bin_op)) {} - _Combiner(const _Combiner& __obj) : __value{}, __bin_op(__obj.__bin_op) {} + _LIBCPP_HIDE_FROM_ABI _Combiner(const _Combiner& __obj) : __value{}, __bin_op(__obj.__bin_op) {} - void + _LIBCPP_HIDE_FROM_ABI void operator()(const _Combiner& __obj) { __value = (*__bin_op)(__value, __obj.__value); @@ -548,6 +550,7 @@ struct _Combiner // Exclusive scan for other binary operations and types template +_LIBCPP_HIDE_FROM_ABI typename std::enable_if::value, std::pair<_OutputIterator, _Tp>>::type __simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, _BinaryOperation __binary_op, /*Inclusive*/ std::false_type) @@ -571,6 +574,7 @@ __simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryO // Inclusive scan for "+" and arithmetic types template +_LIBCPP_HIDE_FROM_ABI typename std::enable_if::value, std::pair<_OutputIterator, _Tp>>::type __simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, _BinaryOperation, /*Inclusive*/ std::true_type) @@ -588,6 +592,7 @@ __simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryO // Inclusive scan for other binary operations and types template +_LIBCPP_HIDE_FROM_ABI typename std::enable_if::value, std::pair<_OutputIterator, _Tp>>::type __simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryOperation __unary_op, _Tp __init, _BinaryOperation __binary_op, std::true_type) @@ -611,7 +616,7 @@ __simd_scan(_InputIterator __first, _Size __n, _OutputIterator __result, _UnaryO // [restriction] - std::iterator_traits<_ForwardIterator>::value_type should be DefaultConstructible. // complexity [violation] - We will have at most (__n-1 + number_of_lanes) comparisons instead of at most __n-1. template -_ForwardIterator +_LIBCPP_HIDE_FROM_ABI _ForwardIterator __simd_min_element(_ForwardIterator __first, _Size __n, _Compare __comp) noexcept { if (__n == 0) @@ -626,18 +631,18 @@ __simd_min_element(_ForwardIterator __first, _Size __n, _Compare __comp) noexcep _Size __min_ind; _Compare* __min_comp; - _ComplexType() : __min_val{}, __min_ind{}, __min_comp(nullptr) {} - _ComplexType(const _ValueType& val, const _Compare* comp) + _LIBCPP_HIDE_FROM_ABI _ComplexType() : __min_val{}, __min_ind{}, __min_comp(nullptr) {} + _LIBCPP_HIDE_FROM_ABI _ComplexType(const _ValueType& val, const _Compare* comp) : __min_val(val), __min_ind(0), __min_comp(const_cast<_Compare*>(comp)) { } - _ComplexType(const _ComplexType& __obj) + _LIBCPP_HIDE_FROM_ABI _ComplexType(const _ComplexType& __obj) : __min_val(__obj.__min_val), __min_ind(__obj.__min_ind), __min_comp(__obj.__min_comp) { } _PSTL_PRAGMA_DECLARE_SIMD - void + _LIBCPP_HIDE_FROM_ABI void operator()(const _ComplexType& __obj) { if (!(*__min_comp)(__min_val, __obj.__min_val) && @@ -670,7 +675,7 @@ __simd_min_element(_ForwardIterator __first, _Size __n, _Compare __comp) noexcep // [restriction] - std::iterator_traits<_ForwardIterator>::value_type should be DefaultConstructible. // complexity [violation] - We will have at most (2*(__n-1) + 4*number_of_lanes) comparisons instead of at most [1.5*(__n-1)]. template -std::pair<_ForwardIterator, _ForwardIterator> +_LIBCPP_HIDE_FROM_ABI std::pair<_ForwardIterator, _ForwardIterator> __simd_minmax_element(_ForwardIterator __first, _Size __n, _Compare __comp) noexcept { if (__n == 0) @@ -687,19 +692,19 @@ __simd_minmax_element(_ForwardIterator __first, _Size __n, _Compare __comp) noex _Size __max_ind; _Compare* __minmax_comp; - _ComplexType() : __min_val{}, __max_val{}, __min_ind{}, __max_ind{}, __minmax_comp(nullptr) {} - _ComplexType(const _ValueType& min_val, const _ValueType& max_val, const _Compare* comp) + _LIBCPP_HIDE_FROM_ABI _ComplexType() : __min_val{}, __max_val{}, __min_ind{}, __max_ind{}, __minmax_comp(nullptr) {} + _LIBCPP_HIDE_FROM_ABI _ComplexType(const _ValueType& min_val, const _ValueType& max_val, const _Compare* comp) : __min_val(min_val), __max_val(max_val), __min_ind(0), __max_ind(0), __minmax_comp(const_cast<_Compare*>(comp)) { } - _ComplexType(const _ComplexType& __obj) + _LIBCPP_HIDE_FROM_ABI _ComplexType(const _ComplexType& __obj) : __min_val(__obj.__min_val), __max_val(__obj.__max_val), __min_ind(__obj.__min_ind), __max_ind(__obj.__max_ind), __minmax_comp(__obj.__minmax_comp) { } - void + _LIBCPP_HIDE_FROM_ABI void operator()(const _ComplexType& __obj) { // min @@ -754,7 +759,7 @@ __simd_minmax_element(_ForwardIterator __first, _Size __n, _Compare __comp) noex template -std::pair<_OutputIterator1, _OutputIterator2> +_LIBCPP_HIDE_FROM_ABI std::pair<_OutputIterator1, _OutputIterator2> __simd_partition_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator1 __out_true, _OutputIterator2 __out_false, _UnaryPredicate __pred) noexcept { @@ -779,7 +784,7 @@ __simd_partition_copy(_InputIterator __first, _DifferenceType __n, _OutputIterat } template -_ForwardIterator1 +_LIBCPP_HIDE_FROM_ABI _ForwardIterator1 __simd_find_first_of(_ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first, _ForwardIterator2 __s_last, _BinaryPredicate __pred) noexcept { @@ -825,7 +830,7 @@ __simd_find_first_of(_ForwardIterator1 __first, _ForwardIterator1 __last, _Forwa } template -_RandomAccessIterator +_LIBCPP_HIDE_FROM_ABI _RandomAccessIterator __simd_remove_if(_RandomAccessIterator __first, _DifferenceType __n, _UnaryPredicate __pred) noexcept { // find first element we need to remove diff --git a/libcxx/include/__pstl/internal/utils.h b/libcxx/include/__pstl/internal/utils.h index d0236f1..1623983 100644 --- a/libcxx/include/__pstl/internal/utils.h +++ b/libcxx/include/__pstl/internal/utils.h @@ -19,7 +19,7 @@ namespace __pstl { namespace __internal { template -auto __except_handler(_Fp __f) -> decltype(__f()) { +_LIBCPP_HIDE_FROM_ABI auto __except_handler(_Fp __f) -> decltype(__f()) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif // _LIBCPP_HAS_NO_EXCEPTIONS @@ -34,35 +34,35 @@ auto __except_handler(_Fp __f) -> decltype(__f()) { } template -void __invoke_if(std::true_type, _Fp __f) { +_LIBCPP_HIDE_FROM_ABI void __invoke_if(std::true_type, _Fp __f) { __f(); } template -void __invoke_if(std::false_type, _Fp) {} +_LIBCPP_HIDE_FROM_ABI void __invoke_if(std::false_type, _Fp) {} template -void __invoke_if_not(std::false_type, _Fp __f) { +_LIBCPP_HIDE_FROM_ABI void __invoke_if_not(std::false_type, _Fp __f) { __f(); } template -void __invoke_if_not(std::true_type, _Fp) {} +_LIBCPP_HIDE_FROM_ABI void __invoke_if_not(std::true_type, _Fp) {} template -auto __invoke_if_else(std::true_type, _F1 __f1, _F2) -> decltype(__f1()) { +_LIBCPP_HIDE_FROM_ABI auto __invoke_if_else(std::true_type, _F1 __f1, _F2) -> decltype(__f1()) { return __f1(); } template -auto __invoke_if_else(std::false_type, _F1, _F2 __f2) -> decltype(__f2()) { +_LIBCPP_HIDE_FROM_ABI auto __invoke_if_else(std::false_type, _F1, _F2 __f2) -> decltype(__f2()) { return __f2(); } //! Unary operator that returns reference to its argument. struct __no_op { template - _Tp&& operator()(_Tp&& __a) const { + _LIBCPP_HIDE_FROM_ABI _Tp&& operator()(_Tp&& __a) const { return std::forward<_Tp>(__a); } }; @@ -72,10 +72,10 @@ class __reorder_pred { _Pred _M_pred; public: - explicit __reorder_pred(_Pred __pred) : _M_pred(__pred) {} + _LIBCPP_HIDE_FROM_ABI explicit __reorder_pred(_Pred __pred) : _M_pred(__pred) {} template - bool operator()(_FTp&& __a, _STp&& __b) { + _LIBCPP_HIDE_FROM_ABI bool operator()(_FTp&& __a, _STp&& __b) { return _M_pred(std::forward<_STp>(__b), std::forward<_FTp>(__a)); } }; @@ -87,10 +87,11 @@ class __equal_value_by_pred { _Predicate _M_pred; public: - __equal_value_by_pred(const _Tp& __value, _Predicate __pred) : _M_value(__value), _M_pred(__pred) {} + _LIBCPP_HIDE_FROM_ABI __equal_value_by_pred(const _Tp& __value, _Predicate __pred) + : _M_value(__value), _M_pred(__pred) {} template - bool operator()(_Arg&& __arg) { + _LIBCPP_HIDE_FROM_ABI bool operator()(_Arg&& __arg) { return _M_pred(std::forward<_Arg>(__arg), _M_value); } }; @@ -101,10 +102,10 @@ class __equal_value { const _Tp& _M_value; public: - explicit __equal_value(const _Tp& __value) : _M_value(__value) {} + _LIBCPP_HIDE_FROM_ABI explicit __equal_value(const _Tp& __value) : _M_value(__value) {} template - bool operator()(_Arg&& __arg) const { + _LIBCPP_HIDE_FROM_ABI bool operator()(_Arg&& __arg) const { return std::forward<_Arg>(__arg) == _M_value; } }; @@ -115,16 +116,17 @@ class __not_equal_value { const _Tp& _M_value; public: - explicit __not_equal_value(const _Tp& __value) : _M_value(__value) {} + _LIBCPP_HIDE_FROM_ABI explicit __not_equal_value(const _Tp& __value) : _M_value(__value) {} template - bool operator()(_Arg&& __arg) const { + _LIBCPP_HIDE_FROM_ABI bool operator()(_Arg&& __arg) const { return !(std::forward<_Arg>(__arg) == _M_value); } }; template -_ForwardIterator __cmp_iterators_by_values(_ForwardIterator __a, _ForwardIterator __b, _Compare __comp) { +_LIBCPP_HIDE_FROM_ABI _ForwardIterator +__cmp_iterators_by_values(_ForwardIterator __a, _ForwardIterator __b, _Compare __comp) { if (__a < __b) { // we should return closer iterator return __comp(*__b, *__a) ? __b : __a; } else { diff --git a/libcxx/include/execution b/libcxx/include/execution index a09e1b3..30e6682 100644 --- a/libcxx/include/execution +++ b/libcxx/include/execution @@ -53,7 +53,7 @@ struct __disable_user_instantiations_tag { }; struct sequenced_policy { - constexpr explicit sequenced_policy(__disable_user_instantiations_tag) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit sequenced_policy(__disable_user_instantiations_tag) {} sequenced_policy(const sequenced_policy&) = delete; sequenced_policy& operator=(const sequenced_policy&) = delete; }; @@ -61,7 +61,7 @@ struct sequenced_policy { inline constexpr sequenced_policy seq{__disable_user_instantiations_tag{}}; struct parallel_policy { - constexpr explicit parallel_policy(__disable_user_instantiations_tag) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit parallel_policy(__disable_user_instantiations_tag) {} parallel_policy(const parallel_policy&) = delete; parallel_policy& operator=(const parallel_policy&) = delete; }; @@ -69,7 +69,7 @@ struct parallel_policy { inline constexpr parallel_policy par{__disable_user_instantiations_tag{}}; struct parallel_unsequenced_policy { - constexpr explicit parallel_unsequenced_policy(__disable_user_instantiations_tag) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit parallel_unsequenced_policy(__disable_user_instantiations_tag) {} parallel_unsequenced_policy(const parallel_unsequenced_policy&) = delete; parallel_unsequenced_policy& operator=(const parallel_unsequenced_policy&) = delete; }; @@ -77,7 +77,7 @@ struct parallel_unsequenced_policy { inline constexpr parallel_unsequenced_policy par_unseq{__disable_user_instantiations_tag{}}; struct __unsequenced_policy { - constexpr explicit __unsequenced_policy(__disable_user_instantiations_tag) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit __unsequenced_policy(__disable_user_instantiations_tag) {} __unsequenced_policy(const __unsequenced_policy&) = delete; __unsequenced_policy& operator=(const __unsequenced_policy&) = delete; }; diff --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp index 1469d5b..74df7af 100644 --- a/libcxx/test/libcxx/clang_tidy.sh.cpp +++ b/libcxx/test/libcxx/clang_tidy.sh.cpp @@ -8,9 +8,6 @@ // REQUIRES: has-clang-tidy -// FIXME: This should pass with the PSTL enabled -// XFAIL: with-pstl - // The GCC compiler flags are not always compatible with clang-tidy. // UNSUPPORTED: gcc -- 2.7.4