// The following could be precomputed as they do not depend on the state.
// However, as they should take effect only if the UnwrappedLine does not fit
// into the ColumnLimit, they are checked here in the ContinuationIndenter.
- if (Previous.BlockKind == BK_Block && Previous.is(tok::l_brace) &&
- !Current.isOneOf(tok::r_brace, tok::comment))
+ if (Style.ColumnLimit != 0 && Previous.BlockKind == BK_Block &&
+ Previous.is(tok::l_brace) && !Current.isOneOf(tok::r_brace, tok::comment))
return true;
return false;
bool Newline =
Indenter->mustBreak(State) ||
(Indenter->canBreak(State) && State.NextToken->NewlinesBefore > 0);
+ llvm::errs() << State.NextToken->Tok.getName() << " "
+ << Indenter->mustBreak(State) << "\n";
Indenter->addTokenToState(State, Newline, /*DryRun=*/false);
}
}
"}",
Style));
+ // Allow functions on a single line.
+ verifyFormat("void f() { return; }", Style);
+
// Constructor initializers are formatted one per line with the "," on the
// new line.
verifyFormat("Constructor()\n"