[libc++][PSTL] Fix clang-tidy
authorNikolas Klauser <n_klauser@apple.com>
Fri, 28 Apr 2023 18:02:46 +0000 (11:02 -0700)
committerNikolas Klauser <n_klauser@apple.com>
Mon, 1 May 2023 22:23:12 +0000 (15:23 -0700)
Reviewed By: ldionne, #libc

Spies: libcxx-commits, miyuki, carlosgalvezp

Differential Revision: https://reviews.llvm.org/D149500

libcxx/include/__pstl/internal/execution_impl.h
libcxx/include/__pstl/internal/parallel_backend_serial.h
libcxx/include/__pstl/internal/parallel_impl.h
libcxx/include/__pstl/internal/unseq_backend_simd.h
libcxx/include/__pstl/internal/utils.h
libcxx/include/execution
libcxx/test/libcxx/clang_tidy.sh.cpp

index 182075c..c930824 100644 (file)
@@ -60,25 +60,25 @@ using __tag_type =
                               __serial_tag<_IsVector>>::type;
 
 template <class... _IteratorTypes>
-__serial_tag</*_IsVector = */ std::false_type>
+_LIBCPP_HIDE_FROM_ABI __serial_tag</*_IsVector = */ std::false_type>
 __select_backend(__pstl::execution::sequenced_policy, _IteratorTypes&&...) {
   return {};
 }
 
 template <class... _IteratorTypes>
-__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 <class... _IteratorTypes>
-__tag_type</*_IsVector = */ std::false_type, _IteratorTypes...>
+_LIBCPP_HIDE_FROM_ABI __tag_type</*_IsVector = */ std::false_type, _IteratorTypes...>
 __select_backend(__pstl::execution::parallel_policy, _IteratorTypes&&...) {
   return {};
 }
 
 template <class... _IteratorTypes>
-__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 {};
 }
index 4225943..c73a45c 100644 (file)
@@ -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 <class _ExecutionPolicy, class _Index, class _Fp>
-void
+_LIBCPP_HIDE_FROM_ABI void
 __parallel_for(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _Index __first, _Index __last, _Fp __f)
 {
     __f(__first, __last);
 }
 
 template <class _ExecutionPolicy, class _Value, class _Index, typename _RealBody, typename _Reduction>
-_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 <class _ExecutionPolicy, class _Index, class _UnaryOp, class _Tp, class _BinaryOp, class _Reduce>
-_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 <class _ExecutionPolicy, typename _Index, typename _Tp, typename _Rp, typename _Cp, typename _Sp, typename _Ap>
-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 <class _ExecutionPolicy, class _Index, class _UnaryOp, class _Tp, class _BinaryOp, class _Reduce, class _Scan>
-_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 <class _ExecutionPolicy, typename _RandomAccessIterator, typename _Compare, typename _LeafSort>
-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 <class _ExecutionPolicy, typename _RandomAccessIterator1, typename _RandomAccessIterator2,
           typename _RandomAccessIterator3, typename _Compare, typename _LeafMerge>
-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 <class _ExecutionPolicy, typename _F1, typename _F2>
-void
+_LIBCPP_HIDE_FROM_ABI void
 __parallel_invoke(__pstl::__internal::__serial_backend_tag, _ExecutionPolicy&&, _F1&& __f1, _F2&& __f2)
 {
     std::forward<_F1>(__f1)();
index ff56ae6..4174400 100644 (file)
@@ -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 <class _BackendTag, class _ExecutionPolicy, class _Index, class _Brick, class _Compare>
-_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 <class _BackendTag, class _ExecutionPolicy, class _Index, class _Brick>
+_LIBCPP_HIDE_FROM_ABI
 bool __parallel_or(_BackendTag __tag, _ExecutionPolicy&& __exec, _Index __first, _Index __last, _Brick __f) {
     std::atomic<bool> __found(false);
     __par_backend::__parallel_for(__tag, std::forward<_ExecutionPolicy>(__exec), __first, __last,
index 8009f8d..6918f4c 100644 (file)
@@ -28,7 +28,7 @@ namespace __unseq_backend
 const std::size_t __lane_size = 64;
 
 template <class _Iterator, class _DifferenceType, class _Function>
-_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 <class _Iterator1, class _DifferenceType, class _Iterator2, class _Function>
-_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 <class _Iterator1, class _DifferenceType, class _Iterator2, class _Iterator3, class _Function>
-_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 <class _Index, class _DifferenceType, class _Pred>
-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 <class _Index, class _DifferenceType, class _Compare>
-_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 <class _Index1, class _DifferenceType, class _Index2, class _Pred>
-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 <class _Index, class _DifferenceType, class _Pred>
-_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 <class _InputIterator, class _DifferenceType, class _OutputIterator, class _BinaryPredicate>
-_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 <class _InputIterator, class _DifferenceType, class _OutputIterator, class _Assigner>
-_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 <class _InputIterator, class _DifferenceType, class _OutputIterator, class _UnaryPredicate>
-_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 <class _InputIterator, class _DifferenceType, class _BinaryPredicate>
-_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 <class _InputIterator, class _DifferenceType, class _UnaryPredicate>
-_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 <class _InputIterator, class _DifferenceType, class _OutputIterator, class _Assigner>
-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 <class _InputIterator, class _DifferenceType, class _OutputIterator1, class _OutputIterator2>
-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 <class _Index, class _DifferenceType, class _Tp>
-_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 <class _Index, class _DifferenceType, class _Generator>
-_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 <class _Index, class _BinaryPredicate>
-_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<bool, std::is_arithmetic<_Tp>:
                                                             std::is_same<_BinaryOperation, std::plus<_Tp>>::value>;
 
 template <typename _DifferenceType, typename _Tp, typename _BinaryOperation, typename _UnaryOperation>
-typename std::enable_if<is_arithmetic_plus<_Tp, _BinaryOperation>::value, _Tp>::type
+_LIBCPP_HIDE_FROM_ABI typename std::enable_if<is_arithmetic_plus<_Tp, _BinaryOperation>::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 _Size, typename _Tp, typename _BinaryOperation, typename _UnaryOperation>
-typename std::enable_if<!is_arithmetic_plus<_Tp, _BinaryOperation>::value, _Tp>::type
+_LIBCPP_HIDE_FROM_ABI typename std::enable_if<!is_arithmetic_plus<_Tp, _BinaryOperation>::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 <class _InputIterator, class _Size, class _OutputIterator, class _UnaryOperation, class _Tp,
           class _BinaryOperation>
+_LIBCPP_HIDE_FROM_ABI
 typename std::enable_if<is_arithmetic_plus<_Tp, _BinaryOperation>::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 <class _InputIterator, class _Size, class _OutputIterator, class _UnaryOperation, class _Tp,
           class _BinaryOperation>
+_LIBCPP_HIDE_FROM_ABI
 typename std::enable_if<!is_arithmetic_plus<_Tp, _BinaryOperation>::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 <class _InputIterator, class _Size, class _OutputIterator, class _UnaryOperation, class _Tp,
           class _BinaryOperation>
+_LIBCPP_HIDE_FROM_ABI
 typename std::enable_if<is_arithmetic_plus<_Tp, _BinaryOperation>::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 <class _InputIterator, class _Size, class _OutputIterator, class _UnaryOperation, class _Tp,
           class _BinaryOperation>
+_LIBCPP_HIDE_FROM_ABI
 typename std::enable_if<!is_arithmetic_plus<_Tp, _BinaryOperation>::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 <typename _ForwardIterator, typename _Size, typename _Compare>
-_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 <typename _ForwardIterator, typename _Size, typename _Compare>
-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 <class _InputIterator, class _DifferenceType, class _OutputIterator1, class _OutputIterator2,
           class _UnaryPredicate>
-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 <class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
-_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 <class _RandomAccessIterator, class _DifferenceType, class _UnaryPredicate>
-_RandomAccessIterator
+_LIBCPP_HIDE_FROM_ABI _RandomAccessIterator
 __simd_remove_if(_RandomAccessIterator __first, _DifferenceType __n, _UnaryPredicate __pred) noexcept
 {
     // find first element we need to remove
index d0236f1..1623983 100644 (file)
@@ -19,7 +19,7 @@ namespace __pstl {
 namespace __internal {
 
 template <typename _Fp>
-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 <typename _Fp>
-void __invoke_if(std::true_type, _Fp __f) {
+_LIBCPP_HIDE_FROM_ABI void __invoke_if(std::true_type, _Fp __f) {
   __f();
 }
 
 template <typename _Fp>
-void __invoke_if(std::false_type, _Fp) {}
+_LIBCPP_HIDE_FROM_ABI void __invoke_if(std::false_type, _Fp) {}
 
 template <typename _Fp>
-void __invoke_if_not(std::false_type, _Fp __f) {
+_LIBCPP_HIDE_FROM_ABI void __invoke_if_not(std::false_type, _Fp __f) {
   __f();
 }
 
 template <typename _Fp>
-void __invoke_if_not(std::true_type, _Fp) {}
+_LIBCPP_HIDE_FROM_ABI void __invoke_if_not(std::true_type, _Fp) {}
 
 template <typename _F1, typename _F2>
-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 <typename _F1, typename _F2>
-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 <typename _Tp>
-  _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 <typename _FTp, typename _STp>
-  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 <typename _Arg>
-  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 <typename _Arg>
-  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 <typename _Arg>
-  bool operator()(_Arg&& __arg) const {
+  _LIBCPP_HIDE_FROM_ABI bool operator()(_Arg&& __arg) const {
     return !(std::forward<_Arg>(__arg) == _M_value);
   }
 };
 
 template <typename _ForwardIterator, typename _Compare>
-_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 {
index a09e1b3..30e6682 100644 (file)
@@ -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;
 };
index 1469d5b..74df7af 100644 (file)
@@ -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