llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.34k stars 12.13k forks source link

Bin-packing for expression operands #63589

Open inicula opened 1 year ago

inicula commented 1 year ago

From what I can find in the clang-format documentation, there isn't an option (or a combination of options) to disable bin-packing for operands.

I was looking for an option that if true, the code gets formatted like this:

bool long_condition = aaaaaaaaaaaaaa && aaaaaaaaaaaaaa &&
                      aaaaaaaaaaaaaa;

But, if false, it gets formatted like this (because it's assumed that putting all three operands on the same line would go over the column limit):

bool long_condition = aaaaaaaaaaaaaa &&
                      aaaaaaaaaaaaaa &&
                      aaaaaaaaaaaaaa;

Does such an option (or combination of options) that achieves this formatting exist? If so, what is it?

If it doesn't exist, can this be added?

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-format