diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -368,6 +368,13 @@ Changes[i].Tok->Previous->is(TT_ConditionalExpr)) return true; + // Continued braced list. + if (ScopeStart > Start + 1 && + Changes[ScopeStart - 2].Tok->isNot(tok::identifier) && + Changes[ScopeStart - 1].Tok->is(tok::l_brace) && + Changes[i].Tok->isNot(tok::r_brace)) + return true; + return false; }; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -16427,6 +16427,11 @@ " double bar();\n" "};\n", Alignment); + // http://llvm.org/PR52914 + verifyFormat("char *a[] = {\"a\", // comment\n" + " \"bb\"};\n" + "int bbbbbbb = 0;", + Alignment); // PAS_Right EXPECT_EQ("void SomeFunction(int parameter = 0) {\n"