[PATCH] D80041: [clang-format] [PR45198] deletes whitespace inside of a noexcept specifier

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 15 15:14:39 PDT 2020


MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: krasimir, rianquinn, JakeMerdichAMD, mitchell-stellar.
MyDeveloperDay added projects: clang, clang-format.

https://bugs.llvm.org/show_bug.cgi?id=45198

The following:

  template<
      typename T,
      enable_if_t<is_move_assignable<T>::value> = true,
      enable_if_t<is_move_constructible<T>::value> = true>
  constexpr void
  swap(T &lhs, T &rhs) noexcept(
      is_nothrow_move_constructible<T>::value && is_nothrow_move_assignable<T>::value)

Results in this:

  template<
      typename T,
      enable_if_t<is_move_assignable<T>::value> = true,
      enable_if_t<is_move_constructible<T>::value> = true>
  constexpr void
  swap(T &lhs, T &rhs) noexcept(
      is_nothrow_move_constructible<T>::value &&is_nothrow_move_assignable<T>::value)

This is because the `&&` in `is_nothrow_move_constructible<T>::value &&is_nothrow_move_assignable<T>::value` gets incorrectly determined to be a TT_PointerOrReference

This revision attempts to detect determine a cases where this cannot be true especially in a `noexcept` context where the result is expected to be boolean


https://reviews.llvm.org/D80041

Files:
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80041.264368.patch
Type: text/x-patch
Size: 6764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200515/026a44e0/attachment.bin>


More information about the cfe-commits mailing list