Before:
enum Fruit { //
APPLE,
PEAR };
After:
enum Fruit { //
APPLE,
PEAR
};
llvm-svn: 210522
// If we break after { or the [ of an array initializer, we should also break
// before the corresponding } or ].
- if (Previous.is(tok::l_brace) || Previous.Type == TT_ArrayInitializerLSquare)
+ if (PreviousNonComment &&
+ (PreviousNonComment->is(tok::l_brace) ||
+ PreviousNonComment->Type == TT_ArrayInitializerLSquare))
State.Stack.back().BreakBeforeClosingBrace = true;
if (State.Stack.back().AvoidBinPacking) {
"\n"
" THREE\n"
"}"));
+ verifyFormat("enum E { // comment\n"
+ " ONE,\n"
+ " TWO\n"
+ "};");
}
TEST_F(FormatTest, FormatsEnumsWithErrors) {
" BracedList{ // comment 1 (Forcing interesting break)\n"
" param1, param2,\n"
" // comment 2\n"
- " param3, param4 });",
+ " param3, param4\n"
+ " });",
ExtraSpaces);
verifyFormat(
"std::this_thread::sleep_for(\n"