Lines Matching refs:is
67 if (Left->Previous && Left->Previous->is(tok::greater) && in isLambdaParameterList()
69 Left->Previous->MatchingParen->is(TT_TemplateOpener)) { in isLambdaParameterList()
74 return Left->Previous && Left->Previous->is(tok::r_square) && in isLambdaParameterList()
76 Left->Previous->MatchingParen->is(TT_LambdaLSquare); in isLambdaParameterList()
91 if (Tok.Previous && Tok.Previous->is(tok::at)) in isCppAttribute()
106 if (AttrTok->is(tok::colon) || in isCppAttribute()
111 if (AttrTok->is(tok::ellipsis)) in isCppAttribute()
161 if (Previous.Previous->is(tok::r_brace)) in parseAngle()
163 if (Previous.Previous->is(tok::r_paren) && Contexts.size() > 1 && in parseAngle()
169 if (Previous.Previous->is(tok::kw_operator) && in parseAngle()
170 CurrentToken->is(tok::l_paren)) { in parseAngle()
188 CurrentToken->is(tok::question)) { in parseAngle()
194 if (CurrentToken->is(tok::greater)) { in parseAngle()
203 if (Next && Next->is(tok::greater) && in parseAngle()
236 if (CurrentToken->is(tok::question) && in parseAngle()
251 Prev.is(TT_BinaryOperator)) { in parseAngle()
261 if (CurrentToken->is(tok::colon) || in parseAngle()
312 assert(OpeningParen.is(tok::l_paren)); in parseParens()
322 OpeningParen.Previous->is(TT_UntouchableMacroFunc)) { in parseParens()
332 MaybeSel->Previous && MaybeSel->Previous->is(tok::at)) { in parseParens()
338 if (OpeningParen.is(TT_OverloadedOperatorLParen)) { in parseParens()
352 } else if (OpeningParen.is(TT_VerilogInstancePortLParen)) { in parseParens()
371 (OpeningParen.Previous->is(Keywords.kw_function) || in parseParens()
377 OpeningParen.Previous->is(TT_JsTypeColon)) { in parseParens()
383 } else if (OpeningParen.is(TT_RequiresExpressionLParen)) { in parseParens()
386 OpeningParen.Previous->is(tok::kw__Generic)) { in parseParens()
397 OpeningParen.Previous->is(TT_ForEachMacro)) { in parseParens()
414 if (Prev->is(TT_TableGenCondOperator)) { in parseParens()
436 if (PrevNonComment && OpeningParen.is(TT_Unknown)) { in parseParens()
466 CurrentToken->isPointerOrReference() || CurrentToken->is(tok::caret); in parseParens()
470 OpeningParen.Previous && OpeningParen.Previous->is(tok::kw_for); in parseParens()
482 if (PrevPrev && PrevPrev->is(tok::identifier) && in parseParens()
484 CurrentToken->is(tok::identifier) && Next->isNot(tok::equal)) { in parseParens()
491 if (CurrentToken->Previous->is(TT_PointerOrReference) && in parseParens()
496 if (CurrentToken->is(tok::comma)) in parseParens()
498 if (CurrentToken->Previous->is(TT_BinaryOperator)) in parseParens()
500 if (CurrentToken->is(tok::r_paren)) { in parseParens()
503 (CurrentToken->Next->is(tok::l_paren) || in parseParens()
504 (CurrentToken->Next->is(tok::l_square) && in parseParens()
506 OpeningParen.setType(OpeningParen.Next->is(tok::caret) in parseParens()
513 if (CurrentToken->Next && CurrentToken->Next->is(tok::l_brace) && in parseParens()
514 OpeningParen.Previous && OpeningParen.Previous->is(tok::l_paren)) { in parseParens()
520 if (Tok->is(TT_BinaryOperator) && Tok->isPointerOrReference()) in parseParens()
533 if (OpeningParen.is(TT_AttributeLParen)) in parseParens()
535 if (OpeningParen.is(TT_TypeDeclarationParen)) in parseParens()
538 OpeningParen.Previous->is(TT_JavaAnnotation)) { in parseParens()
542 OpeningParen.Previous->is(TT_LeadingJavaAnnotation)) { in parseParens()
546 OpeningParen.Previous->is(TT_AttributeSquare)) { in parseParens()
563 if (CurrentToken->is(tok::l_brace) && OpeningParen.is(TT_ObjCBlockLParen)) in parseParens()
565 if (CurrentToken->is(tok::comma) && CurrentToken->Next && in parseParens()
571 (CurrentToken->is(tok::l_paren) && CurrentToken->Next && in parseParens()
575 !(CurrentToken->is(tok::l_brace) || in parseParens()
576 (CurrentToken->is(tok::l_paren) && !ProbablyFunctionTypeLParen))) { in parseParens()
586 if (MightBeObjCForRangeLoop && CurrentToken->is(Keywords.kw_in)) { in parseParens()
592 if (CurrentToken->is(tok::comma)) in parseParens()
596 if (CurrentToken->is(tok::comma)) { in parseParens()
600 } else if (CurrentToken->is(tok::colon)) { in parseParens()
626 if (Tok.Previous && Tok.Previous->is(tok::identifier)) in isCSharpAttributeSpecifier()
630 if (Tok.Previous && Tok.Previous->is(tok::r_square)) { in isCSharpAttributeSpecifier()
632 if (!MatchingParen || MatchingParen->is(TT_ArraySubscriptLSquare)) in isCSharpAttributeSpecifier()
641 if (AttrTok->is(tok::r_square)) in isCSharpAttributeSpecifier()
688 IsCpp && Parent && Parent->is(TT_TemplateCloser) && in parseSquare()
721 } else if (Left->is(TT_Unknown)) { in parseSquare()
739 } else if (CurrentToken->is(tok::r_square) && Parent && in parseSquare()
740 Parent->is(TT_TemplateCloser)) { in parseSquare()
793 if (Style.isJavaScript() && Parent && Parent->is(TT_JsTypeColon)) in parseSquare()
801 if (CurrentToken->is(tok::r_square)) { in parseSquare()
810 CurrentToken->Next->is(tok::l_paren)) || in parseSquare()
813 Left->is(TT_ObjCMethodExpr)) { in parseSquare()
826 CurrentToken->Previous->is(TT_Unknown) && in parseSquare()
833 if (Parent && Parent->is(TT_PointerOrReference)) in parseSquare()
837 if (CurrentToken->is(TT_ObjCMethodExpr) && CurrentToken->Next && in parseSquare()
838 CurrentToken->Next->is(TT_LambdaArrow)) { in parseSquare()
849 if (Previous && Previous->is(TT_SelectorName)) { in parseSquare()
863 if (Style.isTableGen() && Left->is(TT_TableGenListOpener)) in parseSquare()
870 if (CurrentToken->is(tok::colon)) { in parseSquare()
883 if (Parent && Parent->is(tok::r_paren)) { in parseSquare()
890 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
917 while (CurrentToken && CurrentToken->is(tok::comment)) in skipToNextNonComment()
929 while (CurrentToken->is(tok::comment)) in parseTableGenValue()
936 if (CurrentToken->is(tok::hash)) { in parseTableGenValue()
953 if (ParseNameMode && CurrentToken->is(tok::l_brace)) in parseTableGenValue()
960 if (Suffix->is(tok::l_square)) in parseTableGenValue()
962 if (Suffix->is(tok::l_brace)) { in parseTableGenValue()
976 if (CurrentToken->is(tok::identifier) && in tryToParseTableGenTokVar()
990 if (CurrentToken && CurrentToken->is(tok::colon)) { in parseTableGenDAGArg()
1017 if (!Tok.Next || Tok.Next->is(tok::colon)) in isTableGenDAGArgBreakingOperator()
1042 } else if (FirstTok->is(tok::identifier)) { in parseTableGenDAGArgAndList()
1053 if (!FirstDAGArgListElm && CurrentToken->is(tok::comma)) { in parseTableGenDAGArgAndList()
1058 if (CurrentToken && CurrentToken->is(tok::r_paren)) { in parseTableGenDAGArgAndList()
1088 if (Tok->is(tok::l_brace)) { in parseTableGenSimpleValue()
1093 if (Tok->is(tok::l_square)) { in parseTableGenSimpleValue()
1097 if (Tok->is(tok::less)) { in parseTableGenSimpleValue()
1105 if (Tok->is(tok::l_paren)) { in parseTableGenSimpleValue()
1110 if (Tok->is(TT_TableGenBangOperator)) { in parseTableGenSimpleValue()
1111 if (CurrentToken && CurrentToken->is(tok::less)) { in parseTableGenSimpleValue()
1127 if (Tok->is(TT_TableGenCondOperator)) { in parseTableGenSimpleValue()
1138 if (Tok->is(tok::identifier)) { in parseTableGenSimpleValue()
1140 if (CurrentToken && CurrentToken->is(tok::less)) { in parseTableGenSimpleValue()
1171 assert(OpeningBrace.is(tok::l_brace)); in parseBrace()
1180 if (OpeningBrace.is(BK_BracedInit)) in parseBrace()
1183 OpeningBrace.Previous->is(TT_JsTypeColon)) { in parseBrace()
1196 if (CurrentToken->is(tok::r_brace)) { in parseBrace()
1217 if (Previous->is(TT_JsTypeOptionalQuestion)) in parseBrace()
1219 if ((CurrentToken->is(tok::colon) && !Style.isTableGen() && in parseBrace()
1224 Previous->is(tok::string_literal)) { in parseBrace()
1228 if (CurrentToken->is(tok::colon) && OpeningBrace.is(TT_Unknown) && in parseBrace()
1235 if (CurrentToken->is(tok::comma)) { in parseBrace()
1250 if (Current->is(tok::l_brace) && Current->is(BK_Block)) in updateParameterCount()
1252 if (Current->is(tok::comma)) { in updateParameterCount()
1264 if (CurrentToken->is(tok::colon)) { in parseConditional()
1297 if (Prev && Prev->is(tok::r_square) && Prev->is(TT_AttributeSquare) && in consumeToken()
1308 if (Tok->is(TT_VerilogTableItem)) in consumeToken()
1311 if (Tok->is(TT_TableGenMultiLineString)) in consumeToken()
1374 } else if (Line.First->is(tok::kw_asm)) { in consumeToken()
1390 Tok->Previous->is(tok::identifier) && Tok->Previous->is(TT_Unknown); in consumeToken()
1393 !(BeforePrevious->is(TT_CastRParen) || in consumeToken()
1394 (BeforePrevious->is(TT_ObjCMethodExpr) && in consumeToken()
1395 BeforePrevious->is(tok::colon))) || in consumeToken()
1396 BeforePrevious->is(tok::r_square) || in consumeToken()
1415 } else if (CurrentToken && CurrentToken->is(tok::numeric_constant)) { in consumeToken()
1426 } else if (Prev->is(tok::kw_try)) { in consumeToken()
1441 Tok->Next->Next->is(tok::colon)))) { in consumeToken()
1459 if (CurrentToken && CurrentToken->is(Keywords.kw_then)) in consumeToken()
1469 if (CurrentToken && CurrentToken->is(tok::l_paren)) { in consumeToken()
1478 if ((Tok->Previous && Tok->Previous->is(tok::period)) || in consumeToken()
1479 (Tok->Next && Tok->Next->is(tok::colon))) { in consumeToken()
1483 if (CurrentToken && CurrentToken->is(Keywords.kw_await)) in consumeToken()
1486 if (IsCpp && CurrentToken && CurrentToken->is(tok::kw_co_await)) in consumeToken()
1500 if (Tok->Previous && Tok->Previous->is(tok::r_paren) && in consumeToken()
1502 Tok->Previous->MatchingParen->is(TT_OverloadedOperatorLParen)) { in consumeToken()
1532 if (Prev->is(Keywords.kw_verilogHash) && in consumeToken()
1537 if (Keywords.isVerilogIdentifier(*Prev) && PrevPrev->is(tok::r_paren)) in consumeToken()
1540 if (Keywords.isVerilogIdentifier(*Prev) && PrevPrev->is(tok::comma)) { in consumeToken()
1542 if (PrevParen->is(tok::r_paren) && PrevParen->MatchingParen && in consumeToken()
1543 PrevParen->MatchingParen->is(TT_VerilogInstancePortLParen)) { in consumeToken()
1622 if (Style.Language != FormatStyle::LK_TextProto && Tok->is(TT_Unknown)) in consumeToken()
1624 if (Tok->Previous && Tok->Previous->is(TT_TemplateCloser)) in consumeToken()
1637 if (Next->is(tok::less)) in consumeToken()
1645 if (CurrentToken->is(tok::comma) && Previous->isNot(tok::kw_operator)) in consumeToken()
1656 if (CurrentToken && CurrentToken->is(tok::l_paren)) in consumeToken()
1658 if (CurrentToken && CurrentToken->Previous->is(TT_BinaryOperator)) in consumeToken()
1693 if (Tok->Next && Tok->Next->is(tok::identifier) && Tok->Next->Next && in consumeToken()
1694 Tok->Next->Next->is(tok::equal)) { in consumeToken()
1755 if (Style.isCSharp() && Tok->is(Keywords.kw_where) && Tok->Next && in consumeToken()
1763 if (Tok->is(Keywords.kw_assert)) { in consumeToken()
1777 Tok->Previous->is(tok::kw_noexcept)) { in consumeToken()
1795 if (CurrentToken->is(tok::less)) { in parseCSharpGenericTypeConstraint()
1800 } else if (CurrentToken->is(tok::greater)) { in parseCSharpGenericTypeConstraint()
1804 } else if (CurrentToken->is(tok::comma) && OpenAngleBracketsCount == 0) { in parseCSharpGenericTypeConstraint()
1809 } else if (CurrentToken->is(Keywords.kw_where)) { in parseCSharpGenericTypeConstraint()
1812 } else if (CurrentToken->is(tok::colon)) { in parseCSharpGenericTypeConstraint()
1822 if (CurrentToken && CurrentToken->is(tok::less)) { in parseIncludeDirective()
1857 if (IsMarkOrRegion || CurrentToken->Previous->is(TT_BinaryOperator)) in parsePragma()
1891 if (CurrentToken->is(tok::numeric_constant)) { in parsePreprocessorDirective()
1932 if (Tok->is(tok::l_paren)) { in parsePreprocessorDirective()
1947 if (!Line.InMacroBody && CurrentToken->is(tok::hash)) { in parseLine()
1961 CurrentToken->is(Keywords.kw_package)) || in parseLine()
1973 if (CurrentToken->is(tok::less) && Line.Last->is(tok::greater)) { in parseLine()
1983 if (CurrentToken && CurrentToken->is(tok::identifier)) { in parseLine()
1994 if (Style.isJavaScript() && CurrentToken->is(Keywords.kw_import)) in parseLine()
1998 if (CurrentToken->is(tok::kw_virtual)) in parseLine()
2007 if (Line.First->is(tok::kw_export) && in parseLine()
2008 CurrentToken->is(Keywords.kw_from) && CurrentToken->Next && in parseLine()
2044 return Tok.TokenText == "goog" && Tok.Next && Tok.Next->is(tok::period) && in isClosureImportStatement()
2051 Tok.Next->Next->Next && Tok.Next->Next->Next->is(tok::l_paren); in isClosureImportStatement()
2176 if (Line.First->is(tok::kw_template)) { in modifyContext()
2178 if (Current.Previous->is(tok::kw_operator)) { in modifyContext()
2247 } else if (Current.is(tok::lessless) && in modifyContext()
2253 } else if (Current.is(TT_TrailingReturnArrow)) { in modifyContext()
2258 Current.Previous->is(TT_CtorInitializerColon)) { in modifyContext()
2261 } else if (Current.Previous && Current.Previous->is(TT_InheritanceColon)) { in modifyContext()
2273 } else if (Current.is(tok::kw_new)) { in modifyContext()
2275 } else if (Current.is(tok::semi) || in modifyContext()
2276 (Current.is(tok::exclaim) && Current.Previous && in modifyContext()
2289 if (Current->is(tok::l_paren)) in untilMatchingParen()
2291 if (Current->is(tok::r_paren)) in untilMatchingParen()
2302 if (Current.Previous && Current.Previous->is(tok::r_paren) && in isDeductionGuide()
2309 if (TemplateCloser->is(tok::l_paren)) { in isDeductionGuide()
2315 if (TemplateCloser->is(tok::less)) in isDeductionGuide()
2317 if (TemplateCloser->is(tok::greater)) in isDeductionGuide()
2326 TemplateCloser->Next->is(tok::semi) && in isDeductionGuide()
2347 Current.is(tok::exclaim)) { in determineTokenType()
2353 : Current.Previous->is(tok::identifier); in determineTokenType()
2375 Current.is(Keywords.kw_instanceof)) { in determineTokenType()
2381 } else if (Current.is(tok::semi)) { in determineTokenType()
2388 } else if (Current.is(tok::arrow) && in determineTokenType()
2391 } else if (Current.is(tok::arrow) && Style.isVerilog()) { in determineTokenType()
2394 } else if (Current.is(tok::arrow) && AutoFound && in determineTokenType()
2399 } else if (Current.is(tok::arrow) && Current.Previous && in determineTokenType()
2400 Current.Previous->is(tok::r_brace)) { in determineTokenType()
2413 (Style.isVerilog() && Current.is(tok::pipe))) { in determineTokenType()
2415 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
2421 } else if (Current.is(tok::question)) { in determineTokenType()
2438 if (Current.is(tok::lessequal) && Contexts.size() == 1 && in determineTokenType()
2449 } else if (Current.is(tok::comment)) { in determineTokenType()
2461 } else if (Current.is(tok::string_literal)) { in determineTokenType()
2469 } else if (Current.is(tok::l_paren)) { in determineTokenType()
2472 } else if (Current.is(tok::r_paren)) { in determineTokenType()
2484 BeforeParen && BeforeParen->is(tok::identifier) && in determineTokenType()
2494 } else if (Current.is(tok::at) && Current.Next && !Style.isJavaScript() && in determineTokenType()
2510 } else if (Current.is(tok::period)) { in determineTokenType()
2523 Current.Previous && Current.Previous->is(TT_CastRParen) && in determineTokenType()
2526 Current.Previous->MatchingParen->Previous->is( in determineTokenType()
2545 if (Current.Previous->is(tok::at) && in determineTokenType()
2549 if (!Previous || Previous->is(TT_LeadingJavaAnnotation)) in determineTokenType()
2553 } else if (Current.Previous->is(tok::period) && in determineTokenType()
2578 NextNonComment->is(tok::string_literal) || in isStartOfName()
2579 (Line.InPragmaDirective && NextNonComment->is(tok::identifier))))) { in isStartOfName()
2587 if (Style.isJavaScript() && Tok.Previous->is(Keywords.kw_in)) in isStartOfName()
2595 while (PreviousNotConst && PreviousNotConst->is(tok::kw_const)) in isStartOfName()
2613 bool IsPPKeyword = PreviousNotConst->is(tok::identifier) && in isStartOfName()
2615 PreviousNotConst->Previous->is(tok::hash); in isStartOfName()
2617 if (PreviousNotConst->is(TT_TemplateCloser)) { in isStartOfName()
2624 if ((PreviousNotConst->is(tok::r_paren) && in isStartOfName()
2625 PreviousNotConst->is(TT_TypeDeclarationParen)) || in isStartOfName()
2626 PreviousNotConst->is(TT_AttributeRParen)) { in isStartOfName()
2641 if (PreviousNotConst->is(TT_PointerOrReference)) in isStartOfName()
2650 PreviousNotConst->is(tok::r_square)) { in isStartOfName()
2655 return Style.isJavaScript() && PreviousNotConst->is(tok::kw_const); in isStartOfName()
2665 if (LeftOfParens && LeftOfParens->is(TT_TemplateCloser) && in lParenStartsCppCast()
2681 assert(Tok.is(tok::r_paren)); in rParenEndsCast()
2698 if (LParen->is(TT_OverloadedOperatorLParen)) in rParenEndsCast()
2705 if (LeftOfParens->is(tok::r_paren) && in rParenEndsCast()
2714 if (LeftOfParens->is(tok::r_square)) { in rParenEndsCast()
2737 LeftOfParens->Previous->is(tok::kw_operator)) { in rParenEndsCast()
2757 if (AfterRParen->is(tok::question) || in rParenEndsCast()
2758 (AfterRParen->is(tok::ampamp) && !BeforeRParen->isTypeName(LangOpts))) { in rParenEndsCast()
2763 if (AfterRParen->is(Keywords.kw_in) && Style.isCSharp()) in rParenEndsCast()
2777 if (Style.Language == FormatStyle::LK_Java && AfterRParen->is(tok::l_paren)) in rParenEndsCast()
2795 if (T->is(TT_AttributeRParen)) { in rParenEndsCast()
2797 assert(T->is(tok::r_paren)); in rParenEndsCast()
2799 assert(T->MatchingParen->is(tok::l_paren)); in rParenEndsCast()
2800 assert(T->MatchingParen->is(TT_AttributeLParen)); in rParenEndsCast()
2806 } else if (T->is(TT_AttributeSquare)) { in rParenEndsCast()
2818 return T && T->is(TT_PointerOrReference); in rParenEndsCast()
2838 if (Token->is(TT_BinaryOperator)) in rParenEndsCast()
2847 if (AfterRParen->is(tok::l_paren) && BeforeRParen->Previous) { in rParenEndsCast()
2848 if (BeforeRParen->is(tok::identifier) && in rParenEndsCast()
2849 BeforeRParen->Previous->is(tok::l_paren)) { in rParenEndsCast()
2857 if (AfterRParen->is(tok::l_brace) && in rParenEndsCast()
2867 AfterRParen->is(tok::plus) || in rParenEndsCast()
2873 (AfterRParen->Next->is(tok::numeric_constant) || Line.InPPDirective)) { in rParenEndsCast()
2877 if (Line.InPPDirective && AfterRParen->is(tok::minus)) in rParenEndsCast()
2882 if (Prev->is(tok::r_paren)) { in rParenEndsCast()
2883 if (Prev->is(TT_CastRParen)) in rParenEndsCast()
2888 if (Prev->is(TT_FunctionTypeLParen)) in rParenEndsCast()
2922 if (PrevToken->is(tok::kw_sizeof)) in determineUnaryOperatorByUsage()
2930 if (PrevToken->is(TT_BinaryOperator)) in determineUnaryOperatorByUsage()
2943 if (Style.isCSharp() && Tok.is(tok::ampamp)) in determineStarAmpUsage()
2951 if (Tok.is(tok::star)) in determineStarAmpUsage()
2960 if (PrevToken->is(TT_TypeName)) in determineStarAmpUsage()
2962 if (PrevToken->isOneOf(tok::kw_new, tok::kw_delete) && Tok.is(tok::ampamp)) in determineStarAmpUsage()
2967 if (InTemplateArgument && NextToken && NextToken->is(tok::kw_noexcept)) in determineStarAmpUsage()
2973 (NextToken->is(tok::kw_noexcept) && !IsExpression) || in determineStarAmpUsage()
2975 (NextToken->is(tok::l_brace) && !NextToken->getNextNonComment())) { in determineStarAmpUsage()
2979 if (PrevToken->is(tok::coloncolon)) in determineStarAmpUsage()
2982 if (PrevToken->is(tok::r_paren) && PrevToken->is(TT_TypeDeclarationParen)) in determineStarAmpUsage()
2988 if (NextToken->is(tok::l_square) && NextToken->isNot(TT_LambdaLSquare)) in determineStarAmpUsage()
2990 if (NextToken->is(tok::kw_operator) && !IsExpression) in determineStarAmpUsage()
3005 if (PrevToken->is(tok::r_brace) && Tok.is(tok::star) && in determineStarAmpUsage()
3020 while (NextNonParen && NextNonParen->is(tok::l_paren)) in determineStarAmpUsage()
3036 if (Tok.is(tok::ampamp) && in determineStarAmpUsage()
3045 if (NextNextToken && NextNextToken->is(tok::arrow)) in determineStarAmpUsage()
3066 if (Tok.is(tok::amp) && PrevToken && PrevToken->Tok.isAnyIdentifier() && in determineStarAmpUsage()
3071 (IsChainedOperatorAmpOrMember(NextNext) || NextNext->is(tok::semi))) { in determineStarAmpUsage()
3087 if (PrevToken->is(tok::at)) in determinePlusMinusCaretUsage()
3097 if (!PrevToken || PrevToken->is(TT_CastRParen)) in determineIncrementUsage()
3141 while (Current && (Current->is(tok::kw_return) || in parse()
3142 (Current->is(tok::colon) && in parse()
3187 Current->is(TT_SelectorName)) { in parse()
3199 if (Prev && Prev->is(tok::string_literal) && in parse()
3210 (Current->MatchingParen || Current->is(TT_TemplateString))) || in parse()
3213 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
3278 if (Current->is(TT_ConditionalExpr)) in getCurrentPrecedence()
3280 if (NextNonComment && Current->is(TT_SelectorName) && in getCurrentPrecedence()
3282 (Style.isProto() && NextNonComment->is(tok::less)))) { in getCurrentPrecedence()
3285 if (Current->is(TT_JsComputedPropertyName)) in getCurrentPrecedence()
3287 if (Current->is(TT_LambdaArrow)) in getCurrentPrecedence()
3289 if (Current->is(TT_FatArrow)) in getCurrentPrecedence()
3292 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
3293 NextNonComment->is(TT_SelectorName))) { in getCurrentPrecedence()
3296 if (Current->is(TT_RangeBasedForLoopColon)) in getCurrentPrecedence()
3299 Current->is(Keywords.kw_instanceof)) { in getCurrentPrecedence()
3306 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
3319 if (Style.isVerilog() && Current->is(tok::colon)) in getCurrentPrecedence()
3350 while (Current && Current->is(TT_UnaryOperator)) { in parseUnaryOperator()
3406 if (Tok->is(Keywords.kw_assign)) in verilogGroupDecl()
3419 if (Tok->is(tok::hash)) { in verilogGroupDecl()
3425 } else if (Tok->is(tok::hashhash)) { in verilogGroupDecl()
3442 } else if (Tok->is(tok::l_paren)) { in verilogGroupDecl()
3461 } else if (Tok->is(Keywords.kw_verilogHash)) { in verilogGroupDecl()
3463 if (Next->is(tok::l_paren)) in verilogGroupDecl()
3475 while (Tok && Tok->is(tok::l_square) && (Tok = Tok->MatchingParen)) in verilogGroupDecl()
3477 if (Tok && (Tok->is(tok::hash) || Keywords.isVerilogIdentifier(*Tok))) in verilogGroupDecl()
3485 if (First && First->is(TT_Unknown)) in verilogGroupDecl()
3495 if (TypedName->is(TT_Unknown)) in verilogGroupDecl()
3576 if (Tok->is(tok::l_square) && Tok->is(TT_AttributeSquare)) { in getFunctionName()
3585 if (Tok->is(tok::l_paren) && Tok->isNot(TT_FunctionTypeLParen) && in getFunctionName()
3600 if (Tok->is(tok::coloncolon)) { in getFunctionName()
3615 if (Tok->is(tok::tilde)) { in getFunctionName()
3633 assert(Tok && Tok->is(tok::identifier)); in isCtorOrDtorName()
3636 if (Prev && Prev->is(tok::tilde)) in isCtorOrDtorName()
3697 if (Current.is(TT_FunctionDeclarationName)) in isFunctionDeclarationName()
3706 PrevPrev && PrevPrev->is(TT_ObjCDecl)) { in isFunctionDeclarationName()
3713 if (Next->is(TT_OverloadedOperatorLParen)) in isFunctionDeclarationName()
3715 if (Next->is(TT_OverloadedOperator)) in isFunctionDeclarationName()
3730 if ((Next->isTypeName(LangOpts) || Next->is(tok::identifier)) && in isFunctionDeclarationName()
3736 if (Next->is(TT_TemplateOpener) && Next->MatchingParen) { in isFunctionDeclarationName()
3750 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
3755 if (Previous.is(tok::r_paren) && Previous.is(TT_TypeDeclarationParen)) { in isFunctionDeclarationName()
3757 assert(Previous.MatchingParen->is(tok::l_paren)); in isFunctionDeclarationName()
3758 assert(Previous.MatchingParen->is(TT_TypeDeclarationParen)); in isFunctionDeclarationName()
3768 if (Next->is(TT_TemplateOpener) && Next->MatchingParen) { in isFunctionDeclarationName()
3770 } else if (Next->is(tok::coloncolon)) { in isFunctionDeclarationName()
3774 if (Next->is(tok::kw_operator)) { in isFunctionDeclarationName()
3784 } else if (Next->is(tok::l_paren)) { in isFunctionDeclarationName()
3796 assert(ClosingParen->is(tok::r_paren)); in isFunctionDeclarationName()
3798 if (Line.Last->is(tok::l_brace)) in isFunctionDeclarationName()
3803 if (ClosingParen->Next && ClosingParen->Next->is(TT_PointerOrReference)) in isFunctionDeclarationName()
3816 if (IsCpp && Next->Next && Next->Next->is(tok::identifier) && in isFunctionDeclarationName()
3823 if (Tok->is(TT_TypeDeclarationParen)) in isFunctionDeclarationName()
3829 if (Tok->is(tok::kw_const) || Tok->isTypeName(LangOpts) || in isFunctionDeclarationName()
3886 if (Tok->is(TT_StartOfName)) in calculateFormattingInformation()
3890 if (const bool IsCtorOrDtor = Tok->is(TT_CtorDtorDeclName); in calculateFormattingInformation()
3900 if (OpeningParen->is(TT_Unknown)) in calculateFormattingInformation()
3907 if (IsCpp && (LineIsFunctionDeclaration || First->is(TT_CtorDtorDeclName)) && in calculateFormattingInformation()
3913 assert(LBrace->is(tok::l_brace)); in calculateFormattingInformation()
3946 Next->Next->is(tok::identifier); in calculateFormattingInformation()
3955 if (Tok->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
3957 if (Tok->is(tok::arrow)) { in calculateFormattingInformation()
3975 if (Current->is(TT_LineComment)) { in calculateFormattingInformation()
3976 if (Prev->is(BK_BracedInit) && Prev->opensScope()) { in calculateFormattingInformation()
3981 } else if (Prev->is(TT_VerilogMultiLineListLParen)) { in calculateFormattingInformation()
3999 if (Parameter->Previous && Parameter->Previous->is(tok::comma)) { in calculateFormattingInformation()
4014 if (!Children.empty() && Children.back()->Last->is(TT_LineComment)) { in calculateFormattingInformation()
4020 Current->is(TT_FunctionDeclarationName)) { in calculateFormattingInformation()
4043 if (Current->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
4057 Current->is(TT_SelectorName) && Current->ParameterIndex > 0) { in calculateFormattingInformation()
4110 if (CurrentToken->is(tok::l_brace)) { in calculateArrayInitializerColumnList()
4125 if (CurrentToken->is(tok::l_brace)) in calculateInitializerColumnList()
4127 else if (CurrentToken->is(tok::r_brace)) in calculateInitializerColumnList()
4147 if (Left.is(tok::semi)) in splitPenalty()
4154 if (Right.is(Keywords.kw_implements)) in splitPenalty()
4156 if (Left.is(tok::comma) && Left.NestingLevel == 0) in splitPenalty()
4159 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
4161 if (Left.is(TT_JsTypeColon)) in splitPenalty()
4163 if ((Left.is(TT_TemplateString) && Left.TokenText.ends_with("${")) || in splitPenalty()
4164 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) { in splitPenalty()
4171 if (Right.is(tok::l_square)) in splitPenalty()
4173 if (Right.is(tok::period)) in splitPenalty()
4177 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in splitPenalty()
4179 if (Right.is(tok::l_square)) { in splitPenalty()
4180 if (Left.is(tok::r_square)) in splitPenalty()
4183 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
4192 if (Left.is(tok::coloncolon)) in splitPenalty()
4195 Right.is(tok::kw_operator)) { in splitPenalty()
4198 if (Left.is(TT_StartOfName)) in splitPenalty()
4204 if (Right.is(TT_PointerOrReference)) in splitPenalty()
4206 if (Right.is(TT_LambdaArrow)) in splitPenalty()
4208 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
4210 if (Left.is(TT_CastRParen)) in splitPenalty()
4214 if (Left.is(tok::comment)) in splitPenalty()
4247 if (Right.is(TT_TrailingAnnotation) && in splitPenalty()
4259 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0); in splitPenalty()
4263 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
4268 if (Right.is(TT_SelectorName)) in splitPenalty()
4270 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) in splitPenalty()
4276 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
4281 if (Left.is(tok::l_paren) && Style.PenaltyBreakOpenParenthesis != 0) in splitPenalty()
4283 if (Left.is(tok::l_paren) && InFunctionDecl && in splitPenalty()
4287 if (Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
4292 if (Left.is(tok::equal) && InFunctionDecl) in splitPenalty()
4294 if (Right.is(tok::r_brace)) in splitPenalty()
4296 if (Left.is(TT_TemplateOpener)) in splitPenalty()
4306 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle) in splitPenalty()
4311 if (Left.is(TT_JavaAnnotation)) in splitPenalty()
4314 if (Left.is(TT_UnaryOperator)) in splitPenalty()
4321 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
4325 if (Left.is(tok::comma)) in splitPenalty()
4327 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
4331 if (Right.is(tok::lessless)) { in splitPenalty()
4343 if (Left.is(TT_ConditionalExpr)) in splitPenalty()
4359 if (Right.is(TT_OverloadedOperatorLParen) && in spaceRequiredBeforeParens()
4373 if (Left.is(tok::kw_return) && in spaceRequiredBetween()
4377 if (Left.is(tok::kw_throw) && Right.is(tok::l_paren) && Right.MatchingParen && in spaceRequiredBetween()
4378 Right.MatchingParen->is(TT_CastRParen)) { in spaceRequiredBetween()
4381 if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java) in spaceRequiredBetween()
4387 if (Right.is(tok::hashhash)) in spaceRequiredBetween()
4388 return Left.is(tok::hash); in spaceRequiredBetween()
4390 return Right.is(tok::hash); in spaceRequiredBetween()
4391 if (Left.is(BK_Block) && Right.is(tok::r_brace) && in spaceRequiredBetween()
4395 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) || in spaceRequiredBetween()
4396 (Left.is(tok::l_brace) && Left.isNot(BK_Block) && in spaceRequiredBetween()
4397 Right.is(tok::r_brace) && Right.isNot(BK_Block))) { in spaceRequiredBetween()
4402 Left.is(tok::r_paren) && Right.is(tok::r_paren)) { in spaceRequiredBetween()
4411 if (Left.is(tok::l_paren)) in spaceRequiredBetween()
4413 else if (Right.is(tok::r_paren) && Right.MatchingParen) in spaceRequiredBetween()
4416 if (LeftParen->is(TT_ConditionLParen)) in spaceRequiredBetween()
4424 if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace, in spaceRequiredBetween()
4431 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace)) in spaceRequiredBetween()
4437 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && BeforeLeft && in spaceRequiredBetween()
4438 BeforeLeft->is(tok::kw_operator)) { in spaceRequiredBetween()
4447 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { in spaceRequiredBetween()
4448 return (Right.is(TT_CastRParen) || in spaceRequiredBetween()
4449 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) in spaceRequiredBetween()
4455 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) { in spaceRequiredBetween()
4458 Right.MatchingParen->Next->is(tok::colon); in spaceRequiredBetween()
4461 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
4465 if (Left.is(tok::at) && in spaceRequiredBetween()
4471 if (Left.is(tok::colon)) in spaceRequiredBetween()
4473 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
4475 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
4478 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
4480 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
4488 if (Right.is(tok::ellipsis)) { in spaceRequiredBetween()
4489 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && BeforeLeft && in spaceRequiredBetween()
4490 BeforeLeft->is(tok::kw_case)); in spaceRequiredBetween()
4492 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
4494 if (Right.is(TT_PointerOrReference)) { in spaceRequiredBetween()
4495 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { in spaceRequiredBetween()
4508 (Left.is(TT_AttributeRParen) || in spaceRequiredBetween()
4516 Right.Next->Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
4527 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
4533 if (Left.is(TT_PointerOrReference)) { in spaceRequiredBetween()
4545 if (Right.is(TT_BlockComment)) in spaceRequiredBetween()
4555 if (Right.is(tok::l_brace) && Right.is(BK_Block)) in spaceRequiredBetween()
4559 Right.Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
4583 if (BeforeLeft->is(tok::coloncolon)) { in spaceRequiredBetween()
4596 if (Left.is(tok::ellipsis) && BeforeLeft && in spaceRequiredBetween()
4601 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
4603 if (Left.is(tok::star) && Right.isPointerOrReference()) in spaceRequiredBetween()
4608 if (Previous->is(tok::identifier) || Previous->isTypeName(LangOpts)) { in spaceRequiredBetween()
4612 if (Previous->is(TT_TemplateCloser) && Previous->MatchingParen) { in spaceRequiredBetween()
4616 if (Previous->is(tok::coloncolon)) { in spaceRequiredBetween()
4637 if (Previous->is(tok::kw_const) || Previous->is(tok::kw_volatile)) { in spaceRequiredBetween()
4645 if (Style.isCSharp() && Left.is(Keywords.kw_is) && Right.is(tok::l_square)) in spaceRequiredBetween()
4654 if (Left.is(tok::l_square)) { in spaceRequiredBetween()
4655 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
4661 if (Right.is(tok::r_square)) { in spaceRequiredBetween()
4663 ((Right.MatchingParen->is(TT_ArrayInitializerLSquare) && in spaceRequiredBetween()
4671 if (Right.is(tok::l_square) && in spaceRequiredBetween()
4677 Right.is(TT_ArraySubscriptLSquare))) { in spaceRequiredBetween()
4680 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
4682 if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) || in spaceRequiredBetween()
4683 (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
4687 if (Left.is(TT_BlockComment)) { in spaceRequiredBetween()
4694 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare)) in spaceRequiredBetween()
4697 if (Right.is(tok::l_paren)) { in spaceRequiredBetween()
4698 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen)) in spaceRequiredBetween()
4705 if (Left.is(TT_RequiresExpression)) { in spaceRequiredBetween()
4709 if (Left.is(TT_AttributeRParen) || in spaceRequiredBetween()
4710 (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) { in spaceRequiredBetween()
4713 if (Left.is(TT_ForEachMacro)) { in spaceRequiredBetween()
4717 if (Left.is(TT_IfMacro)) { in spaceRequiredBetween()
4724 !(Line.MightBeFunctionDecl && Left.is(TT_FunctionDeclarationName))) { in spaceRequiredBetween()
4729 if (Left.is(tok::semi)) in spaceRequiredBetween()
4734 Right.is(TT_ConditionLParen)) { in spaceRequiredBetween()
4741 if (Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBetween()
4744 if (Line.MightBeFunctionDecl && Right.is(TT_FunctionDeclarationLParen)) { in spaceRequiredBetween()
4753 if (Line.Type != LT_PreprocessorDirective && Left.is(tok::r_square) && in spaceRequiredBetween()
4754 Left.MatchingParen && Left.MatchingParen->is(TT_LambdaLSquare)) { in spaceRequiredBetween()
4769 if (Left.is(tok::r_square) && Left.MatchingParen && in spaceRequiredBetween()
4771 Left.MatchingParen->Previous->is(tok::kw_delete)) { in spaceRequiredBetween()
4778 (Left.Tok.getIdentifierInfo() || Left.is(tok::r_paren))) { in spaceRequiredBetween()
4783 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
4785 if (Right.is(TT_UnaryOperator)) { in spaceRequiredBetween()
4797 Right.is(tok::l_brace) && Right.getNextNonComment() && in spaceRequiredBetween()
4801 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
4805 if (Right.is(tok::hash) && Left.is(tok::identifier) && in spaceRequiredBetween()
4812 if (Left.is(TT_TemplateCloser) && Left.MatchingParen && in spaceRequiredBetween()
4814 (Left.MatchingParen->Previous->is(tok::period) || in spaceRequiredBetween()
4815 Left.MatchingParen->Previous->is(tok::coloncolon))) { in spaceRequiredBetween()
4821 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
4823 if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) { in spaceRequiredBetween()
4827 if (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
4832 if (Right.is(TT_TrailingAnnotation) && Right.isOneOf(tok::amp, tok::ampamp) && in spaceRequiredBetween()
4834 (!Right.Next || Right.Next->is(tok::semi))) { in spaceRequiredBetween()
4864 if (Left.is(tok::star) && Right.is(tok::comment)) in spaceRequiredBefore()
4868 if (Left.is(TT_OverloadedOperator) && in spaceRequiredBefore()
4873 if (Right.is(tok::period) && Left.is(tok::numeric_constant)) in spaceRequiredBefore()
4877 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis)) in spaceRequiredBefore()
4881 Right.is(TT_ModulePartitionColon)) { in spaceRequiredBefore()
4885 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon)) in spaceRequiredBefore()
4888 if (Left.is(TT_ModulePartitionColon) && in spaceRequiredBefore()
4892 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) && in spaceRequiredBefore()
4893 Line.First->is(Keywords.kw_import)) { in spaceRequiredBefore()
4898 Right.is(tok::coloncolon)) { in spaceRequiredBefore()
4902 if (Left.is(tok::kw_operator)) in spaceRequiredBefore()
4903 return Right.is(tok::coloncolon); in spaceRequiredBefore()
4904 if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) && in spaceRequiredBefore()
4908 if (Left.is(tok::less) && Left.is(TT_OverloadedOperator) && in spaceRequiredBefore()
4909 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
4913 if (Left.is(tok::identifier) && Right.is(tok::numeric_constant)) in spaceRequiredBefore()
4919 if (Right.is(tok::period) && in spaceRequiredBefore()
4924 if (Right.is(tok::l_paren) && in spaceRequiredBefore()
4928 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
4931 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
4934 Left.MatchingParen->is(TT_ProtoExtensionLSquare) && in spaceRequiredBefore()
4939 if (Left.is(tok::percent)) in spaceRequiredBefore()
4943 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
4946 if (Right.is(tok::colon) && Left.is(tok::string_literal)) in spaceRequiredBefore()
4954 if (Left.is(tok::kw_this) && Right.is(tok::l_square)) in spaceRequiredBefore()
4958 if (Left.is(tok::kw_new) && Right.is(tok::l_paren)) in spaceRequiredBefore()
4962 if (Right.is(tok::l_brace)) in spaceRequiredBefore()
4966 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace)) in spaceRequiredBefore()
4969 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBefore()
4973 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow)) in spaceRequiredBefore()
4977 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon)) in spaceRequiredBefore()
4981 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName)) in spaceRequiredBefore()
4985 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
4989 if (Right.is(TT_CSharpNullable)) in spaceRequiredBefore()
4993 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
4997 if (Left.is(tok::comma) && Right.is(tok::comma)) in spaceRequiredBefore()
5001 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren)) in spaceRequiredBefore()
5005 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
5020 Right.is(tok::l_paren)) { in spaceRequiredBefore()
5024 if (Left.is(TT_FatArrow)) in spaceRequiredBefore()
5027 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
5028 Left.Previous->is(tok::kw_for)) { in spaceRequiredBefore()
5031 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
5036 if (Next && Next->is(TT_FatArrow)) in spaceRequiredBefore()
5039 if ((Left.is(TT_TemplateString) && Left.TokenText.ends_with("${")) || in spaceRequiredBefore()
5040 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) { in spaceRequiredBefore()
5047 Right.is(TT_TemplateString)) { in spaceRequiredBefore()
5050 if (Right.is(tok::star) && in spaceRequiredBefore()
5059 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
5065 if (Left.Previous && Left.Previous->is(tok::period) && in spaceRequiredBefore()
5083 (Left.is(Keywords.kw_of) && Left.Previous && in spaceRequiredBefore()
5084 (Left.Previous->is(tok::identifier) || in spaceRequiredBefore()
5090 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
5093 if (Left.is(Keywords.kw_as) && in spaceRequiredBefore()
5097 if (Left.is(tok::kw_default) && Left.Previous && in spaceRequiredBefore()
5098 Left.Previous->is(tok::kw_export)) { in spaceRequiredBefore()
5101 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
5105 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
5107 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
5111 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
5113 if (Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
5121 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
5123 if (Left.is(TT_NonNullAssertion) && in spaceRequiredBefore()
5128 if (Left.is(TT_CaseLabelArrow) || Right.is(TT_CaseLabelArrow)) in spaceRequiredBefore()
5130 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
5133 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
5136 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
5143 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
5148 if (Left.is(tok::identifier) && Left.TokenText[0] == '\\') in spaceRequiredBefore()
5152 if ((Left.is(TT_VerilogTableItem) && in spaceRequiredBefore()
5154 (Right.is(TT_VerilogTableItem) && Left.isNot(tok::l_paren))) { in spaceRequiredBefore()
5156 return !(Next && Next->is(tok::r_paren)); in spaceRequiredBefore()
5168 (Left.is(tok::r_paren) && Left.MatchingParen && in spaceRequiredBefore()
5174 if (Left.is(Keywords.kw_apostrophe) || in spaceRequiredBefore()
5175 (Left.is(TT_VerilogNumberBase) && Right.is(tok::numeric_constant))) { in spaceRequiredBefore()
5179 if (Left.is(tok::arrow) || Right.is(tok::arrow)) in spaceRequiredBefore()
5184 if (Left.is(tok::at) && Right.isOneOf(tok::l_paren, tok::star, tok::at)) in spaceRequiredBefore()
5187 if (Right.is(tok::l_square) && in spaceRequiredBefore()
5194 Left.getPreviousNonComment()->is(Keywords.kw_tagged)) { in spaceRequiredBefore()
5200 if ((Right.is(Keywords.kw_apostrophe) || in spaceRequiredBefore()
5201 (Right.is(BK_BracedInit) && Right.is(tok::l_brace))) && in spaceRequiredBefore()
5210 if ((Right.is(tok::star) && Left.is(tok::coloncolon)) || in spaceRequiredBefore()
5211 (Left.is(tok::star) && Right.is(tok::semi))) { in spaceRequiredBefore()
5215 if (Left.endsSequence(tok::star, tok::l_paren) && Right.is(tok::identifier)) in spaceRequiredBefore()
5218 if (Right.is(tok::l_paren) && Right.is(TT_VerilogStrength)) in spaceRequiredBefore()
5221 if ((Left.is(tok::l_brace) && in spaceRequiredBefore()
5229 if (Left.is(tok::l_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
5231 if (Left.is(tok::r_brace) && Right.is(tok::r_square)) in spaceRequiredBefore()
5240 if (Right.is(TT_TableGenCondOperatorColon)) in spaceRequiredBefore()
5254 if (Left.is(TT_TableGenTrailingPasteOperator) && in spaceRequiredBefore()
5259 if (Left.is(tok::hash) || Right.is(tok::hash)) in spaceRequiredBefore()
5266 if (Left.is(TT_ImplicitStringLiteral)) in spaceRequiredBefore()
5269 if (Left.is(TT_ObjCMethodSpecifier)) in spaceRequiredBefore()
5271 if (Left.is(tok::r_paren) && Left.isNot(TT_AttributeRParen) && in spaceRequiredBefore()
5280 (Right.is(tok::equal) || Left.is(tok::equal))) { in spaceRequiredBefore()
5288 if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) && in spaceRequiredBefore()
5294 if (Right.is(tok::comma)) in spaceRequiredBefore()
5296 if (Right.is(TT_ObjCBlockLParen)) in spaceRequiredBefore()
5298 if (Right.is(TT_CtorInitializerColon)) in spaceRequiredBefore()
5300 if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon) in spaceRequiredBefore()
5302 if (Right.is(TT_RangeBasedForLoopColon) && in spaceRequiredBefore()
5306 if (Left.is(TT_BitFieldColon)) { in spaceRequiredBefore()
5310 if (Right.is(tok::colon)) { in spaceRequiredBefore()
5311 if (Right.is(TT_CaseLabelColon)) in spaceRequiredBefore()
5313 if (Right.is(TT_GotoLabelColon)) in spaceRequiredBefore()
5318 if (Right.is(TT_ObjCMethodExpr)) in spaceRequiredBefore()
5320 if (Left.is(tok::question)) in spaceRequiredBefore()
5322 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
5324 if (Right.is(TT_DictLiteral)) in spaceRequiredBefore()
5326 if (Right.is(TT_AttributeColon)) in spaceRequiredBefore()
5328 if (Right.is(TT_CSharpNamedArgumentColon)) in spaceRequiredBefore()
5330 if (Right.is(TT_GenericSelectionColon)) in spaceRequiredBefore()
5332 if (Right.is(TT_BitFieldColon)) { in spaceRequiredBefore()
5345 if (Left.is(TT_UnaryOperator)) { in spaceRequiredBefore()
5348 if (Left.is(tok::amp) && Right.is(tok::r_square)) in spaceRequiredBefore()
5350 return Style.SpaceAfterLogicalNot && Left.is(tok::exclaim); in spaceRequiredBefore()
5355 if (Left.is(TT_CastRParen)) { in spaceRequiredBefore()
5368 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
5370 (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) { in spaceRequiredBefore()
5373 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
5379 (Right.is(tok::period) && Right.isNot(TT_DesignatedInitializerPeriod))) { in spaceRequiredBefore()
5386 if (Style.Language == FormatStyle::LK_Java && Right.is(tok::coloncolon) && in spaceRequiredBefore()
5387 (Left.is(tok::identifier) || Left.is(tok::kw_this))) { in spaceRequiredBefore()
5390 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) { in spaceRequiredBefore()
5396 if (Right.is(tok::coloncolon) && in spaceRequiredBefore()
5399 return (Left.is(TT_TemplateOpener) && in spaceRequiredBefore()
5405 (Left.is(tok::l_paren) && Style.SpacesInParensOptions.Other); in spaceRequiredBefore()
5407 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
5410 if (Right.is(TT_StructuredBindingLSquare)) { in spaceRequiredBefore()
5415 if (Right.Next && Right.Next->is(TT_StructuredBindingLSquare) && in spaceRequiredBefore()
5419 if ((Right.is(TT_BinaryOperator) && Left.isNot(tok::l_paren)) || in spaceRequiredBefore()
5424 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
5426 Left.MatchingParen->is(TT_OverloadedOperatorLParen)) { in spaceRequiredBefore()
5429 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
5433 if (Right.is(TT_TrailingUnaryOperator)) in spaceRequiredBefore()
5435 if (Left.is(TT_RegexLiteral)) in spaceRequiredBefore()
5442 return Tok.is(tok::l_brace) && Tok.is(BK_Block) && in isAllmanBrace()
5459 return Tok.is(tok::l_brace) && Tok.is(BK_Block) && in isAllmanLambdaBrace()
5479 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) && in mustBreakBefore()
5483 if (Right.is(TT_CSharpNamedArgumentColon) || in mustBreakBefore()
5484 Left.is(TT_CSharpNamedArgumentColon)) { in mustBreakBefore()
5487 if (Right.is(TT_CSharpGenericTypeConstraint)) in mustBreakBefore()
5489 if (AfterRight && AfterRight->is(TT_FatArrow) && in mustBreakBefore()
5490 (Right.is(tok::numeric_constant) || in mustBreakBefore()
5491 (Right.is(tok::identifier) && Right.TokenText == "_"))) { in mustBreakBefore()
5496 if (Left.is(TT_AttributeSquare) && Left.is(tok::r_square) && in mustBreakBefore()
5498 Right.is(Keywords.kw_internal))) { in mustBreakBefore()
5502 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) && in mustBreakBefore()
5503 Left.is(tok::r_square) && Right.is(tok::l_square)) { in mustBreakBefore()
5508 if (Right.is(tok::string_literal) && Left.is(tok::plus) && BeforeLeft && in mustBreakBefore()
5509 BeforeLeft->is(tok::string_literal)) { in mustBreakBefore()
5512 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
5513 BeforeLeft && BeforeLeft->is(tok::equal) && in mustBreakBefore()
5523 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
5532 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && BeforeLeft && in mustBreakBefore()
5533 BeforeLeft->is(TT_FatArrow)) { in mustBreakBefore()
5551 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
5561 if (Right.is(tok::plus) && Left.is(tok::string_literal) && AfterRight && in mustBreakBefore()
5562 AfterRight->is(tok::string_literal)) { in mustBreakBefore()
5567 if (Left.is(TT_VerilogAssignComma)) in mustBreakBefore()
5570 if (Left.is(TT_VerilogTypeComma)) in mustBreakBefore()
5575 (Left.is(TT_VerilogInstancePortComma) || in mustBreakBefore()
5576 (Left.is(tok::r_paren) && Keywords.isVerilogIdentifier(Right) && in mustBreakBefore()
5578 Left.MatchingParen->is(TT_VerilogInstancePortLParen)))) { in mustBreakBefore()
5597 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace)) in mustBreakBefore()
5600 if ((Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) && in mustBreakBefore()
5602 Left.is(tok::comma)) { in mustBreakBefore()
5603 if (Right.is(tok::l_brace)) in mustBreakBefore()
5619 if (Left.is(TT_TableGenCondOperatorComma)) in mustBreakBefore()
5621 if (Left.is(TT_TableGenDAGArgOperatorToBreak) && in mustBreakBefore()
5625 if (Left.is(TT_TableGenDAGArgListCommaToBreak)) in mustBreakBefore()
5627 if (Right.is(TT_TableGenDAGArgCloser) && Right.MatchingParen && in mustBreakBefore()
5628 Right.MatchingParen->is(TT_TableGenDAGArgOpenerToBreak) && in mustBreakBefore()
5635 if (Line.startsWith(tok::kw_asm) && Right.is(TT_InlineASMColon) && in mustBreakBefore()
5647 (Style.isJavaScript() && Left.is(tok::l_paren))) && in mustBreakBefore()
5654 Right.MatchingParen->is(tok::l_paren)))) { in mustBreakBefore()
5657 if (BeforeClosingBrace && (BeforeClosingBrace->is(tok::comma) || in mustBreakBefore()
5663 if (Right.is(tok::comment)) { in mustBreakBefore()
5672 if (BeforeLeft && BeforeLeft->is(tok::lessless) && in mustBreakBefore()
5673 Left.is(tok::string_literal) && Right.is(tok::lessless) && AfterRight && in mustBreakBefore()
5674 AfterRight->is(tok::string_literal)) { in mustBreakBefore()
5678 if (Right.is(TT_RequiresClause)) { in mustBreakBefore()
5693 if (Right.is(tok::kw_concept)) in mustBreakBefore()
5710 (Left.is(TT_CtorInitializerComma) || in mustBreakBefore()
5711 Right.is(TT_CtorInitializerColon))) { in mustBreakBefore()
5728 Right.is(TT_CtorInitializerColon)) { in mustBreakBefore()
5733 Left.is(TT_CtorInitializerColon)) { in mustBreakBefore()
5739 Right.is(TT_InheritanceComma)) { in mustBreakBefore()
5743 Left.is(TT_InheritanceComma)) { in mustBreakBefore()
5746 if (Right.is(tok::string_literal) && Right.TokenText.starts_with("R\"")) { in mustBreakBefore()
5752 if ((Left.is(tok::l_brace) || in mustBreakBefore()
5753 (Left.is(tok::less) && BeforeLeft && BeforeLeft->is(tok::equal))) && in mustBreakBefore()
5759 if (Right.is(TT_InlineASMBrace)) in mustBreakBefore()
5765 FirstNonComment && (FirstNonComment->is(Keywords.kw_internal) || in mustBreakBefore()
5775 FirstNonComment->Next->is(tok::kw_enum)) { in mustBreakBefore()
5783 FirstNonComment->Next->is(Keywords.kw_interface)) || in mustBreakBefore()
5797 if (Left.is(TT_ObjCBlockLBrace) && in mustBreakBefore()
5804 Right.is(TT_ObjCDecl)) { in mustBreakBefore()
5808 if (Left.is(TT_LambdaLBrace)) { in mustBreakBefore()
5822 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) && in mustBreakBefore()
5823 (Left.isPointerOrReference() || Left.is(TT_TemplateCloser))) { in mustBreakBefore()
5829 Left.is(TT_LeadingJavaAnnotation) && in mustBreakBefore()
5831 (Line.Last->is(tok::l_brace) || Style.BreakAfterJavaFieldAnnotations)) { in mustBreakBefore()
5835 if (Right.is(TT_ProtoExtensionLSquare)) in mustBreakBefore()
5865 if (Style.isProto() && Right.is(TT_SelectorName) && in mustBreakBefore()
5869 if (Left.is(tok::at)) in mustBreakBefore()
5876 if (LBrace && LBrace->is(tok::colon)) { in mustBreakBefore()
5878 if (LBrace && LBrace->is(tok::at)) { in mustBreakBefore()
5893 ((LBrace->is(tok::l_brace) && in mustBreakBefore()
5894 (LBrace->is(TT_DictLiteral) || in mustBreakBefore()
5895 (LBrace->Next && LBrace->Next->is(tok::r_brace)))) || in mustBreakBefore()
5896 LBrace->is(TT_ArrayInitializerLSquare) || LBrace->is(tok::less))) { in mustBreakBefore()
5935 if (Line.First->is(TT_CSharpGenericTypeConstraint)) in canBreakBefore()
5936 return Left.is(TT_CSharpGenericTypeConstraintComma); in canBreakBefore()
5938 if (Right.is(TT_CSharpNullable)) in canBreakBefore()
5967 if (NonComment && NonComment->is(tok::identifier) && in canBreakBefore()
5971 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
5973 if (Left.is(TT_JsTypeColon)) in canBreakBefore()
5976 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
5981 if (Right.is(Keywords.kw_is)) { in canBreakBefore()
5993 if (Left.is(Keywords.kw_in)) in canBreakBefore()
5995 if (Right.is(Keywords.kw_in)) in canBreakBefore()
5997 if (Right.is(Keywords.kw_as)) in canBreakBefore()
6005 if (Left.is(Keywords.kw_as)) in canBreakBefore()
6007 if (Left.is(TT_NonNullAssertion)) in canBreakBefore()
6009 if (Left.is(Keywords.kw_declare) && in canBreakBefore()
6022 if (Right.is(TT_TemplateString) && Right.closesScope()) in canBreakBefore()
6026 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) in canBreakBefore()
6028 if (Left.is(TT_TemplateString) && Left.opensScope()) in canBreakBefore()
6035 if (Right.is(tok::l_paren)) { in canBreakBefore()
6040 if (Left.is(TT_TableGenValueSuffix)) in canBreakBefore()
6043 if (Left.is(tok::hash) || Right.is(tok::hash)) in canBreakBefore()
6049 if (Left.is(tok::at)) in canBreakBefore()
6055 if (Right.is(TT_PointerOrReference)) { in canBreakBefore()
6062 Right.is(tok::kw_operator)) { in canBreakBefore()
6065 if (Left.is(TT_PointerOrReference)) in canBreakBefore()
6073 return Left.is(BK_BracedInit) || in canBreakBefore()
6074 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 && in canBreakBefore()
6077 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
6079 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question)) in canBreakBefore()
6081 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
6083 if (Left.is(TT_InheritanceColon)) in canBreakBefore()
6085 if (Right.is(TT_InheritanceColon)) in canBreakBefore()
6087 if (Right.is(TT_ObjCMethodExpr) && Right.isNot(tok::r_square) && in canBreakBefore()
6092 if (Right.is(tok::colon) && in canBreakBefore()
6096 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) { in canBreakBefore()
6124 if (((Right.is(tok::l_brace) || Right.is(tok::less)) && in canBreakBefore()
6125 Right.is(TT_DictLiteral)) || in canBreakBefore()
6126 Right.is(TT_ArrayInitializerLSquare)) { in canBreakBefore()
6132 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
6133 Right.MatchingParen->is(TT_ProtoExtensionLSquare)) { in canBreakBefore()
6136 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next && in canBreakBefore()
6137 Right.Next->is(TT_ObjCMethodExpr))) { in canBreakBefore()
6140 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
6142 if (Right.is(tok::kw_concept)) in canBreakBefore()
6144 if (Right.is(TT_RequiresClause)) in canBreakBefore()
6150 if (Left.is(TT_FunctionAnnotationRParen)) in canBreakBefore()
6158 if (Left.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
6160 if (Right.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
6162 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) in canBreakBefore()
6164 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
6165 (Left.is(tok::less) && Right.is(tok::less))) { in canBreakBefore()
6168 if (Right.is(TT_BinaryOperator) && in canBreakBefore()
6175 Left.is(tok::kw_operator)) { in canBreakBefore()
6178 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
6182 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
6186 if (Left.is(TT_AttributeLParen) || in canBreakBefore()
6187 (Left.is(tok::l_paren) && Left.is(TT_TypeDeclarationParen))) { in canBreakBefore()
6190 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
6194 if (Right.is(TT_ImplicitStringLiteral)) in canBreakBefore()
6197 if (Right.is(TT_TemplateCloser)) in canBreakBefore()
6199 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
6200 Right.MatchingParen->is(TT_LambdaLSquare)) { in canBreakBefore()
6206 if (Right.is(tok::r_brace)) { in canBreakBefore()
6207 return Right.MatchingParen && (Right.MatchingParen->is(BK_Block) || in canBreakBefore()
6212 if (Right.is(tok::r_paren)) { in canBreakBefore()
6218 if (Next && Next->is(tok::r_paren)) in canBreakBefore()
6220 if (Next && Next->is(tok::l_paren)) in canBreakBefore()
6223 return !(Previous && (Previous->is(tok::kw_for) || Previous->isIf())); in canBreakBefore()
6228 if (Left.is(TT_TrailingAnnotation)) { in canBreakBefore()
6236 if (Right.is(tok::l_square) && Right.is(TT_AttributeSquare)) in canBreakBefore()
6239 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
6242 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in canBreakBefore()
6245 if (Left.is(TT_CtorInitializerColon)) { in canBreakBefore()
6249 if (Right.is(TT_CtorInitializerColon)) in canBreakBefore()
6251 if (Left.is(TT_CtorInitializerComma) && in canBreakBefore()
6255 if (Right.is(TT_CtorInitializerComma) && in canBreakBefore()
6259 if (Left.is(TT_InheritanceComma) && in canBreakBefore()
6263 if (Right.is(TT_InheritanceComma) && in canBreakBefore()
6267 if (Left.is(TT_ArrayInitializerLSquare)) in canBreakBefore()
6269 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
6271 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && in canBreakBefore()
6278 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
6279 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
6284 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace)) { in canBreakBefore()
6291 if (Right.is(tok::kw_noexcept) && Right.is(TT_TrailingAnnotation)) { in canBreakBefore()
6298 return Right.Next && Right.Next->is(tok::l_paren); in canBreakBefore()
6307 (Left.is(tok::r_paren) && in canBreakBefore()
6309 (Left.is(tok::l_paren) && Right.isNot(tok::r_paren)) || in canBreakBefore()
6310 (Left.is(TT_TemplateOpener) && Right.isNot(TT_TemplateCloser)); in canBreakBefore()
6371 assert(PointerOrReference.is(tok::star)); in getTokenPointerOrReferenceAlignment()