The formatter can now format:
void
aaaaaaaaaaaaaaaaaa(int level,
double *min_x,
double *max_x,
double *min_y,
double *max_y,
double *min_z,
double *max_z, ) {
}
Although this is invalid code, it frequently happens during development and
clang-format should be nicer :-).
llvm-svn: 175151
return true;
if (State.NextToken->Parent->is(tok::comma) &&
State.Stack.back().BreakBeforeParameter &&
- !isTrailingComment(*State.NextToken))
+ !isTrailingComment(*State.NextToken) &&
+ State.NextToken->isNot(tok::r_paren))
return true;
// FIXME: Comparing LongestObjCSelectorName to 0 is a hacky way of finding
// out whether it is the first parameter. Clean this up.
// Error recovery tests.
//===----------------------------------------------------------------------===//
+TEST_F(FormatTest, IncompleteParameterLists) {
+ verifyGoogleFormat("void aaaaaaaaaaaaaaaaaa(int level,\n"
+ " double *min_x,\n"
+ " double *max_x,\n"
+ " double *min_y,\n"
+ " double *max_y,\n"
+ " double *min_z,\n"
+ " double *max_z, ) {\n"
+ "}");
+}
+
TEST_F(FormatTest, IncorrectCodeTrailingStuff) {
verifyFormat("void f() { return; }\n42");
verifyFormat("void f() {\n"