ItemEnd = Token->MatchingParen;
const FormatToken *NonCommentEnd = ItemEnd->getPreviousNonComment();
ItemLengths.push_back(CodePointsBetween(ItemBegin, NonCommentEnd));
- if (Style.Cpp11BracedListStyle) {
+ if (Style.Cpp11BracedListStyle &&
+ !ItemEnd->Previous->isTrailingComment()) {
// In Cpp11 braced list style, the } and possibly other subsequent
// tokens will need to stay on a line with the last element.
while (ItemEnd->Next && !ItemEnd->Next->CanBreakBefore)
" 1111111111, 2222222222, 33333333333, 4444444444, //\n"
" 111111111, 222222222, 3333333333, 444444444, //\n"
" 11111111, 22222222, 333333333, 44444444};");
+ // Trailing comment in the last line.
+ verifyFormat("int aaaaa[] = {\n"
+ " 1, 2, 3, // comment\n"
+ " 4, 5, 6 // comment\n"
+ "};");
// With nested lists, we should either format one item per line or all nested
// lists one on line.