diff options
-rw-r--r-- | clang/lib/Format/Format.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 8eebda0740b..58e6648ca30 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1990,6 +1990,8 @@ private: Style.MaxEmptyLinesToKeep + 1); if (Newlines == 0 && !Tok.IsFirst) Newlines = 1; + if (Tok.Tok.is(tok::r_brace) && Newlines > 1) + Newlines = 1; unsigned Indent = Level * 2; bool IsAccessModifier = false; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 63110bbfbe0..ef242d7258a 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -136,6 +136,7 @@ TEST_F(FormatTest, FormatsUnwrappedLinesAtFirstFormat) { TEST_F(FormatTest, FormatsNestedBlockStatements) { EXPECT_EQ("{\n {\n {}\n }\n}", format("{{{}}}")); + EXPECT_EQ("{\n {\n {}\n }\n}", format("{{{}}\n\n}")); } TEST_F(FormatTest, FormatsNestedCall) { |