[clang] c22c0c4 - [clang-format][NFC] Change conjunction of isNot() with one !isOneOf()
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 7 00:22:53 PDT 2023
Author: Owen Pan
Date: 2023-09-07T00:20:02-07:00
New Revision: c22c0c4769da8084378675fe58fd033dfa73ad1e
URL: https://github.com/llvm/llvm-project/commit/c22c0c4769da8084378675fe58fd033dfa73ad1e
DIFF: https://github.com/llvm/llvm-project/commit/c22c0c4769da8084378675fe58fd033dfa73ad1e.diff
LOG: [clang-format][NFC] Change conjunction of isNot() with one !isOneOf()
Added:
Modified:
clang/lib/Format/UnwrappedLineParser.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 5a82b200055a874..da55948a367b78f 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -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,
More information about the cfe-commits
mailing list