diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 22166aa27ab1b45409d92d62117601b1bee09d8b..069d2dae7120abddd024f84dcdd1b36cea3e58f8 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -492,7 +492,7 @@ private: if (Previous.is(tok::l_paren) || Previous.is(tok::l_brace) || State.NextToken->Parent->Type == TT_TemplateOpener) State.Stack[ParenLevel].Indent = State.Column + Spaces; - if (Previous.is(tok::comma)) + if (Previous.is(tok::comma) && Current.Type != TT_LineComment) State.Stack[ParenLevel].HasMultiParameterLine = true; diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 3c92d82f8fb528f17c8478ec56700d98df902eeb..df050a4e2980c1c84666e47e1635818785d67384 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -746,6 +746,11 @@ TEST_F(FormatTest, ConstructorInitializers) { " : aaaaaaaaaaaaa(aaaaaaaaaaaaaa),\n" " aaaaaaaaaaaaa(aaaaaaaaaaaaaa),\n" " aaaaaaaaaaaaa(aaaaaaaaaaaaaa) {}"); + verifyGoogleFormat( + "SomeClass::Constructor()\n" + " : aaaaaaaaaaaaa(aaaaaaaaaaaaaa), // Some comment\n" + " aaaaaaaaaaaaa(aaaaaaaaaaaaaa),\n" + " aaaaaaaaaaaaa(aaaaaaaaaaaaaa) {}"); verifyFormat( "SomeClass::Constructor()\n"