Index: lib/Format/UnwrappedLineParser.cpp =================================================================== --- lib/Format/UnwrappedLineParser.cpp +++ lib/Format/UnwrappedLineParser.cpp @@ -1291,9 +1291,12 @@ if (FormatTok->Tok.is(tok::less)) parseObjCProtocolList(); - // If instance variables are present, keep the '{' on the first line too. - if (FormatTok->Tok.is(tok::l_brace)) + if (FormatTok->Tok.is(tok::l_brace)) { + if (Style.BreakBeforeBraces == FormatStyle::BS_Allman || + Style.BreakBeforeBraces == FormatStyle::BS_GNU) + addUnwrappedLine(); parseBlock(/*MustBeDeclaration=*/true); + } // With instance variables, this puts '}' on its own line. Without instance // variables, this ends the @interface line. Index: unittests/Format/FormatTest.cpp =================================================================== --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -7444,6 +7444,14 @@ "}\n", BreakBeforeBrace); + verifyFormat("@interface BSApplicationController ()\n" + "{\n" + "@private\n" + " id _extraIvar;\n" + "}\n" + "@end\n", + BreakBeforeBrace); + BreakBeforeBrace.ColumnLimit = 19; verifyFormat("void f() { int i; }", BreakBeforeBrace); BreakBeforeBrace.ColumnLimit = 18; @@ -7564,6 +7572,14 @@ " Y = 0,\n" "}\n", GNUBraceStyle); + + verifyFormat("@interface BSApplicationController ()\n" + "{\n" + "@private\n" + " id _extraIvar;\n" + "}\n" + "@end\n", + GNUBraceStyle); } TEST_F(FormatTest, CatchExceptionReferenceBinding) { verifyFormat("void f() {\n"