diff options
| -rw-r--r-- | clang/lib/Format/Format.cpp | 3 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 2821e4aa2c1..3df13669003 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -690,8 +690,7 @@ private: if (I[1]->Last->Type == TT_LineComment) return 0; do { - if (Tok->is(tok::l_brace) && Tok->BlockKind != BK_BracedInit && - !Style.AllowShortBlocksOnASingleLine) + if (Tok->is(tok::l_brace) && Tok->BlockKind != BK_BracedInit) return 0; Tok = Tok->Next; } while (Tok); diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 729eeaf4399..b3fb776a7a6 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -378,6 +378,11 @@ TEST_F(FormatTest, FormatShortBracedStatements) { "}", AllowSimpleBracedStatements); + verifyFormat("template <int> struct A2 {\n" + " struct B {};\n" + "};", + AllowSimpleBracedStatements); + AllowSimpleBracedStatements.AllowShortIfStatementsOnASingleLine = false; verifyFormat("if (true) {\n" " f();\n" |

