Lines Matching refs:is
55 if (Left->Previous && Left->Previous->is(tok::greater) && in isLambdaParameterList()
57 Left->Previous->MatchingParen->is(TT_TemplateOpener)) { in isLambdaParameterList()
62 return Left->Previous && Left->Previous->is(tok::r_square) && in isLambdaParameterList()
64 Left->Previous->MatchingParen->is(TT_LambdaLSquare); in isLambdaParameterList()
100 if (Previous.Previous->is(tok::r_paren) && Contexts.size() > 1 && in parseAngle()
102 !Previous.Previous->MatchingParen->is( in parseAngle()
123 CurrentToken->is(tok::question)) { in parseAngle()
128 if (CurrentToken->is(tok::greater)) { in parseAngle()
135 if (CurrentToken->Next && CurrentToken->Next->is(tok::greater) && in parseAngle()
160 if (CurrentToken->is(tok::question) && in parseAngle()
178 CurrentToken->Previous->is(TT_BinaryOperator) && in parseAngle()
186 if (CurrentToken->is(tok::colon) || in parseAngle()
225 assert(OpeningParen.is(tok::l_paren)); in parseParens()
235 OpeningParen.Previous->is(TT_UntouchableMacroFunc)) { in parseParens()
244 MaybeSel->Previous->is(tok::at)) { in parseParens()
249 if (OpeningParen.is(TT_OverloadedOperatorLParen)) { in parseParens()
252 while (!Prev->is(tok::kw_operator)) { in parseParens()
278 (OpeningParen.Previous->is(Keywords.kw_function) || in parseParens()
284 OpeningParen.Previous->is(TT_JsTypeColon)) { in parseParens()
292 !OpeningParen.Previous->is(tok::identifier))) { in parseParens()
298 OpeningParen.Previous->is(TT_ForEachMacro)) { in parseParens()
303 OpeningParen.Previous->MatchingParen->is(TT_ObjCBlockLParen)) { in parseParens()
314 if (PrevNonComment && OpeningParen.is(TT_Unknown)) { in parseParens()
315 if (PrevNonComment->is(tok::kw___attribute)) { in parseParens()
346 OpeningParen.Previous && OpeningParen.Previous->is(tok::kw_for); in parseParens()
358 if (PrevPrev && PrevPrev->is(tok::identifier) && in parseParens()
360 CurrentToken->is(tok::identifier) && Next->isNot(tok::equal)) { in parseParens()
367 if (CurrentToken->Previous->is(TT_PointerOrReference) && in parseParens()
372 if (CurrentToken->is(tok::comma)) in parseParens()
374 if (CurrentToken->Previous->is(TT_BinaryOperator)) in parseParens()
376 if (CurrentToken->is(tok::r_paren)) { in parseParens()
379 (CurrentToken->Next->is(tok::l_paren) || in parseParens()
380 (CurrentToken->Next->is(tok::l_square) && in parseParens()
382 OpeningParen.setType(OpeningParen.Next->is(tok::caret) in parseParens()
389 if (CurrentToken->Next && CurrentToken->Next->is(tok::l_brace) && in parseParens()
390 OpeningParen.Previous && OpeningParen.Previous->is(tok::l_paren)) { in parseParens()
396 if (Tok->is(TT_BinaryOperator) && in parseParens()
411 if (OpeningParen.is(TT_AttributeParen)) in parseParens()
413 if (OpeningParen.is(TT_TypeDeclarationParen)) in parseParens()
416 OpeningParen.Previous->is(TT_JavaAnnotation)) { in parseParens()
420 OpeningParen.Previous->is(TT_LeadingJavaAnnotation)) { in parseParens()
424 OpeningParen.Previous->is(TT_AttributeSquare)) { in parseParens()
441 if (CurrentToken->is(tok::l_brace) && OpeningParen.is(TT_ObjCBlockLParen)) in parseParens()
443 if (CurrentToken->is(tok::comma) && CurrentToken->Next && in parseParens()
449 (CurrentToken->is(tok::l_paren) && CurrentToken->Next && in parseParens()
453 !(CurrentToken->is(tok::l_brace) || in parseParens()
454 (CurrentToken->is(tok::l_paren) && !ProbablyFunctionTypeLParen))) { in parseParens()
464 if (MightBeObjCForRangeLoop && CurrentToken->is(Keywords.kw_in)) { in parseParens()
470 if (CurrentToken->is(tok::comma)) in parseParens()
488 if (Tok.Previous && Tok.Previous->is(tok::identifier)) in isCSharpAttributeSpecifier()
492 if (Tok.Previous && Tok.Previous->is(tok::r_square)) { in isCSharpAttributeSpecifier()
494 if (!MatchingParen || MatchingParen->is(TT_ArraySubscriptLSquare)) in isCSharpAttributeSpecifier()
503 if (AttrTok->is(tok::r_square)) in isCSharpAttributeSpecifier()
538 if (Tok.Previous && Tok.Previous->is(tok::at)) in isCpp11AttributeSpecifier()
553 if (AttrTok->is(tok::colon) || in isCpp11AttributeSpecifier()
558 if (AttrTok->is(tok::ellipsis)) in isCpp11AttributeSpecifier()
581 Style.isCpp() && Parent && Parent->is(TT_TemplateCloser) && in parseSquare()
614 } else if (Left->is(TT_Unknown)) { in parseSquare()
630 } else if (CurrentToken->is(tok::r_square) && Parent && in parseSquare()
631 Parent->is(TT_TemplateCloser)) { in parseSquare()
685 if (Style.isJavaScript() && Parent && Parent->is(TT_JsTypeColon)) in parseSquare()
693 if (CurrentToken->is(tok::r_square)) { in parseSquare()
699 CurrentToken->Next->is(tok::l_paren)) || in parseSquare()
702 Left->is(TT_ObjCMethodExpr)) { in parseSquare()
715 CurrentToken->Previous->is(TT_Unknown) && in parseSquare()
722 if (Parent && Parent->is(TT_PointerOrReference)) in parseSquare()
727 CurrentToken->Next && CurrentToken->Next->is(TT_LambdaArrow)) { in parseSquare()
738 if (Previous && Previous->is(TT_SelectorName)) { in parseSquare()
757 if (CurrentToken->is(tok::colon)) { in parseSquare()
769 if (Parent && Parent->is(tok::r_paren)) { in parseSquare()
776 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
808 assert(OpeningBrace.is(tok::l_brace)); in parseBrace()
817 if (OpeningBrace.is(BK_BracedInit)) in parseBrace()
820 OpeningBrace.Previous->is(TT_JsTypeColon)) { in parseBrace()
826 if (CurrentToken->is(tok::r_brace)) { in parseBrace()
844 if (Previous->is(TT_JsTypeOptionalQuestion)) in parseBrace()
846 if ((CurrentToken->is(tok::colon) && in parseBrace()
852 Previous->is(tok::string_literal)) { in parseBrace()
856 if (CurrentToken->is(tok::colon) && OpeningBrace.is(TT_Unknown)) in parseBrace()
861 if (CurrentToken->is(tok::comma)) { in parseBrace()
876 if (Current->is(tok::l_brace) && Current->is(BK_Block)) in updateParameterCount()
878 if (Current->is(tok::comma)) { in updateParameterCount()
890 if (CurrentToken->is(tok::colon)) { in parseConditional()
902 if (CurrentToken && CurrentToken->is(tok::less)) { in parseTemplateDeclaration()
971 Tok->Previous->is(tok::identifier) && Tok->Previous->is(TT_Unknown); in consumeToken()
974 !(BeforePrevious->is(TT_CastRParen) || in consumeToken()
975 (BeforePrevious->is(TT_ObjCMethodExpr) && in consumeToken()
976 BeforePrevious->is(tok::colon))) || in consumeToken()
977 BeforePrevious->is(tok::r_square) || in consumeToken()
994 } else if (CurrentToken && CurrentToken->is(tok::numeric_constant)) { in consumeToken()
1005 } else if (Prev->is(tok::kw_try)) { in consumeToken()
1018 Tok->Next->Next->is(tok::colon)))) { in consumeToken()
1040 if (CurrentToken && CurrentToken->is(tok::l_paren)) { in consumeToken()
1049 if ((Tok->Previous && Tok->Previous->is(tok::period)) || in consumeToken()
1050 (Tok->Next && Tok->Next->is(tok::colon))) { in consumeToken()
1054 if (CurrentToken && CurrentToken->is(Keywords.kw_await)) in consumeToken()
1057 if (Style.isCpp() && CurrentToken && CurrentToken->is(tok::kw_co_await)) in consumeToken()
1071 if (Tok->Previous && Tok->Previous->is(tok::r_paren) && in consumeToken()
1073 Tok->Previous->MatchingParen->is(TT_OverloadedOperatorLParen)) { in consumeToken()
1137 if (Tok->Previous && Tok->Previous->is(TT_TemplateCloser)) in consumeToken()
1150 if (CurrentToken && CurrentToken->is(tok::comma) && in consumeToken()
1160 if (CurrentToken && CurrentToken->is(tok::l_paren)) in consumeToken()
1162 if (CurrentToken && CurrentToken->Previous->is(TT_BinaryOperator)) in consumeToken()
1188 (Tok->Next && Tok->Next->is(tok::identifier) && Tok->Next->Next && in consumeToken()
1189 Tok->Next->Next->is(tok::equal))) { in consumeToken()
1223 if (Style.isCSharp() && Tok->is(Keywords.kw_where) && Tok->Next && in consumeToken()
1231 Tok->Previous->is(tok::kw_noexcept)) { in consumeToken()
1244 if (CurrentToken->is(tok::less)) { in parseCSharpGenericTypeConstraint()
1249 } else if (CurrentToken->is(tok::greater)) { in parseCSharpGenericTypeConstraint()
1253 } else if (CurrentToken->is(tok::comma) && OpenAngleBracketsCount == 0) { in parseCSharpGenericTypeConstraint()
1258 } else if (CurrentToken->is(Keywords.kw_where)) { in parseCSharpGenericTypeConstraint()
1261 } else if (CurrentToken->is(tok::colon)) { in parseCSharpGenericTypeConstraint()
1271 if (CurrentToken && CurrentToken->is(tok::less)) { in parseIncludeDirective()
1301 bool IsMark = CurrentToken->is(Keywords.kw_mark); in parsePragma()
1305 if (IsMark || CurrentToken->Previous->is(TT_BinaryOperator)) in parsePragma()
1313 if (!CurrentToken || !CurrentToken->is(tok::l_paren)) in parseHasInclude()
1339 if (CurrentToken->is(tok::numeric_constant)) { in parsePreprocessorDirective()
1378 if (Tok->is(tok::l_paren)) { in parsePreprocessorDirective()
1393 if (CurrentToken->is(tok::hash)) { in parseLine()
1407 CurrentToken->is(Keywords.kw_package)) || in parseLine()
1419 if (CurrentToken->is(tok::less) && Line.Last->is(tok::greater)) { in parseLine()
1429 if (CurrentToken && CurrentToken->is(tok::identifier)) { in parseLine()
1440 if (Style.isJavaScript() && CurrentToken->is(Keywords.kw_import)) in parseLine()
1444 if (CurrentToken->is(tok::kw_virtual)) in parseLine()
1453 if (Line.First->is(tok::kw_export) && in parseLine()
1454 CurrentToken->is(Keywords.kw_from) && CurrentToken->Next && in parseLine()
1488 return Tok.TokenText == "goog" && Tok.Next && Tok.Next->is(tok::period) && in isClosureImportStatement()
1495 Tok.Next->Next->Next && Tok.Next->Next->Next->is(tok::l_paren); in isClosureImportStatement()
1609 if (Line.First->is(tok::kw_template)) { in modifyContext()
1611 if (Current.Previous->is(tok::kw_operator)) { in modifyContext()
1672 } else if (Current.is(tok::lessless) && in modifyContext()
1673 (!Current.Previous || !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1677 } else if (Current.is(TT_TrailingReturnArrow)) { in modifyContext()
1679 } else if (Current.is(TT_LambdaArrow) || Current.is(Keywords.kw_assert)) { in modifyContext()
1682 Current.Previous->is(TT_CtorInitializerColon)) { in modifyContext()
1685 } else if (Current.Previous && Current.Previous->is(TT_InheritanceColon)) { in modifyContext()
1697 } else if (Current.is(tok::kw_new)) { in modifyContext()
1699 } else if (Current.is(tok::semi) || in modifyContext()
1700 (Current.is(tok::exclaim) && Current.Previous && in modifyContext()
1701 !Current.Previous->is(tok::kw_operator))) { in modifyContext()
1713 if (Current->is(tok::l_paren)) in untilMatchingParen()
1715 if (Current->is(tok::r_paren)) in untilMatchingParen()
1726 if (Current.Previous && Current.Previous->is(tok::r_paren) && in isDeductionGuide()
1733 if (TemplateCloser->is(tok::l_paren)) { in isDeductionGuide()
1739 if (TemplateCloser->is(tok::less)) in isDeductionGuide()
1741 if (TemplateCloser->is(tok::greater)) in isDeductionGuide()
1750 TemplateCloser->Next->is(tok::semi) && in isDeductionGuide()
1763 PriorLeadingIdentifier->is(tok::kw_explicit)) { in isDeductionGuide()
1768 (PriorLeadingIdentifier->is(TT_TemplateCloser) || in isDeductionGuide()
1778 if (!Current.is(TT_Unknown)) { in determineTokenType()
1784 Current.is(tok::exclaim)) { in determineTokenType()
1790 : Current.Previous->is(tok::identifier); in determineTokenType()
1811 if (Current.is(Keywords.kw_instanceof)) { in determineTokenType()
1817 } else if (Current.is(tok::semi)) { in determineTokenType()
1824 } else if (Current.is(tok::arrow) && in determineTokenType()
1827 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
1832 } else if (Current.is(tok::arrow) && Current.Previous && in determineTokenType()
1833 Current.Previous->is(tok::r_brace)) { in determineTokenType()
1847 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
1853 } else if (Current.is(tok::question)) { in determineTokenType()
1864 (!Current.is(tok::greater) && in determineTokenType()
1867 } else if (Current.is(tok::comment)) { in determineTokenType()
1879 } else if (Current.is(tok::l_paren)) { in determineTokenType()
1882 } else if (Current.is(tok::r_paren)) { in determineTokenType()
1894 if (BeforeParen->is(tok::identifier) && in determineTokenType()
1895 !BeforeParen->is(TT_TypenameMacro) && in determineTokenType()
1905 } else if (Current.is(tok::at) && Current.Next && !Style.isJavaScript() && in determineTokenType()
1921 } else if (Current.is(tok::period)) { in determineTokenType()
1934 Current.Previous && Current.Previous->is(TT_CastRParen) && in determineTokenType()
1937 Current.Previous->MatchingParen->Previous->is( in determineTokenType()
1954 if (Current.Previous->is(tok::at) && in determineTokenType()
1958 if (!Previous || Previous->is(TT_LeadingJavaAnnotation)) in determineTokenType()
1962 } else if (Current.Previous->is(tok::period) && in determineTokenType()
1983 if (Style.isJavaScript() && Tok.Previous->is(Keywords.kw_in)) in isStartOfName()
1991 while (PreviousNotConst && PreviousNotConst->is(tok::kw_const)) in isStartOfName()
2000 bool IsPPKeyword = PreviousNotConst->is(tok::identifier) && in isStartOfName()
2002 PreviousNotConst->Previous->is(tok::hash); in isStartOfName()
2004 if (PreviousNotConst->is(TT_TemplateCloser)) { in isStartOfName()
2011 if (PreviousNotConst->is(tok::r_paren) && in isStartOfName()
2012 PreviousNotConst->is(TT_TypeDeclarationParen)) { in isStartOfName()
2025 if (PreviousNotConst->is(TT_PointerOrReference)) in isStartOfName()
2033 return Style.isJavaScript() && PreviousNotConst->is(tok::kw_const); in isStartOfName()
2043 if (LeftOfParens && LeftOfParens->is(TT_TemplateCloser) && in lParenStartsCppCast()
2073 if (LeftOfParens->is(tok::r_paren) && in rParenEndsCast()
2082 if (LeftOfParens->is(tok::r_square)) { in rParenEndsCast()
2105 LeftOfParens->Previous->is(tok::kw_operator)) { in rParenEndsCast()
2125 if (Tok.Next->is(tok::question)) in rParenEndsCast()
2129 if (Tok.Next->is(Keywords.kw_in) && Style.isCSharp()) in rParenEndsCast()
2143 if (Style.Language == FormatStyle::LK_Java && Tok.Next->is(tok::l_paren)) in rParenEndsCast()
2160 if (T->is(TT_AttributeParen)) { in rParenEndsCast()
2163 T->MatchingParen->Previous->is(tok::kw___attribute)) { in rParenEndsCast()
2167 } else if (T->is(TT_AttributeSquare)) { in rParenEndsCast()
2179 return T && T->is(TT_PointerOrReference); in rParenEndsCast()
2201 if (Token->is(TT_BinaryOperator)) in rParenEndsCast()
2211 if (Tok.Next->is(tok::l_paren) && Tok.Previous && Tok.Previous->Previous) { in rParenEndsCast()
2212 if (Tok.Previous->is(tok::identifier) && in rParenEndsCast()
2213 Tok.Previous->Previous->is(tok::l_paren)) { in rParenEndsCast()
2226 if (!NextIsUnary || Tok.Next->is(tok::plus) || in rParenEndsCast()
2262 if (PrevToken->is(tok::kw_sizeof)) in determineUnaryOperatorByUsage()
2270 if (PrevToken->is(TT_BinaryOperator)) in determineUnaryOperatorByUsage()
2283 if (Style.isCSharp() && Tok.is(tok::ampamp)) in determineStarAmpUsage()
2292 if (InTemplateArgument && NextToken && NextToken->is(tok::kw_noexcept)) in determineStarAmpUsage()
2298 (NextToken->is(tok::l_brace) && !NextToken->getNextNonComment())) { in determineStarAmpUsage()
2302 if (PrevToken->is(tok::coloncolon)) in determineStarAmpUsage()
2305 if (PrevToken->is(tok::r_paren) && PrevToken->is(TT_TypeDeclarationParen)) in determineStarAmpUsage()
2311 if (NextToken->is(tok::l_square) && NextToken->isNot(TT_LambdaLSquare)) in determineStarAmpUsage()
2313 if (NextToken->is(tok::kw_operator) && !IsExpression) in determineStarAmpUsage()
2328 if (PrevToken->is(tok::r_brace) && Tok.is(tok::star) && in determineStarAmpUsage()
2339 while (NextNonParen && NextNonParen->is(tok::l_paren)) in determineStarAmpUsage()
2354 if (Tok.is(tok::ampamp) && NextToken->is(tok::l_paren)) in determineStarAmpUsage()
2361 if (NextNextToken && NextNextToken->is(tok::arrow)) in determineStarAmpUsage()
2381 if (PrevToken->is(tok::at)) in determinePlusMinusCaretUsage()
2391 if (!PrevToken || PrevToken->is(TT_CastRParen)) in determineIncrementUsage()
2429 while (Current && (Current->is(tok::kw_return) || in parse()
2430 (Current->is(tok::colon) && in parse()
2462 Current->is(TT_SelectorName)) { in parse()
2472 (Current->MatchingParen || Current->is(TT_TemplateString))) || in parse()
2475 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
2536 if (Current->is(TT_ConditionalExpr)) in getCurrentPrecedence()
2538 if (NextNonComment && Current->is(TT_SelectorName) && in getCurrentPrecedence()
2542 NextNonComment->is(tok::less)))) { in getCurrentPrecedence()
2545 if (Current->is(TT_JsComputedPropertyName)) in getCurrentPrecedence()
2547 if (Current->is(TT_LambdaArrow)) in getCurrentPrecedence()
2549 if (Current->is(TT_FatArrow)) in getCurrentPrecedence()
2552 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
2553 NextNonComment->is(TT_SelectorName))) { in getCurrentPrecedence()
2556 if (Current->is(TT_RangeBasedForLoopColon)) in getCurrentPrecedence()
2559 Current->is(Keywords.kw_instanceof)) { in getCurrentPrecedence()
2566 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
2597 while (Current && Current->is(TT_UnaryOperator)) { in parseUnaryOperator()
2613 if (!Current || !Current->is(tok::question)) in parseConditionalExpr()
2715 if (Next->is(TT_OverloadedOperatorLParen)) in isFunctionDeclarationName()
2717 if (Next->is(TT_OverloadedOperator)) in isFunctionDeclarationName()
2732 if ((Next->isSimpleTypeSpecifier() || Next->is(tok::identifier)) && in isFunctionDeclarationName()
2738 if (Next->is(TT_TemplateOpener) && Next->MatchingParen) { in isFunctionDeclarationName()
2750 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
2751 if (Current.Previous && Current.Previous->is(tok::coloncolon)) in isFunctionDeclarationName()
2755 if (!Current.is(TT_StartOfName) || Current.NestingLevel != 0) in isFunctionDeclarationName()
2758 if (Next->is(TT_TemplateOpener)) { in isFunctionDeclarationName()
2760 } else if (Next->is(tok::coloncolon)) { in isFunctionDeclarationName()
2764 if (Next->is(tok::kw_operator)) { in isFunctionDeclarationName()
2768 if (!Next->is(tok::identifier)) in isFunctionDeclarationName()
2770 } else if (Next->is(tok::l_paren)) { in isFunctionDeclarationName()
2779 if (!Next || !Next->is(tok::l_paren) || !Next->MatchingParen) in isFunctionDeclarationName()
2782 if (Line.Last->is(tok::l_brace)) in isFunctionDeclarationName()
2788 Next->MatchingParen->Next->is(TT_PointerOrReference)) { in isFunctionDeclarationName()
2802 if (IsCpp && Next->Next && Next->Next->is(tok::identifier) && in isFunctionDeclarationName()
2809 if (Tok->is(TT_TypeDeclarationParen)) in isFunctionDeclarationName()
2815 if (Tok->is(tok::kw_const) || Tok->isSimpleTypeSpecifier() || in isFunctionDeclarationName()
2870 if (Current->is(TT_LineComment)) { in calculateFormattingInformation()
2871 if (Prev->is(BK_BracedInit) && Prev->opensScope()) { in calculateFormattingInformation()
2890 if (Parameter->Previous && Parameter->Previous->is(tok::comma)) { in calculateFormattingInformation()
2891 if (!Parameter->Previous->is(TT_CtorInitializerComma) && in calculateFormattingInformation()
2905 if (!Children.empty() && Children.back()->Last->is(TT_LineComment)) { in calculateFormattingInformation()
2911 Current->is(TT_FunctionDeclarationName)) { in calculateFormattingInformation()
2934 if (Current->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
2948 Current->is(TT_SelectorName) && Current->ParameterIndex > 0) { in calculateFormattingInformation()
3001 if (CurrentToken->is(tok::l_brace)) { in calculateArrayInitializerColumnList()
3016 if (CurrentToken->is(tok::l_brace)) in calculateInitializerColumnList()
3018 else if (CurrentToken->is(tok::r_brace)) in calculateInitializerColumnList()
3038 if (Left.is(tok::semi)) in splitPenalty()
3044 if (Right.is(Keywords.kw_implements)) in splitPenalty()
3046 if (Left.is(tok::comma) && Left.NestingLevel == 0) in splitPenalty()
3049 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
3051 if (Left.is(TT_JsTypeColon)) in splitPenalty()
3053 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in splitPenalty()
3054 (Right.is(TT_TemplateString) && Right.TokenText.startswith("}"))) { in splitPenalty()
3062 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in splitPenalty()
3064 if (Right.is(tok::l_square)) { in splitPenalty()
3067 if (Left.is(tok::r_square)) in splitPenalty()
3070 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
3079 if (Left.is(tok::coloncolon) || in splitPenalty()
3080 (Right.is(tok::period) && Style.Language == FormatStyle::LK_Proto)) { in splitPenalty()
3084 Right.is(tok::kw_operator)) { in splitPenalty()
3087 if (Left.is(TT_StartOfName)) in splitPenalty()
3093 if (Right.is(TT_PointerOrReference)) in splitPenalty()
3095 if (Right.is(TT_LambdaArrow)) in splitPenalty()
3097 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
3099 if (Left.is(TT_CastRParen)) in splitPenalty()
3103 if (Left.is(tok::comment)) in splitPenalty()
3136 if (Right.is(TT_TrailingAnnotation) && in splitPenalty()
3148 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0); in splitPenalty()
3152 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
3157 if (Right.is(TT_SelectorName)) in splitPenalty()
3159 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) in splitPenalty()
3165 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
3170 if (Left.is(tok::l_paren) && Style.PenaltyBreakOpenParenthesis != 0) in splitPenalty()
3172 if (Left.is(tok::l_paren) && InFunctionDecl && in splitPenalty()
3176 if (Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
3177 (Left.Previous->is(tok::kw_for) || Left.Previous->isIf())) { in splitPenalty()
3180 if (Left.is(tok::equal) && InFunctionDecl) in splitPenalty()
3182 if (Right.is(tok::r_brace)) in splitPenalty()
3184 if (Left.is(TT_TemplateOpener)) in splitPenalty()
3194 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle) in splitPenalty()
3199 if (Left.is(TT_JavaAnnotation)) in splitPenalty()
3202 if (Left.is(TT_UnaryOperator)) in splitPenalty()
3209 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
3213 if (Left.is(tok::comma)) in splitPenalty()
3215 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
3219 if (Right.is(tok::lessless)) { in splitPenalty()
3221 if (!Left.is(tok::r_paren) || Right.OperatorIndex > 0) { in splitPenalty()
3231 if (Left.is(TT_ConditionalExpr)) in splitPenalty()
3247 if (Right.is(TT_OverloadedOperatorLParen) && in spaceRequiredBeforeParens()
3261 if (Left.is(tok::kw_return) && in spaceRequiredBetween()
3265 if (Style.isJson() && Left.is(tok::string_literal) && Right.is(tok::colon)) in spaceRequiredBetween()
3267 if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java) in spaceRequiredBetween()
3273 if (Right.is(tok::hashhash)) in spaceRequiredBetween()
3274 return Left.is(tok::hash); in spaceRequiredBetween()
3276 return Right.is(tok::hash); in spaceRequiredBetween()
3277 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) || in spaceRequiredBetween()
3278 (Left.is(tok::l_brace) && Left.isNot(BK_Block) && in spaceRequiredBetween()
3279 Right.is(tok::r_brace) && Right.isNot(BK_Block))) { in spaceRequiredBetween()
3284 if (Left.is(tok::l_paren)) in spaceRequiredBetween()
3286 else if (Right.is(tok::r_paren) && Right.MatchingParen) in spaceRequiredBetween()
3295 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace)) in spaceRequiredBetween()
3299 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && Left.Previous && in spaceRequiredBetween()
3300 Left.Previous->is(tok::kw_operator)) { in spaceRequiredBetween()
3309 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { in spaceRequiredBetween()
3310 return (Right.is(TT_CastRParen) || in spaceRequiredBetween()
3311 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) in spaceRequiredBetween()
3317 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) { in spaceRequiredBetween()
3320 Right.MatchingParen->Next->is(tok::colon); in spaceRequiredBetween()
3323 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
3327 if (Left.is(tok::at) && in spaceRequiredBetween()
3333 if (Left.is(tok::colon)) in spaceRequiredBetween()
3334 return !Left.is(TT_ObjCMethodExpr); in spaceRequiredBetween()
3335 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
3337 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
3340 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
3342 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
3348 if (Right.is(tok::ellipsis)) { in spaceRequiredBetween()
3349 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous && in spaceRequiredBetween()
3350 Left.Previous->is(tok::kw_case)); in spaceRequiredBetween()
3352 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
3354 if (Right.is(TT_PointerOrReference)) { in spaceRequiredBetween()
3355 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { in spaceRequiredBetween()
3360 if (!TokenBeforeMatchingParen || !Left.is(TT_TypeDeclarationParen)) in spaceRequiredBetween()
3368 (Left.is(TT_AttributeParen) || in spaceRequiredBetween()
3376 Right.Next->Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
3387 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
3388 (!Left.is(TT_PointerOrReference) || in spaceRequiredBetween()
3393 if (Left.is(TT_PointerOrReference)) { in spaceRequiredBetween()
3405 if (Right.is(TT_BlockComment)) in spaceRequiredBetween()
3409 !Right.is(TT_StartOfName)) { in spaceRequiredBetween()
3413 if (Right.is(tok::l_brace) && Right.is(BK_Block)) in spaceRequiredBetween()
3417 Right.Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
3443 if (Left.is(tok::ellipsis) && Left.Previous && in spaceRequiredBetween()
3448 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
3450 if (Left.is(tok::star) && Right.isOneOf(tok::star, tok::amp, tok::ampamp)) in spaceRequiredBetween()
3454 while (Previous && !Previous->is(tok::kw_operator)) { in spaceRequiredBetween()
3455 if (Previous->is(tok::identifier) || Previous->isSimpleTypeSpecifier()) { in spaceRequiredBetween()
3459 if (Previous->is(TT_TemplateCloser) && Previous->MatchingParen) { in spaceRequiredBetween()
3463 if (Previous->is(tok::coloncolon)) { in spaceRequiredBetween()
3484 if (Previous->is(tok::kw_const) || Previous->is(tok::kw_volatile)) { in spaceRequiredBetween()
3501 if (Left.is(tok::l_square)) { in spaceRequiredBetween()
3502 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
3508 if (Right.is(tok::r_square)) { in spaceRequiredBetween()
3510 ((Right.MatchingParen->is(TT_ArrayInitializerLSquare) && in spaceRequiredBetween()
3517 Right.MatchingParen->is(TT_AttributeParen)); in spaceRequiredBetween()
3519 if (Right.is(tok::l_square) && in spaceRequiredBetween()
3524 !(!Left.is(tok::r_square) && Style.SpaceBeforeSquareBrackets && in spaceRequiredBetween()
3525 Right.is(TT_ArraySubscriptLSquare))) { in spaceRequiredBetween()
3528 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
3530 if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) || in spaceRequiredBetween()
3531 (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
3535 if (Left.is(TT_BlockComment)) { in spaceRequiredBetween()
3542 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare)) in spaceRequiredBetween()
3545 if (Right.is(tok::l_paren)) { in spaceRequiredBetween()
3546 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen)) in spaceRequiredBetween()
3553 if (Left.is(TT_RequiresExpression)) { in spaceRequiredBetween()
3557 if ((Left.is(tok::r_paren) && Left.is(TT_AttributeParen)) || in spaceRequiredBetween()
3558 (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) { in spaceRequiredBetween()
3561 if (Left.is(TT_ForEachMacro)) { in spaceRequiredBetween()
3565 if (Left.is(TT_IfMacro)) { in spaceRequiredBetween()
3571 if (Left.is(tok::semi)) in spaceRequiredBetween()
3582 if (Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBetween()
3585 if (Line.MightBeFunctionDecl && (Left.is(TT_FunctionDeclarationName))) { in spaceRequiredBetween()
3595 if (Line.Type != LT_PreprocessorDirective && Left.is(tok::r_square) && in spaceRequiredBetween()
3596 Left.MatchingParen && Left.MatchingParen->is(TT_LambdaLSquare)) { in spaceRequiredBetween()
3611 if (Left.is(tok::r_square) && Left.MatchingParen && in spaceRequiredBetween()
3613 Left.MatchingParen->Previous->is(tok::kw_delete)) { in spaceRequiredBetween()
3620 (Left.Tok.getIdentifierInfo() || Left.is(tok::r_paren))) { in spaceRequiredBetween()
3625 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
3627 if (Right.is(TT_UnaryOperator)) { in spaceRequiredBetween()
3634 Right.is(tok::l_brace) && Right.getNextNonComment() && in spaceRequiredBetween()
3638 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
3642 if (Right.is(tok::hash) && Left.is(tok::identifier) && in spaceRequiredBetween()
3649 if (Left.is(TT_TemplateCloser) && Left.MatchingParen && in spaceRequiredBetween()
3651 (Left.MatchingParen->Previous->is(tok::period) || in spaceRequiredBetween()
3652 Left.MatchingParen->Previous->is(tok::coloncolon))) { in spaceRequiredBetween()
3658 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
3660 if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) { in spaceRequiredBetween()
3664 if (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
3672 (!Right.Next || Right.Next->is(tok::semi))) { in spaceRequiredBetween()
3697 if (Left.is(tok::star) && Right.is(tok::comment)) in spaceRequiredBefore()
3703 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis)) in spaceRequiredBefore()
3707 Right.is(TT_ModulePartitionColon)) { in spaceRequiredBefore()
3711 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon)) in spaceRequiredBefore()
3714 if (Left.is(TT_ModulePartitionColon) && in spaceRequiredBefore()
3718 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) && in spaceRequiredBefore()
3719 Line.First->is(Keywords.kw_import)) { in spaceRequiredBefore()
3723 if (Left.is(TT_AttributeParen) && Right.is(tok::coloncolon)) in spaceRequiredBefore()
3726 if (Left.is(tok::kw_operator)) in spaceRequiredBefore()
3727 return Right.is(tok::coloncolon); in spaceRequiredBefore()
3728 if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) && in spaceRequiredBefore()
3732 if (Left.is(tok::less) && Left.is(TT_OverloadedOperator) && in spaceRequiredBefore()
3733 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
3738 if (Right.is(tok::period) && in spaceRequiredBefore()
3743 if (Right.is(tok::l_paren) && in spaceRequiredBefore()
3747 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
3750 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
3753 Left.MatchingParen->is(TT_ProtoExtensionLSquare) && in spaceRequiredBefore()
3758 if (Left.is(tok::percent)) in spaceRequiredBefore()
3762 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
3765 if (Right.is(tok::colon)) in spaceRequiredBefore()
3773 if (Left.is(tok::kw_this) && Right.is(tok::l_square)) in spaceRequiredBefore()
3777 if (Left.is(tok::kw_new) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3781 if (Right.is(tok::l_brace)) in spaceRequiredBefore()
3785 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace)) in spaceRequiredBefore()
3788 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBefore()
3792 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow)) in spaceRequiredBefore()
3796 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon)) in spaceRequiredBefore()
3800 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName)) in spaceRequiredBefore()
3804 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
3808 if (Right.is(TT_CSharpNullable)) in spaceRequiredBefore()
3812 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
3816 if (Left.is(tok::comma) && Right.is(tok::comma)) in spaceRequiredBefore()
3820 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren)) in spaceRequiredBefore()
3824 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
3839 Right.is(tok::l_paren)) { in spaceRequiredBefore()
3843 if (Left.is(TT_FatArrow)) in spaceRequiredBefore()
3846 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
3847 Left.Previous->is(tok::kw_for)) { in spaceRequiredBefore()
3850 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
3855 if (Next && Next->is(TT_FatArrow)) in spaceRequiredBefore()
3858 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in spaceRequiredBefore()
3859 (Right.is(TT_TemplateString) && Right.TokenText.startswith("}"))) { in spaceRequiredBefore()
3866 Right.is(TT_TemplateString)) { in spaceRequiredBefore()
3869 if (Right.is(tok::star) && in spaceRequiredBefore()
3878 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
3884 if (Left.Previous && Left.Previous->is(tok::period) && in spaceRequiredBefore()
3902 (Left.is(Keywords.kw_of) && Left.Previous && in spaceRequiredBefore()
3903 (Left.Previous->is(tok::identifier) || in spaceRequiredBefore()
3905 (!Left.Previous || !Left.Previous->is(tok::period))) { in spaceRequiredBefore()
3909 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
3912 if (Left.is(Keywords.kw_as) && in spaceRequiredBefore()
3916 if (Left.is(tok::kw_default) && Left.Previous && in spaceRequiredBefore()
3917 Left.Previous->is(tok::kw_export)) { in spaceRequiredBefore()
3920 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
3924 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
3926 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
3930 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
3932 if (Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
3940 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
3942 if (Left.is(TT_NonNullAssertion) && in spaceRequiredBefore()
3947 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
3949 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
3957 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
3962 if (!Left.is(TT_BinaryOperator) && in spaceRequiredBefore()
3967 if (!Right.is(tok::semi) && in spaceRequiredBefore()
3971 (Left.is(tok::r_paren) && Left.MatchingParen && in spaceRequiredBefore()
3976 if (Left.is(TT_ImplicitStringLiteral)) in spaceRequiredBefore()
3979 if (Left.is(TT_ObjCMethodSpecifier)) in spaceRequiredBefore()
3981 if (Left.is(tok::r_paren) && canBeObjCSelectorComponent(Right)) { in spaceRequiredBefore()
3989 (Right.is(tok::equal) || Left.is(tok::equal))) { in spaceRequiredBefore()
3997 if (Left.is(tok::comma) && !Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBefore()
3999 if (Right.is(tok::comma)) in spaceRequiredBefore()
4001 if (Right.is(TT_ObjCBlockLParen)) in spaceRequiredBefore()
4003 if (Right.is(TT_CtorInitializerColon)) in spaceRequiredBefore()
4005 if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon) in spaceRequiredBefore()
4007 if (Right.is(TT_RangeBasedForLoopColon) && in spaceRequiredBefore()
4011 if (Left.is(TT_BitFieldColon)) { in spaceRequiredBefore()
4015 if (Right.is(tok::colon)) { in spaceRequiredBefore()
4019 if (!Next || Next->is(tok::semi)) in spaceRequiredBefore()
4021 if (Right.is(TT_ObjCMethodExpr)) in spaceRequiredBefore()
4023 if (Left.is(tok::question)) in spaceRequiredBefore()
4025 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
4027 if (Right.is(TT_DictLiteral)) in spaceRequiredBefore()
4029 if (Right.is(TT_AttributeColon)) in spaceRequiredBefore()
4031 if (Right.is(TT_CSharpNamedArgumentColon)) in spaceRequiredBefore()
4033 if (Right.is(TT_BitFieldColon)) { in spaceRequiredBefore()
4046 if (Left.is(TT_UnaryOperator)) { in spaceRequiredBefore()
4047 if (!Right.is(tok::l_paren)) { in spaceRequiredBefore()
4051 if (Left.is(tok::exclaim) && Left.TokenText == "not") in spaceRequiredBefore()
4053 if (Left.is(tok::tilde) && Left.TokenText == "compl") in spaceRequiredBefore()
4057 if (Left.is(tok::amp) && Right.is(tok::r_square)) in spaceRequiredBefore()
4060 return (Style.SpaceAfterLogicalNot && Left.is(tok::exclaim)) || in spaceRequiredBefore()
4061 Right.is(TT_BinaryOperator); in spaceRequiredBefore()
4066 if (Left.is(TT_CastRParen)) { in spaceRequiredBefore()
4079 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
4081 (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) { in spaceRequiredBefore()
4084 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
4090 (Right.is(tok::period) && Right.isNot(TT_DesignatedInitializerPeriod))) { in spaceRequiredBefore()
4097 if (Style.Language == FormatStyle::LK_Java && Right.is(tok::coloncolon) && in spaceRequiredBefore()
4098 (Left.is(tok::identifier) || Left.is(tok::kw_this))) { in spaceRequiredBefore()
4101 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) { in spaceRequiredBefore()
4107 if (Right.is(tok::coloncolon) && in spaceRequiredBefore()
4110 return (Left.is(TT_TemplateOpener) && in spaceRequiredBefore()
4116 (Left.is(tok::l_paren) && Style.SpacesInParentheses); in spaceRequiredBefore()
4118 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
4121 if (Right.is(TT_StructuredBindingLSquare)) { in spaceRequiredBefore()
4126 if (Right.Next && Right.Next->is(TT_StructuredBindingLSquare) && in spaceRequiredBefore()
4130 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || in spaceRequiredBefore()
4132 !Right.is(tok::r_paren))) { in spaceRequiredBefore()
4135 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
4137 Left.MatchingParen->is(TT_OverloadedOperatorLParen)) { in spaceRequiredBefore()
4140 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
4144 if (Right.is(TT_TrailingUnaryOperator)) in spaceRequiredBefore()
4146 if (Left.is(TT_RegexLiteral)) in spaceRequiredBefore()
4153 return Tok.is(tok::l_brace) && Tok.is(BK_Block) && in isAllmanBrace()
4170 return Tok.is(tok::l_brace) && Tok.is(BK_Block) && in isAllmanLambdaBrace()
4179 if (Next->is(tok::comment)) in getFirstNonComment()
4191 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) && in mustBreakBefore()
4195 if (Right.is(TT_CSharpNamedArgumentColon) || in mustBreakBefore()
4196 Left.is(TT_CSharpNamedArgumentColon)) { in mustBreakBefore()
4199 if (Right.is(TT_CSharpGenericTypeConstraint)) in mustBreakBefore()
4201 if (Right.Next && Right.Next->is(TT_FatArrow) && in mustBreakBefore()
4202 (Right.is(tok::numeric_constant) || in mustBreakBefore()
4203 (Right.is(tok::identifier) && Right.TokenText == "_"))) { in mustBreakBefore()
4208 if (Left.is(TT_AttributeSquare) && Left.is(tok::r_square) && in mustBreakBefore()
4210 Right.is(Keywords.kw_internal))) { in mustBreakBefore()
4214 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) && in mustBreakBefore()
4215 Left.is(tok::r_square) && Right.is(tok::l_square)) { in mustBreakBefore()
4221 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous && in mustBreakBefore()
4222 Left.Previous->is(tok::string_literal)) { in mustBreakBefore()
4225 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
4226 Left.Previous && Left.Previous->is(tok::equal) && in mustBreakBefore()
4236 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
4245 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && Left.Previous && in mustBreakBefore()
4246 Left.Previous->is(TT_FatArrow)) { in mustBreakBefore()
4264 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
4274 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
4275 Right.Next->is(tok::string_literal)) { in mustBreakBefore()
4292 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace)) in mustBreakBefore()
4297 if (Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) && in mustBreakBefore()
4298 !Right.is(tok::r_square)) { in mustBreakBefore()
4304 if (Left.is(tok::comma)) in mustBreakBefore()
4315 (Style.isJavaScript() && Left.is(tok::l_paren))) && in mustBreakBefore()
4322 Right.MatchingParen->is(tok::l_paren)))) { in mustBreakBefore()
4325 if (BeforeClosingBrace && (BeforeClosingBrace->is(tok::comma) || in mustBreakBefore()
4331 if (Right.is(tok::comment)) { in mustBreakBefore()
4339 if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && in mustBreakBefore()
4340 Right.Next->is(tok::string_literal)) { in mustBreakBefore()
4343 if (Right.is(TT_RequiresClause)) { in mustBreakBefore()
4358 if (Right.is(tok::kw_concept)) in mustBreakBefore()
4373 (Left.is(TT_CtorInitializerComma) || in mustBreakBefore()
4374 Right.is(TT_CtorInitializerColon))) { in mustBreakBefore()
4390 Right.is(TT_InheritanceComma)) { in mustBreakBefore()
4394 Left.is(TT_InheritanceComma)) { in mustBreakBefore()
4397 if (Right.is(tok::string_literal) && Right.TokenText.startswith("R\"")) { in mustBreakBefore()
4403 if ((Left.is(tok::l_brace) || (Left.is(tok::less) && Left.Previous && in mustBreakBefore()
4404 Left.Previous->is(tok::equal))) && in mustBreakBefore()
4410 if (Right.is(TT_InlineASMBrace)) in mustBreakBefore()
4427 FirstNonComment->Next->is(tok::kw_enum)) { in mustBreakBefore()
4435 FirstNonComment->Next->is(Keywords.kw_interface)) || in mustBreakBefore()
4444 if (Left.is(TT_ObjCBlockLBrace) && in mustBreakBefore()
4450 if (Left.is(TT_AttributeParen) && Right.is(TT_ObjCDecl)) in mustBreakBefore()
4453 if (Left.is(TT_LambdaLBrace)) { in mustBreakBefore()
4467 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) && in mustBreakBefore()
4474 Left.is(TT_LeadingJavaAnnotation) && in mustBreakBefore()
4476 (Line.Last->is(tok::l_brace) || Style.BreakAfterJavaFieldAnnotations)) { in mustBreakBefore()
4480 if (Right.is(TT_ProtoExtensionLSquare)) in mustBreakBefore()
4512 Right.is(TT_SelectorName) && !Right.is(tok::r_square) && Right.Next) { in mustBreakBefore()
4515 if (Left.is(tok::at)) in mustBreakBefore()
4522 if (LBrace && LBrace->is(tok::colon)) { in mustBreakBefore()
4524 if (LBrace && LBrace->is(tok::at)) { in mustBreakBefore()
4539 ((LBrace->is(tok::l_brace) && in mustBreakBefore()
4540 (LBrace->is(TT_DictLiteral) || in mustBreakBefore()
4541 (LBrace->Next && LBrace->Next->is(tok::r_brace)))) || in mustBreakBefore()
4542 LBrace->is(TT_ArrayInitializerLSquare) || LBrace->is(tok::less))) { in mustBreakBefore()
4573 Left.is(tok::l_paren) && Left.BlockParameterCount > 0 && in mustBreakBefore()
4605 if (Line.First->is(TT_CSharpGenericTypeConstraint)) in canBreakBefore()
4606 return Left.is(TT_CSharpGenericTypeConstraintComma); in canBreakBefore()
4608 if (Right.is(TT_CSharpNullable)) in canBreakBefore()
4637 if (NonComment && NonComment->is(tok::identifier) && in canBreakBefore()
4641 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
4643 if (Left.is(TT_JsTypeColon)) in canBreakBefore()
4646 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
4651 if (Right.is(Keywords.kw_is)) { in canBreakBefore()
4660 if (!Next || !Next->is(tok::colon)) in canBreakBefore()
4663 if (Left.is(Keywords.kw_in)) in canBreakBefore()
4665 if (Right.is(Keywords.kw_in)) in canBreakBefore()
4667 if (Right.is(Keywords.kw_as)) in canBreakBefore()
4675 if (Left.is(Keywords.kw_as)) in canBreakBefore()
4677 if (Left.is(TT_NonNullAssertion)) in canBreakBefore()
4679 if (Left.is(Keywords.kw_declare) && in canBreakBefore()
4692 if (Right.is(TT_TemplateString) && Right.closesScope()) in canBreakBefore()
4696 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) in canBreakBefore()
4698 if (Left.is(TT_TemplateString) && Left.opensScope()) in canBreakBefore()
4702 if (Left.is(tok::at)) in canBreakBefore()
4707 return !Right.is(tok::l_paren); in canBreakBefore()
4708 if (Right.is(TT_PointerOrReference)) { in canBreakBefore()
4715 Right.is(tok::kw_operator)) { in canBreakBefore()
4718 if (Left.is(TT_PointerOrReference)) in canBreakBefore()
4726 return Left.is(BK_BracedInit) || in canBreakBefore()
4727 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 && in canBreakBefore()
4730 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
4732 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question)) in canBreakBefore()
4734 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
4736 if (Left.is(TT_InheritanceColon)) in canBreakBefore()
4738 if (Right.is(TT_InheritanceColon)) in canBreakBefore()
4740 if (Right.is(TT_ObjCMethodExpr) && !Right.is(tok::r_square) && in canBreakBefore()
4745 if (Right.is(tok::colon) && in canBreakBefore()
4749 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) { in canBreakBefore()
4778 if (((Right.is(tok::l_brace) || Right.is(tok::less)) && in canBreakBefore()
4779 Right.is(TT_DictLiteral)) || in canBreakBefore()
4780 Right.is(TT_ArrayInitializerLSquare)) { in canBreakBefore()
4786 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
4787 Right.MatchingParen->is(TT_ProtoExtensionLSquare)) { in canBreakBefore()
4790 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next && in canBreakBefore()
4791 Right.Next->is(TT_ObjCMethodExpr))) { in canBreakBefore()
4794 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
4796 if (Right.is(tok::kw_concept)) in canBreakBefore()
4798 if (Right.is(TT_RequiresClause)) in canBreakBefore()
4800 if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen)) in canBreakBefore()
4808 if (Left.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
4810 if (Right.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
4812 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) in canBreakBefore()
4814 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
4815 (Left.is(tok::less) && Right.is(tok::less))) { in canBreakBefore()
4818 if (Right.is(TT_BinaryOperator) && in canBreakBefore()
4825 Left.is(tok::kw_operator)) { in canBreakBefore()
4828 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
4832 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
4836 if (Left.is(tok::l_paren) && in canBreakBefore()
4840 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
4844 if (Right.is(TT_ImplicitStringLiteral)) in canBreakBefore()
4847 if (Right.is(TT_TemplateCloser)) in canBreakBefore()
4849 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
4850 Right.MatchingParen->is(TT_LambdaLSquare)) { in canBreakBefore()
4856 if (Right.is(tok::r_brace)) in canBreakBefore()
4857 return Right.MatchingParen && Right.MatchingParen->is(BK_Block); in canBreakBefore()
4860 if (Right.is(tok::r_paren)) { in canBreakBefore()
4866 return !(Previous && (Previous->is(tok::kw_for) || Previous->isIf())); in canBreakBefore()
4871 if (Left.is(TT_TrailingAnnotation)) { in canBreakBefore()
4876 if (Right.is(tok::kw___attribute) || in canBreakBefore()
4877 (Right.is(tok::l_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
4878 return !Left.is(TT_AttributeSquare); in canBreakBefore()
4881 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
4884 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in canBreakBefore()
4887 if (Left.is(TT_CtorInitializerColon)) { in canBreakBefore()
4891 if (Right.is(TT_CtorInitializerColon)) in canBreakBefore()
4893 if (Left.is(TT_CtorInitializerComma) && in canBreakBefore()
4897 if (Right.is(TT_CtorInitializerComma) && in canBreakBefore()
4901 if (Left.is(TT_InheritanceComma) && in canBreakBefore()
4905 if (Right.is(TT_InheritanceComma) && in canBreakBefore()
4909 if (Left.is(TT_ArrayInitializerLSquare)) in canBreakBefore()
4911 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
4913 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && in canBreakBefore()
4920 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
4921 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
4926 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace)) { in canBreakBefore()
4938 (Left.is(tok::r_paren) && in canBreakBefore()
4940 (Left.is(tok::l_paren) && !Right.is(tok::r_paren)) || in canBreakBefore()
4941 (Left.is(TT_TemplateOpener) && !Right.is(TT_TemplateCloser)); in canBreakBefore()
5000 assert(PointerOrReference.is(tok::star)); in getTokenPointerOrReferenceAlignment()