Before:
int f() { // comment return 42; }
After:
int f() { // comment
return 42;
}
This fixes llvm.org/PR21769.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223609
91177308-0d34-0410-b5e6-
96231b3b80d8
}
if (I[1]->First->is(TT_FunctionLBrace) &&
Style.BreakBeforeBraces != FormatStyle::BS_Attach) {
+ if (I[1]->Last->is(TT_LineComment))
+ return 0;
+
// Check for Limit <= 2 to account for the " {".
if (Limit <= 2 || (Style.ColumnLimit == 0 && containsMustBreak(TheLine)))
return 0;
" [object someMethod:@{ @\"a\" : @\"b\" }];\n"
"}",
AllmanBraceStyle);
+ verifyFormat("int f()\n"
+ "{ // comment\n"
+ " return 42;\n"
+ "}",
+ AllmanBraceStyle);
AllmanBraceStyle.ColumnLimit = 19;
verifyFormat("void f() { int i; }", AllmanBraceStyle);