clang-format debugging help: bin-packing of argument subexpressions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

clang-format debugging help: bin-packing of argument subexpressions

Nat! via cfe-dev
Hi,
Is there anyone familiar with the clang-format implementation who could point me in the right direction for fixing a limitation?

I have noticed that setting "BinPackArguments: false" also disables bin-packing of expressions within call arguments, after the first filled line. For instance:

     someFunctionCall(
           argumentOne,
           argumentTwo,
           1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14
                 + 15
                 + 16
                 + 17
                 + 18
                 + 19
                 + 20);

I could see enabling/disabling bin-packing for expressions being a valuable feature, perhaps as a separate BinPackExpressions (separate from -Parameters and -Arguments), but as it is today this just seems like a bug.

The implementation of ContinuationIndenter::addTokenOnCurrentLine, addTokenOnNewLine, canBreak, mustBreak, etc. are a bit hairy for a first-time reader, so I'm not really sure what's going wrong yet. It seems mustBreak is returning true from "Current.is(TT_BinaryOperator) && Current.CanBreakBefore && State.Stack.back().BreakBeforeParameter". Does anyone have insight into why this condition exists? BreakBeforeParameter doesn't seem relevant to this situation.

Thanks :-)
Jacob

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev