[clang] [clang-format] Add BinPackBinaryOperations configuration (PR #95013)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 15 19:22:33 PDT 2024
owenca wrote:
This patch doesn't seem to work with the last two examples in #79487:
```
$ cat foo.cc
template<typename T>
concept my_concept =
std::is_object_v<T>
&& std::is_const_v<T>
&& std::default_initializable<T>;
std::uint32_t a =
byte_buffer[0]
| byte_buffer[1] << 8
| byte_buffer[2] << 16
| byte_buffer[3] << 24;
$ clang-format -style='{BinPackBinaryOperations: false, BreakBeforeBinaryOperators: NonAssignment, ColumnLimit: 50}' foo.cc
template <typename T>
concept my_concept =
std::is_object_v<T>
&& std::is_const_v<T> && std::default_initializable<T>;
std::uint32_t a =
byte_buffer[0]
| byte_buffer[1] << 8 | byte_buffer[2] << 16 | byte_buffer[3] << 24;
$
```
The logical `&&` and bitwise `|` operations are not broken up into one per line, and the column limit is exceeded.
https://github.com/llvm/llvm-project/pull/95013
More information about the cfe-commits
mailing list