This is an attempt to fix the issue described in my recent email: http://lists.llvm.org/pipermail/cfe-dev/2017-April/053632.html
After digging in for a while, I learned that:
- the spurious line breaks were occurring inside the condition Current.is(TT_BinaryOperator) && Current.CanBreakBefore && State.Stack.back().BreakBeforeParameter.
- BreakBeforeParameter was being set to true because AvoidBinPacking was true.
- AvoidBinPacking was true because it propagated all the way along the stack starting from the ( "scope opener".
Given the above, it seemed to make sense to reset AvoidBinPacking to false when propagating it into a subexpression.
👋 hello @djasper — you seem to be the most prolific clang-formatter — please feel free to tear this apart 😅
I think you cannot get here if .size() is 0 as this is iterating over the elements.