Seems to be the desired thing to do according to:
http://www.stroustrup.com/Programming/PPP-style-rev3.pdf
Patch by Jarkko Hietaniemi, thank you!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214857
91177308-0d34-0410-b5e6-
96231b3b80d8
/// Like \c Attach, but break before braces on function, namespace and
/// class definitions.
BS_Linux,
- /// Like \c Attach, but break before function definitions.
+ /// Like \c Attach, but break before function definitions, and 'else'.
BS_Stroustrup,
/// Always break before braces.
BS_Allman,
--Line->Level;
}
if (FormatTok->Tok.is(tok::kw_else)) {
+ if (Style.BreakBeforeBraces == FormatStyle::BS_Stroustrup)
+ addUnwrappedLine();
nextToken();
if (FormatTok->Tok.is(tok::l_brace)) {
CompoundStatementIndenter Indenter(this, Style, Line->Level);
"}",
BreakBeforeBrace);
+ verifyFormat("void foo()\n"
+ "{\n"
+ " if (a) {\n"
+ " a();\n"
+ " }\n"
+ " else {\n"
+ " b();\n"
+ " }\n"
+ "}\n",
+ BreakBeforeBrace);
+
verifyFormat("#ifdef _DEBUG\n"
"int foo(int i = 0)\n"
"#else\n"