Clang-format multiple conditions new line

Viewed 193

If I have a code something like this

void function()
{
 return XXXXXXXXX && FFFFFFFFFFFFFF && MMMMMMMMMMMMMM;
}

How can I convert it in something like this

void function()
{
 return XXXXXXXXX && 
     FFFFFFFFFFFFFF && 
     MMMMMMMMMMMMMM;
}
1 Answers

clang-format won't break a line like that unless you have reached the line limit, you can align the operands with:

AlignOperands: Align

you might want to check out

BreakBeforeBinaryOperators : All

You can find descriptions of these here:

https://clang.llvm.org/docs/ClangFormatStyleOptions.html

Related