diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index d638221de636..6cfa0d88239a 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -528,7 +528,6 @@ private: if (Current.is(tok::question)) State.Stack.back().QuestionColumn = State.Column; if (Current.is(tok::l_brace) && Current.MatchingParen != NULL && - Current.Children[0].isNot(tok::l_brace) && !Current.MatchingParen->MustBreakBefore) { AnnotatedToken *End = Current.MatchingParen; while (!End->Children.empty() && !End->Children[0].CanBreakBefore) { diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index bffbbf53316b..ef97df951ab0 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -693,6 +693,12 @@ TEST_F(FormatTest, NestedStaticInitializers) { " 222222222222222222222222222222,\n" " 333333333333333333333333333333 },\n" " { 1, 2, 3 }, { 1, 2, 3 } } };"); + verifyFormat( + "SomeArrayOfSomeType a = { { { 1, 2, 3 } }, { { 1, 2, 3 } },\n" + " { { 111111111111111111111111111111,\n" + " 222222222222222222222222222222,\n" + " 333333333333333333333333333333 } },\n" + " { { 1, 2, 3 } }, { { 1, 2, 3 } } };"); // FIXME: We might at some point want to handle this similar to parameter // lists, where we have an option to put each on a single line.