Skip to content

Commit c22c0c4

Browse files
committed
[clang-format][NFC] Change conjunction of isNot() with one !isOneOf()
1 parent 5ccda55 commit c22c0c4

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,26 +1193,22 @@ static bool tokenCanStartNewLine(const FormatToken &Tok) {
11931193
// Semicolon can be a null-statement, l_square can be a start of a macro or
11941194
// a C++11 attribute, but this doesn't seem to be common.
11951195
assert(Tok.isNot(TT_AttributeSquare));
1196-
return Tok.isNot(tok::semi) && Tok.isNot(tok::l_brace) &&
1197-
// Tokens that can only be used as binary operators and a part of
1198-
// overloaded operator names.
1199-
Tok.isNot(tok::period) && Tok.isNot(tok::periodstar) &&
1200-
Tok.isNot(tok::arrow) && Tok.isNot(tok::arrowstar) &&
1201-
Tok.isNot(tok::less) && Tok.isNot(tok::greater) &&
1202-
Tok.isNot(tok::slash) && Tok.isNot(tok::percent) &&
1203-
Tok.isNot(tok::lessless) && Tok.isNot(tok::greatergreater) &&
1204-
Tok.isNot(tok::equal) && Tok.isNot(tok::plusequal) &&
1205-
Tok.isNot(tok::minusequal) && Tok.isNot(tok::starequal) &&
1206-
Tok.isNot(tok::slashequal) && Tok.isNot(tok::percentequal) &&
1207-
Tok.isNot(tok::ampequal) && Tok.isNot(tok::pipeequal) &&
1208-
Tok.isNot(tok::caretequal) && Tok.isNot(tok::greatergreaterequal) &&
1209-
Tok.isNot(tok::lesslessequal) &&
1210-
// Colon is used in labels, base class lists, initializer lists,
1211-
// range-based for loops, ternary operator, but should never be the
1212-
// first token in an unwrapped line.
1213-
Tok.isNot(tok::colon) &&
1214-
// 'noexcept' is a trailing annotation.
1215-
Tok.isNot(tok::kw_noexcept);
1196+
return !Tok.isOneOf(tok::semi, tok::l_brace,
1197+
// Tokens that can only be used as binary operators and a
1198+
// part of overloaded operator names.
1199+
tok::period, tok::periodstar, tok::arrow, tok::arrowstar,
1200+
tok::less, tok::greater, tok::slash, tok::percent,
1201+
tok::lessless, tok::greatergreater, tok::equal,
1202+
tok::plusequal, tok::minusequal, tok::starequal,
1203+
tok::slashequal, tok::percentequal, tok::ampequal,
1204+
tok::pipeequal, tok::caretequal, tok::greatergreaterequal,
1205+
tok::lesslessequal,
1206+
// Colon is used in labels, base class lists, initializer
1207+
// lists, range-based for loops, ternary operator, but
1208+
// should never be the first token in an unwrapped line.
1209+
tok::colon,
1210+
// 'noexcept' is a trailing annotation.
1211+
tok::kw_noexcept);
12161212
}
12171213

12181214
static bool mustBeJSIdent(const AdditionalKeywords &Keywords,

0 commit comments

Comments
 (0)