[libcxx-commits] [PATCH] D131852: [libc++][NFC] Use noexcept instead of the macros where possible

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 15 09:24:22 PDT 2022


Mordante added a comment.

I'm not really convinced this patch is really worth the effort, but no real objections.



================
Comment at: libcxx/include/__algorithm/iter_swap.h:25
                                                                               _ForwardIterator2 __b)
-    //                                  _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
-    _NOEXCEPT_(_NOEXCEPT_(swap(*declval<_ForwardIterator1>(), *declval<_ForwardIterator2>()))) {
+    _NOEXCEPT_(noexcept(swap(*declval<_ForwardIterator1>(), *declval<_ForwardIterator2>()))) {
   swap(*__a, *__b);
----------------
This is correct, but I find it confusion. In this case I would really prefer to use the macro twice.

I see we already use this in some places, but to me this change isn't an improvement.


================
Comment at: libcxx/include/__memory/shared_ptr.h:1764
     _LIBCPP_INLINE_VISIBILITY
     weak_ptr<_Tp> weak_from_this() _NOEXCEPT
        { return __weak_this_; }
----------------
How did you detect these places to adjust? It seems there are more places.


================
Comment at: libcxx/include/string:1745
 #else
         _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
 #endif
----------------
This one can be changed too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131852/new/

https://reviews.llvm.org/D131852



More information about the libcxx-commits mailing list