@@ -368,7 +368,7 @@ bool ContinuationIndenter::canBreak(const LineState &State) {
368
368
369
369
// If binary operators are moved to the next line (including commas for some
370
370
// styles of constructor initializers), that's always ok.
371
- if (! Current.isOneOf (TT_BinaryOperator, tok::comma) &&
371
+ if (Current.isNoneOf (TT_BinaryOperator, tok::comma) &&
372
372
// Allow breaking opening brace of lambdas (when passed as function
373
373
// arguments) to a new line when BeforeLambdaBody brace wrapping is
374
374
// enabled.
@@ -445,7 +445,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
445
445
(!Style.BreakBeforeTernaryOperators &&
446
446
Previous.is (TT_ConditionalExpr))) &&
447
447
CurrentState.BreakBeforeParameter && !Current.isTrailingComment () &&
448
- ! Current.isOneOf (tok::r_paren, tok::r_brace)) {
448
+ Current.isNoneOf (tok::r_paren, tok::r_brace)) {
449
449
return true ;
450
450
}
451
451
if (CurrentState.IsChainedConditional &&
@@ -523,9 +523,9 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
523
523
if (Style.AlwaysBreakBeforeMultilineStrings &&
524
524
(NewLineColumn == State.FirstIndent + Style.ContinuationIndentWidth ||
525
525
Previous.is (tok::comma) || Current.NestingLevel < 2 ) &&
526
- ! Previous.isOneOf (tok::kw_return, tok::lessless, tok::at,
526
+ Previous.isNoneOf (tok::kw_return, tok::lessless, tok::at,
527
527
Keywords.kw_dollar ) &&
528
- ! Previous.isOneOf (TT_InlineASMColon, TT_ConditionalExpr) &&
528
+ Previous.isNoneOf (TT_InlineASMColon, TT_ConditionalExpr) &&
529
529
nextIsMultilineString (State)) {
530
530
return true ;
531
531
}
@@ -648,7 +648,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
648
648
// into the ColumnLimit, they are checked here in the ContinuationIndenter.
649
649
if (Style.ColumnLimit != 0 && Previous.is (BK_Block) &&
650
650
Previous.is (tok::l_brace) &&
651
- ! Current.isOneOf (tok::r_brace, tok::comment)) {
651
+ Current.isNoneOf (tok::r_brace, tok::comment)) {
652
652
return true ;
653
653
}
654
654
@@ -752,7 +752,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
752
752
return false ;
753
753
754
754
const auto *Next = Comma->getNextNonComment ();
755
- return Next && ! Next->isOneOf (TT_LambdaLSquare, tok::l_brace, tok::caret);
755
+ return Next && Next->isNoneOf (TT_LambdaLSquare, tok::l_brace, tok::caret);
756
756
};
757
757
758
758
if (DisallowLineBreaks ())
@@ -835,15 +835,15 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
835
835
return Tok.is (tok::l_brace) && Tok.isNot (BK_Block) &&
836
836
Style.Cpp11BracedListStyle ;
837
837
};
838
- if (! Tok.isOneOf (tok::l_paren, TT_TemplateOpener, tok::l_square) &&
838
+ if (Tok.isNoneOf (tok::l_paren, TT_TemplateOpener, tok::l_square) &&
839
839
!IsStartOfBracedList ()) {
840
840
return false ;
841
841
}
842
842
if (!Tok.Previous )
843
843
return true ;
844
844
if (Tok.Previous ->isIf ())
845
845
return Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak;
846
- return ! Tok.Previous ->isOneOf (TT_CastRParen, tok::kw_for, tok::kw_while,
846
+ return Tok.Previous ->isNoneOf (TT_CastRParen, tok::kw_for, tok::kw_while,
847
847
tok::kw_switch) &&
848
848
!(Style.isJavaScript () && Tok.Previous ->is (Keywords.kw_await ));
849
849
};
@@ -882,8 +882,8 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
882
882
Tok.isOneOf (tok::ellipsis, Keywords.kw_await ))) {
883
883
return true ;
884
884
}
885
- const auto *Previous = Tok.Previous ;
886
- if ( !Previous || (! Previous->isOneOf (TT_FunctionDeclarationLParen,
885
+ if ( const auto *Previous = Tok.Previous ;
886
+ !Previous || (Previous->isNoneOf (TT_FunctionDeclarationLParen,
887
887
TT_LambdaDefinitionLParen) &&
888
888
!IsFunctionCallParen (*Previous))) {
889
889
return true ;
@@ -920,9 +920,9 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
920
920
// align the commas with the opening paren.
921
921
if (Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign &&
922
922
!CurrentState.IsCSharpGenericTypeConstraint && Previous.opensScope () &&
923
- Previous.isNot (TT_ObjCMethodExpr) && Previous. isNot ( TT_RequiresClause) &&
924
- Previous. isNot (TT_TableGenDAGArgOpener) &&
925
- Previous. isNot ( TT_TableGenDAGArgOpenerToBreak) &&
923
+ Previous.isNoneOf (TT_ObjCMethodExpr, TT_RequiresClause,
924
+ TT_TableGenDAGArgOpener,
925
+ TT_TableGenDAGArgOpenerToBreak) &&
926
926
!(Current.MacroParent && Previous.MacroParent ) &&
927
927
(Current.isNot (TT_LineComment) ||
928
928
Previous.isOneOf (BK_BracedInit, TT_VerilogMultiLineListLParen)) &&
@@ -962,7 +962,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
962
962
if (Current.isNot (tok::comment) && P &&
963
963
(P->isOneOf (TT_BinaryOperator, tok::comma) ||
964
964
(P->is (TT_ConditionalExpr) && P->is (tok::colon))) &&
965
- ! P->isOneOf (TT_OverloadedOperator, TT_CtorInitializerComma) &&
965
+ P->isNoneOf (TT_OverloadedOperator, TT_CtorInitializerComma) &&
966
966
P->getPrecedence () != prec::Assignment &&
967
967
P->getPrecedence () != prec::Relational &&
968
968
P->getPrecedence () != prec::Spaceship) {
@@ -992,7 +992,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
992
992
// parameter, i.e. let nested calls have a continuation indent.
993
993
CurrentState.LastSpace = State.Column ;
994
994
CurrentState.NestedBlockIndent = State.Column ;
995
- } else if (! Current.isOneOf (tok::comment, tok::caret) &&
995
+ } else if (Current.isNoneOf (tok::comment, tok::caret) &&
996
996
((Previous.is (tok::comma) &&
997
997
Previous.isNot (TT_OverloadedOperator)) ||
998
998
(Previous.is (tok::colon) && Previous.is (TT_ObjCMethodExpr)))) {
@@ -1099,7 +1099,7 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
1099
1099
if (Current.isNot (TT_LambdaArrow) &&
1100
1100
(!Style.isJavaScript () || Current.NestingLevel != 0 ||
1101
1101
!PreviousNonComment || PreviousNonComment->isNot (tok::equal) ||
1102
- ! Current.isOneOf (Keywords.kw_async , Keywords.kw_function ))) {
1102
+ Current.isNoneOf (Keywords.kw_async , Keywords.kw_function ))) {
1103
1103
CurrentState.NestedBlockIndent = State.Column ;
1104
1104
}
1105
1105
@@ -1239,11 +1239,11 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
1239
1239
}
1240
1240
1241
1241
if (PreviousNonComment &&
1242
- ! PreviousNonComment->isOneOf (tok::comma, tok::colon, tok::semi) &&
1242
+ PreviousNonComment->isNoneOf (tok::comma, tok::colon, tok::semi) &&
1243
1243
((PreviousNonComment->isNot (TT_TemplateCloser) &&
1244
1244
!PreviousNonComment->ClosesRequiresClause ) ||
1245
1245
Current.NestingLevel != 0 ) &&
1246
- ! PreviousNonComment->isOneOf (
1246
+ PreviousNonComment->isNoneOf (
1247
1247
TT_BinaryOperator, TT_FunctionAnnotationRParen, TT_JavaAnnotation,
1248
1248
TT_LeadingJavaAnnotation) &&
1249
1249
Current.isNot (TT_BinaryOperator) && !PreviousNonComment->opensScope () &&
@@ -1281,8 +1281,8 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
1281
1281
bool AllowAllConstructorInitializersOnNextLine =
1282
1282
Style.PackConstructorInitializers == FormatStyle::PCIS_NextLine ||
1283
1283
Style.PackConstructorInitializers == FormatStyle::PCIS_NextLineOnly;
1284
- if (! (Previous.isOneOf (tok::l_paren, tok::l_brace, TT_BinaryOperator) ||
1285
- PreviousIsBreakingCtorInitializerColon) ||
1284
+ if ((Previous.isNoneOf (tok::l_paren, tok::l_brace, TT_BinaryOperator) &&
1285
+ ! PreviousIsBreakingCtorInitializerColon) ||
1286
1286
(!Style.AllowAllParametersOfDeclarationOnNextLine &&
1287
1287
State.Line ->MustBeDeclaration ) ||
1288
1288
(!Style.AllowAllArgumentsOnNextLine &&
@@ -1576,7 +1576,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
1576
1576
if (Previous.is (tok::r_paren) &&
1577
1577
Previous.isNot (TT_TableGenDAGArgOperatorToBreak) &&
1578
1578
!Current.isBinaryOperator () &&
1579
- ! Current.isOneOf (tok::colon, tok::comment)) {
1579
+ Current.isNoneOf (tok::colon, tok::comment)) {
1580
1580
return ContinuationIndent;
1581
1581
}
1582
1582
if (Current.is (TT_ProtoExtensionLSquare))
@@ -1591,7 +1591,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
1591
1591
NextNonComment->SpacesRequiredBefore ;
1592
1592
}
1593
1593
if (CurrentState.Indent == State.FirstIndent && PreviousNonComment &&
1594
- ! PreviousNonComment->isOneOf (tok::r_brace, TT_CtorInitializerComma)) {
1594
+ PreviousNonComment->isNoneOf (tok::r_brace, TT_CtorInitializerComma)) {
1595
1595
// Ensure that we fall back to the continuation indent width instead of
1596
1596
// just flushing continuations left.
1597
1597
return CurrentState.Indent + Style.ContinuationIndentWidth ;
@@ -1734,7 +1734,7 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
1734
1734
}
1735
1735
if (Previous && (Previous->isOneOf (TT_BinaryOperator, TT_ConditionalExpr) ||
1736
1736
(Previous->isOneOf (tok::l_paren, tok::comma, tok::colon) &&
1737
- ! Previous->isOneOf (TT_DictLiteral, TT_ObjCMethodExpr,
1737
+ Previous->isNoneOf (TT_DictLiteral, TT_ObjCMethodExpr,
1738
1738
TT_CtorInitializerColon)))) {
1739
1739
CurrentState.NestedBlockInlined =
1740
1740
!Newline && hasNestedBlockInlined (Previous, Current, Style);
@@ -1758,7 +1758,7 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
1758
1758
State.StartOfStringLiteral = State.Column + 1 ;
1759
1759
} else if (Current.isStringLiteral () && State.StartOfStringLiteral == 0 ) {
1760
1760
State.StartOfStringLiteral = State.Column ;
1761
- } else if (! Current.isOneOf (tok::comment, tok::identifier, tok::hash) &&
1761
+ } else if (Current.isNoneOf (tok::comment, tok::identifier, tok::hash) &&
1762
1762
!Current.isStringLiteral ()) {
1763
1763
State.StartOfStringLiteral = 0 ;
1764
1764
}
@@ -2057,7 +2057,7 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State,
2057
2057
// array literals as these follow different indentation rules.
2058
2058
bool NoLineBreak =
2059
2059
Current.Children .empty () &&
2060
- ! Current.isOneOf (TT_DictLiteral, TT_ArrayInitializerLSquare) &&
2060
+ Current.isNoneOf (TT_DictLiteral, TT_ArrayInitializerLSquare) &&
2061
2061
(CurrentState.NoLineBreak || CurrentState.NoLineBreakInOperand ||
2062
2062
(Current.is (TT_TemplateOpener) &&
2063
2063
CurrentState.ContainsUnwrappedBuilder ));
0 commit comments