diff options
-rw-r--r-- | lib/Format/Format.cpp | 3 | ||||
-rw-r--r-- | unittests/Format/FormatTest.cpp | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 1bd864e5c9..f03b77853c 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -781,7 +781,8 @@ private: 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. diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index d5e3c24545..e99aad7a8c 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -1817,6 +1817,17 @@ TEST_F(FormatTest, HandlesIncludeDirectives) { // 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" |