Before:
bool x = aaaaa //
||
bbbbb
//
|| cccc;
After:
bool x = aaaaa //
|| bbbbb
//
|| cccc;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293839
91177308-0d34-0410-b5e6-
96231b3b80d8
P->getPrecedence() != prec::Assignment &&
P->getPrecedence() != prec::Relational) {
bool BreakBeforeOperator =
- P->is(tok::lessless) ||
+ P->MustBreakBefore || P->is(tok::lessless) ||
(P->is(TT_BinaryOperator) &&
Style.BreakBeforeBinaryOperators != FormatStyle::BOS_None) ||
(P->is(TT_ConditionalExpr) && Style.BreakBeforeTernaryOperators);
Style);
}
+TEST_F(FormatTest, EnforcedOperatorWraps) {
+ // Here we'd like to wrap after the || operators, but a comment is forcing an
+ // earlier wrap.
+ verifyFormat("bool x = aaaaa //\n"
+ " || bbbbb\n"
+ " //\n"
+ " || cccc;");
+}
+
TEST_F(FormatTest, NoOperandAlignment) {
FormatStyle Style = getLLVMStyle();
Style.AlignOperands = false;