Skip to content

Commit

Permalink
[clang-format][NFC] Change conjunction of isNot() with one !isOneOf()
Browse files Browse the repository at this point in the history
  • Loading branch information
owenca committed Sep 7, 2023
1 parent 5ccda55 commit c22c0c4
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions clang/lib/Format/UnwrappedLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1193,26 +1193,22 @@ static bool tokenCanStartNewLine(const FormatToken &Tok) {
// Semicolon can be a null-statement, l_square can be a start of a macro or
// a C++11 attribute, but this doesn't seem to be common.
assert(Tok.isNot(TT_AttributeSquare));
return Tok.isNot(tok::semi) && Tok.isNot(tok::l_brace) &&
// Tokens that can only be used as binary operators and a part of
// overloaded operator names.
Tok.isNot(tok::period) && Tok.isNot(tok::periodstar) &&
Tok.isNot(tok::arrow) && Tok.isNot(tok::arrowstar) &&
Tok.isNot(tok::less) && Tok.isNot(tok::greater) &&
Tok.isNot(tok::slash) && Tok.isNot(tok::percent) &&
Tok.isNot(tok::lessless) && Tok.isNot(tok::greatergreater) &&
Tok.isNot(tok::equal) && Tok.isNot(tok::plusequal) &&
Tok.isNot(tok::minusequal) && Tok.isNot(tok::starequal) &&
Tok.isNot(tok::slashequal) && Tok.isNot(tok::percentequal) &&
Tok.isNot(tok::ampequal) && Tok.isNot(tok::pipeequal) &&
Tok.isNot(tok::caretequal) && Tok.isNot(tok::greatergreaterequal) &&
Tok.isNot(tok::lesslessequal) &&
// Colon is used in labels, base class lists, initializer lists,
// range-based for loops, ternary operator, but should never be the
// first token in an unwrapped line.
Tok.isNot(tok::colon) &&
// 'noexcept' is a trailing annotation.
Tok.isNot(tok::kw_noexcept);
return !Tok.isOneOf(tok::semi, tok::l_brace,
// Tokens that can only be used as binary operators and a
// part of overloaded operator names.
tok::period, tok::periodstar, tok::arrow, tok::arrowstar,
tok::less, tok::greater, tok::slash, tok::percent,
tok::lessless, tok::greatergreater, tok::equal,
tok::plusequal, tok::minusequal, tok::starequal,
tok::slashequal, tok::percentequal, tok::ampequal,
tok::pipeequal, tok::caretequal, tok::greatergreaterequal,
tok::lesslessequal,
// Colon is used in labels, base class lists, initializer
// lists, range-based for loops, ternary operator, but
// should never be the first token in an unwrapped line.
tok::colon,
// 'noexcept' is a trailing annotation.
tok::kw_noexcept);
}

static bool mustBeJSIdent(const AdditionalKeywords &Keywords,
Expand Down

0 comments on commit c22c0c4

Please sign in to comment.