Before:
enum Fruit { //
APPLE,
PEAR };
After:
enum Fruit { //
APPLE,
PEAR
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210522
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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"