It just seems wrong. This fixes llvm.org/PR19736.
llvm-svn: 209440
Style.BreakConstructorInitializersBeforeComma &&
!Style.ConstructorInitializerAllOnOneLineOrOnePerLine) {
return true;
- } else if (Right.is(tok::l_brace) && (Right.BlockKind == BK_Block)) {
+ } else if (Right.is(tok::l_brace) && Right.BlockKind == BK_Block &&
+ Right.Type != TT_ObjCBlockLBrace) {
return Style.BreakBeforeBraces == FormatStyle::BS_Allman ||
Style.BreakBeforeBraces == FormatStyle::BS_GNU;
} else if (Right.is(tok::string_literal) &&
"#endif",
BreakBeforeBrace);
+ // This shouldn't affect ObjC blocks.
+ verifyFormat("[self doSomeThingWithACompletionHandler:^{\n"
+ " // ...\n"
+ " int i;\n"
+ "}];");
+ verifyFormat("void (^block)(void) = ^{\n"
+ " // ...\n"
+ " int i;\n"
+ "};");
+
BreakBeforeBrace.ColumnLimit = 19;
verifyFormat("void f() { int i; }", BreakBeforeBrace);
BreakBeforeBrace.ColumnLimit = 18;