if (NextNonComment->Type == TT_CtorInitializerComma)
return State.Stack.back().Indent;
if (Previous.is(tok::r_paren) && !Current.isBinaryOperator() &&
- Current.isNot(tok::colon))
+ !Current.isOneOf(tok::colon, tok::comment))
return ContinuationIndent;
if (State.Stack.back().Indent == State.FirstIndent && PreviousNonComment &&
PreviousNonComment->isNot(tok::r_brace))
if (Precedence > prec::Unknown)
Start->StartsBinaryExpression = true;
if (Current) {
- ++Current->Previous->FakeRParens;
+ FormatToken *Previous = Current->Previous;
+ if (Previous->is(tok::comment) && Previous->Previous)
+ Previous = Previous->Previous;
+ ++Previous->FakeRParens;
if (Precedence > prec::Unknown)
- Current->Previous->EndsBinaryExpression = true;
+ Previous->EndsBinaryExpression = true;
}
}
" > ccccc) {\n"
"}",
Style);
+ verifyFormat("return (a)\n"
+ " // comment\n"
+ " + b;",
+ Style);
// Forced by comments.
verifyFormat(
" aaaaaaaaa\n"
" ? b\n"
" : c);");
+ verifyFormat("return aaaa == bbbb\n"
+ " // comment\n"
+ " ? aaaa\n"
+ " : bbbb;");
verifyFormat(
"unsigned Indent =\n"
" format(TheLine.First, IndentForLevel[TheLine.Level] >= 0\n"