[Lldb-commits] [PATCH] D69286: I implemented the features listed in this document: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0616r0.pdf and built libc++ using ninja without any errors/w
Afadyfarag created this revision. Afadyfarag added reviewers: clayborg, aprantl, JDevlieghere. Herald added subscribers: libcxx-commits, ldionne, christof, mgorny. Herald added a reviewer: EricWF. Herald added a project: libc++. 1. Changes: libcxx/include/numeric Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D69286 Files: libcxx/CMakeLists.txt libcxx/include/numeric libcxx/include/set Index: libcxx/include/set === --- libcxx/include/set +++ libcxx/include/set @@ -472,13 +472,13 @@ #if _LIBCPP_STD_VER > 14 typedef __set_node_handle node_type; -typedef __insert_return_type insert_return_type; +typedef __insert_return_type insert_return_type #endif template friend class _LIBCPP_TEMPLATE_VIS set; template -friend class _LIBCPP_TEMPLATE_VIS multiset; +friend class _LIBCPP_TEMPLATE_VIS multiset _LIBCPP_INLINE_VISIBILITY set() @@ -486,7 +486,7 @@ is_nothrow_default_constructible::value && is_nothrow_default_constructible::value && is_nothrow_copy_constructible::value) -: __tree_(value_compare()) {} +: __tree_(value_compare()) { _LIBCPP_INLINE_VISIBILITY explicit set(const value_compare& __comp) Index: libcxx/include/numeric === --- libcxx/include/numeric +++ libcxx/include/numeric @@ -143,7 +143,9 @@ #include <__config> #include +#if _LIBCPP_STD_VER > 17 #include // for numeric_limits +#endif #include #include // for isnormal #include @@ -172,8 +174,13 @@ _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { -for (; __first != __last; ++__first) +for (; __first != __last; ++__first) { +#if _LIBCPP_STD_VER > 17 +__init = __binary_op(_VSTD::move(__init), *__first); +#else __init = __binary_op(__init, *__first); +#endif +} return __init; } @@ -222,8 +229,13 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { -for (; __first1 != __last1; ++__first1, (void) ++__first2) +for (; __first1 != __last1; ++__first1, (void) ++__first2) { +#if _LIBCPP_STD_VER > 17 +__init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, *__first2)); +#else __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); +#endif +} return __init; } @@ -292,8 +304,13 @@ *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { +#if _LIBCPP_STD_VER > 17 +__t = __binary_op(_VSTD::move(__t), *__first); +*__result = __t; +#else __t = __binary_op(__t, *__first); *__result = __t; +#endif } } return __result; @@ -442,7 +459,11 @@ for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __t2(*__first); +#if _LIBCPP_STD_VER > 17 +*__result = __binary_op(__t2, _VSTD::move(__t1)); +#else *__result = __binary_op(__t2, __t1); +#endif __t1 = _VSTD::move(__t2); } } Index: libcxx/CMakeLists.txt === --- libcxx/CMakeLists.txt +++ libcxx/CMakeLists.txt @@ -533,6 +533,16 @@ # Thus, we do nothing and hope we don't accidentally include any of the C++ # headers add_compile_flags_if_supported(-nostdinc++) +add_compile_flags_if_supported(-fcolor-diagnostics) + +option (FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." FALSE) +if (${FORCE_COLORED_OUTPUT}) +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + add_compile_options (-fdiagnostics-color=always) +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options (-fcolor-diagnostics) +endif () +endif () # Hide all inline function definitions which have not explicitly been marked # visible. This prevents new definitions for inline functions from appearing in ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D70772: I implemented the features listed in this document: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0616r0.pdf and built libc++ using ninja without any errors/w
Afadyfarag created this revision. Afadyfarag added reviewers: clayborg, aprantl, JDevlieghere, EricWF. Afadyfarag added a project: libc++. Herald added a reviewer: mclow.lists. 1. Changes: libcxx/include/numeric Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D70772 Files: libcxx/CMakeLists.txt libcxx/include/algorithm libcxx/include/forward_list libcxx/include/numeric Index: libcxx/include/numeric === --- libcxx/include/numeric +++ libcxx/include/numeric @@ -143,7 +143,9 @@ #include <__config> #include +#if _LIBCPP_STD_VER > 17 #include // for numeric_limits +#endif #include #include // for isnormal #include @@ -172,8 +174,13 @@ _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { -for (; __first != __last; ++__first) +for (; __first != __last; ++__first) { +#if _LIBCPP_STD_VER > 17 +__init = __binary_op(_VSTD::move(__init), *__first); +#else __init = __binary_op(__init, *__first); +#endif +} return __init; } @@ -222,8 +229,13 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { -for (; __first1 != __last1; ++__first1, (void) ++__first2) +for (; __first1 != __last1; ++__first1, (void) ++__first2) { +#if _LIBCPP_STD_VER > 17 +__init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, *__first2)); +#else __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); +#endif +} return __init; } @@ -292,8 +304,13 @@ *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { +#if _LIBCPP_STD_VER > 17 +__t = __binary_op(_VSTD::move(__t), *__first); +*__result = __t; +#else __t = __binary_op(__t, *__first); *__result = __t; +#endif } } return __result; @@ -442,7 +459,11 @@ for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __t2(*__first); +#if _LIBCPP_STD_VER > 17 +*__result = __binary_op(__t2, _VSTD::move(__t1)); +#else *__result = __binary_op(__t2, __t1); +#endif __t1 = _VSTD::move(__t2); } } Index: libcxx/include/forward_list === --- libcxx/include/forward_list +++ libcxx/include/forward_list @@ -1502,11 +1502,12 @@ #endif // _LIBCPP_CXX03_LANG template -void +decltype(auto) forward_list<_Tp, _Alloc>::remove(const value_type& __v) { forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing iterator __e = end(); +__VSTD::size_type __rm = 0; for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) { if (__i.__get_begin()->__next_->__value_ == __v) @@ -1515,6 +1516,7 @@ for (; __j != __e && *__j == __v; ++__j) ; __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); +++__rm; if (__j == __e) break; __i = __j; @@ -1522,15 +1524,21 @@ else ++__i; } +#if _LIBCPP_STD_VER > 17 +return __rm; +#else +(void) __rm; +#endif } template template -void +decltype(auto) forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred) { forward_list<_Tp, _Alloc> __deleted_nodes(get_allocator()); // collect the nodes we're removing iterator __e = end(); +__VSTD::size_type __rm = 0; for (iterator __i = before_begin(); __i.__get_begin()->__next_ != nullptr;) { if (__pred(__i.__get_begin()->__next_->__value_)) @@ -1539,6 +1547,7 @@ for (; __j != __e && __pred(*__j); ++__j) ; __deleted_nodes.splice_after(__deleted_nodes.before_begin(), *this, __i, __j); +++__rm; if (__j == __e) break; __i = __j; @@ -1546,6 +1555,11 @@ else ++__i; } +#if _LIBCPP_STD_VER > 17 +return __rm; +#else +(void) __rm; +#endif } template Index: libcxx/include/algorithm === --- libcxx/include/algorithm +++ libcxx/include/algorithm @@ -281,6 +281,10 @@ template OutputIterator rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result); + +template +constexpr ForwardIterator shift_left(ForwardIterator first, ForwardIterator last, +typename iterator_traits::difference_type n); template void @@ -3107,6 +3111,41 @@ } #endif +// shift_left +#if _LIBCPP_STD_VE