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()
159 if (Previous.Previous->is(tok::r_brace)) in parseAngle()
161 if (Previous.Previous->is(tok::r_paren) && Contexts.size() > 1 && in parseAngle()
167 if (Previous.Previous->is(tok::kw_operator) && in parseAngle()
168 CurrentToken->is(tok::l_paren)) { in parseAngle()
188 CurrentToken->is(tok::question)) { in parseAngle()
193 if (CurrentToken->is(tok::greater)) { in parseAngle()
200 if (CurrentToken->Next && CurrentToken->Next->is(tok::greater) && in parseAngle()
227 if (CurrentToken->is(tok::question) && in parseAngle()
244 CurrentToken->Previous->is(TT_BinaryOperator) && in parseAngle()
252 if (CurrentToken->is(tok::colon) || in parseAngle()
291 assert(OpeningParen.is(tok::l_paren)); in parseParens()
301 OpeningParen.Previous->is(TT_UntouchableMacroFunc)) { in parseParens()
311 MaybeSel->Previous && MaybeSel->Previous->is(tok::at)) { in parseParens()
317 if (OpeningParen.is(TT_OverloadedOperatorLParen)) { in parseParens()
331 } else if (OpeningParen.is(TT_VerilogInstancePortLParen)) { in parseParens()
350 (OpeningParen.Previous->is(Keywords.kw_function) || in parseParens()
356 OpeningParen.Previous->is(TT_JsTypeColon)) { in parseParens()
362 } else if (OpeningParen.is(TT_RequiresExpressionLParen)) { in parseParens()
365 OpeningParen.Previous->is(tok::kw__Generic)) { in parseParens()
376 OpeningParen.Previous->is(TT_ForEachMacro)) { in parseParens()
393 if (PrevNonComment && OpeningParen.is(TT_Unknown)) { in parseParens()
423 CurrentToken->isPointerOrReference() || CurrentToken->is(tok::caret); in parseParens()
427 OpeningParen.Previous && OpeningParen.Previous->is(tok::kw_for); in parseParens()
439 if (PrevPrev && PrevPrev->is(tok::identifier) && in parseParens()
441 CurrentToken->is(tok::identifier) && Next->isNot(tok::equal)) { in parseParens()
448 if (CurrentToken->Previous->is(TT_PointerOrReference) && in parseParens()
453 if (CurrentToken->is(tok::comma)) in parseParens()
455 if (CurrentToken->Previous->is(TT_BinaryOperator)) in parseParens()
457 if (CurrentToken->is(tok::r_paren)) { in parseParens()
460 (CurrentToken->Next->is(tok::l_paren) || in parseParens()
461 (CurrentToken->Next->is(tok::l_square) && in parseParens()
463 OpeningParen.setType(OpeningParen.Next->is(tok::caret) in parseParens()
470 if (CurrentToken->Next && CurrentToken->Next->is(tok::l_brace) && in parseParens()
471 OpeningParen.Previous && OpeningParen.Previous->is(tok::l_paren)) { in parseParens()
477 if (Tok->is(TT_BinaryOperator) && Tok->isPointerOrReference()) in parseParens()
490 if (OpeningParen.is(TT_AttributeLParen)) in parseParens()
492 if (OpeningParen.is(TT_TypeDeclarationParen)) in parseParens()
495 OpeningParen.Previous->is(TT_JavaAnnotation)) { in parseParens()
499 OpeningParen.Previous->is(TT_LeadingJavaAnnotation)) { in parseParens()
503 OpeningParen.Previous->is(TT_AttributeSquare)) { in parseParens()
520 if (CurrentToken->is(tok::l_brace) && OpeningParen.is(TT_ObjCBlockLParen)) in parseParens()
522 if (CurrentToken->is(tok::comma) && CurrentToken->Next && in parseParens()
528 (CurrentToken->is(tok::l_paren) && CurrentToken->Next && in parseParens()
532 !(CurrentToken->is(tok::l_brace) || in parseParens()
533 (CurrentToken->is(tok::l_paren) && !ProbablyFunctionTypeLParen))) { in parseParens()
543 if (MightBeObjCForRangeLoop && CurrentToken->is(Keywords.kw_in)) { in parseParens()
549 if (CurrentToken->is(tok::comma)) in parseParens()
567 if (Tok.Previous && Tok.Previous->is(tok::identifier)) in isCSharpAttributeSpecifier()
571 if (Tok.Previous && Tok.Previous->is(tok::r_square)) { in isCSharpAttributeSpecifier()
573 if (!MatchingParen || MatchingParen->is(TT_ArraySubscriptLSquare)) in isCSharpAttributeSpecifier()
582 if (AttrTok->is(tok::r_square)) in isCSharpAttributeSpecifier()
629 Style.isCpp() && Parent && Parent->is(TT_TemplateCloser) && in parseSquare()
663 } else if (Left->is(TT_Unknown)) { in parseSquare()
681 } else if (CurrentToken->is(tok::r_square) && Parent && in parseSquare()
682 Parent->is(TT_TemplateCloser)) { in parseSquare()
735 if (Style.isJavaScript() && Parent && Parent->is(TT_JsTypeColon)) in parseSquare()
743 if (CurrentToken->is(tok::r_square)) { in parseSquare()
752 CurrentToken->Next->is(tok::l_paren)) || in parseSquare()
755 Left->is(TT_ObjCMethodExpr)) { in parseSquare()
768 CurrentToken->Previous->is(TT_Unknown) && in parseSquare()
775 if (Parent && Parent->is(TT_PointerOrReference)) in parseSquare()
781 CurrentToken->Next->is(TT_TrailingReturnArrow)) { in parseSquare()
792 if (Previous && Previous->is(TT_SelectorName)) { in parseSquare()
811 if (CurrentToken->is(tok::colon)) { in parseSquare()
824 if (Parent && Parent->is(tok::r_paren)) { in parseSquare()
831 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
863 assert(OpeningBrace.is(tok::l_brace)); in parseBrace()
872 if (OpeningBrace.is(BK_BracedInit)) in parseBrace()
875 OpeningBrace.Previous->is(TT_JsTypeColon)) { in parseBrace()
886 if (CurrentToken->is(tok::r_brace)) { in parseBrace()
907 if (Previous->is(TT_JsTypeOptionalQuestion)) in parseBrace()
909 if ((CurrentToken->is(tok::colon) && in parseBrace()
914 Previous->is(tok::string_literal)) { in parseBrace()
918 if (CurrentToken->is(tok::colon) && OpeningBrace.is(TT_Unknown)) in parseBrace()
923 if (CurrentToken->is(tok::comma)) { in parseBrace()
938 if (Current->is(tok::l_brace) && Current->is(BK_Block)) in updateParameterCount()
940 if (Current->is(tok::comma)) { in updateParameterCount()
952 if (CurrentToken->is(tok::colon)) { in parseConditional()
964 if (CurrentToken && CurrentToken->is(tok::less)) { in parseTemplateDeclaration()
979 if (Prev && Prev->is(tok::r_square) && Prev->is(TT_AttributeSquare) && in consumeToken()
990 if (Tok->is(TT_VerilogTableItem)) in consumeToken()
1067 Tok->Previous->is(tok::identifier) && Tok->Previous->is(TT_Unknown); in consumeToken()
1070 !(BeforePrevious->is(TT_CastRParen) || in consumeToken()
1071 (BeforePrevious->is(TT_ObjCMethodExpr) && in consumeToken()
1072 BeforePrevious->is(tok::colon))) || in consumeToken()
1073 BeforePrevious->is(tok::r_square) || in consumeToken()
1092 } else if (CurrentToken && CurrentToken->is(tok::numeric_constant)) { in consumeToken()
1103 } else if (Prev->is(tok::kw_try)) { in consumeToken()
1116 Tok->Next->Next->is(tok::colon)))) { in consumeToken()
1139 if (CurrentToken && CurrentToken->is(tok::l_paren)) { in consumeToken()
1148 if ((Tok->Previous && Tok->Previous->is(tok::period)) || in consumeToken()
1149 (Tok->Next && Tok->Next->is(tok::colon))) { in consumeToken()
1153 if (CurrentToken && CurrentToken->is(Keywords.kw_await)) in consumeToken()
1156 if (Style.isCpp() && CurrentToken && CurrentToken->is(tok::kw_co_await)) in consumeToken()
1170 if (Tok->Previous && Tok->Previous->is(tok::r_paren) && in consumeToken()
1172 Tok->Previous->MatchingParen->is(TT_OverloadedOperatorLParen)) { in consumeToken()
1202 if (Prev->is(Keywords.kw_verilogHash) && in consumeToken()
1207 if (Keywords.isVerilogIdentifier(*Prev) && PrevPrev->is(tok::r_paren)) in consumeToken()
1210 if (Keywords.isVerilogIdentifier(*Prev) && PrevPrev->is(tok::comma)) { in consumeToken()
1212 if (PrevParen->is(tok::r_paren) && PrevParen->MatchingParen && in consumeToken()
1213 PrevParen->MatchingParen->is(TT_VerilogInstancePortLParen)) { in consumeToken()
1288 if (Tok->Previous && Tok->Previous->is(TT_TemplateCloser)) in consumeToken()
1301 if (Next->is(tok::less)) in consumeToken()
1309 if (CurrentToken->is(tok::comma) && Previous->isNot(tok::kw_operator)) in consumeToken()
1320 if (CurrentToken && CurrentToken->is(tok::l_paren)) in consumeToken()
1322 if (CurrentToken && CurrentToken->Previous->is(TT_BinaryOperator)) in consumeToken()
1357 if (Tok->Next && Tok->Next->is(tok::identifier) && Tok->Next->Next && in consumeToken()
1358 Tok->Next->Next->is(tok::equal)) { in consumeToken()
1419 if (Style.isCSharp() && Tok->is(Keywords.kw_where) && Tok->Next && in consumeToken()
1428 if (Tok->Previous && Tok->Previous->is(tok::kw_noexcept)) in consumeToken()
1440 if (CurrentToken->is(tok::less)) { in parseCSharpGenericTypeConstraint()
1445 } else if (CurrentToken->is(tok::greater)) { in parseCSharpGenericTypeConstraint()
1449 } else if (CurrentToken->is(tok::comma) && OpenAngleBracketsCount == 0) { in parseCSharpGenericTypeConstraint()
1454 } else if (CurrentToken->is(Keywords.kw_where)) { in parseCSharpGenericTypeConstraint()
1457 } else if (CurrentToken->is(tok::colon)) { in parseCSharpGenericTypeConstraint()
1467 if (CurrentToken && CurrentToken->is(tok::less)) { in parseIncludeDirective()
1502 if (IsMarkOrRegion || CurrentToken->Previous->is(TT_BinaryOperator)) in parsePragma()
1536 if (CurrentToken->is(tok::numeric_constant)) { in parsePreprocessorDirective()
1575 if (Tok->is(tok::l_paren)) { in parsePreprocessorDirective()
1590 if (!Line.InMacroBody && CurrentToken->is(tok::hash)) { in parseLine()
1604 CurrentToken->is(Keywords.kw_package)) || in parseLine()
1616 if (CurrentToken->is(tok::less) && Line.Last->is(tok::greater)) { in parseLine()
1626 if (CurrentToken && CurrentToken->is(tok::identifier)) { in parseLine()
1637 if (Style.isJavaScript() && CurrentToken->is(Keywords.kw_import)) in parseLine()
1641 if (CurrentToken->is(tok::kw_virtual)) in parseLine()
1650 if (Line.First->is(tok::kw_export) && in parseLine()
1651 CurrentToken->is(Keywords.kw_from) && CurrentToken->Next && in parseLine()
1685 return Tok.TokenText == "goog" && Tok.Next && Tok.Next->is(tok::period) && in isClosureImportStatement()
1692 Tok.Next->Next->Next && Tok.Next->Next->Next->is(tok::l_paren); in isClosureImportStatement()
1814 if (Line.First->is(tok::kw_template)) { in modifyContext()
1816 if (Current.Previous->is(tok::kw_operator)) { in modifyContext()
1885 } else if (Current.is(tok::lessless) && in modifyContext()
1891 } else if (Current.is(TT_TrailingReturnArrow)) { in modifyContext()
1893 } else if (Current.is(Keywords.kw_assert)) { in modifyContext()
1896 Current.Previous->is(TT_CtorInitializerColon)) { in modifyContext()
1899 } else if (Current.Previous && Current.Previous->is(TT_InheritanceColon)) { in modifyContext()
1911 } else if (Current.is(tok::kw_new)) { in modifyContext()
1913 } else if (Current.is(tok::semi) || in modifyContext()
1914 (Current.is(tok::exclaim) && Current.Previous && in modifyContext()
1927 if (Current->is(tok::l_paren)) in untilMatchingParen()
1929 if (Current->is(tok::r_paren)) in untilMatchingParen()
1940 if (Current.Previous && Current.Previous->is(tok::r_paren) && in isDeductionGuide()
1947 if (TemplateCloser->is(tok::l_paren)) { in isDeductionGuide()
1953 if (TemplateCloser->is(tok::less)) in isDeductionGuide()
1955 if (TemplateCloser->is(tok::greater)) in isDeductionGuide()
1964 TemplateCloser->Next->is(tok::semi) && in isDeductionGuide()
1985 Current.is(tok::exclaim)) { in determineTokenType()
1991 : Current.Previous->is(tok::identifier); in determineTokenType()
2012 if (Current.is(Keywords.kw_instanceof)) { in determineTokenType()
2018 } else if (Current.is(tok::semi)) { in determineTokenType()
2025 } else if (Current.is(tok::arrow) && in determineTokenType()
2028 } else if (Current.is(tok::arrow) && Style.isVerilog()) { in determineTokenType()
2031 } else if (Current.is(tok::arrow) && AutoFound && in determineTokenType()
2036 } else if (Current.is(tok::arrow) && Current.Previous && in determineTokenType()
2037 Current.Previous->is(tok::r_brace)) { in determineTokenType()
2050 (Style.isVerilog() && Current.is(tok::pipe))) { in determineTokenType()
2052 if (Current.is(TT_UnaryOperator) && Current.is(tok::caret)) in determineTokenType()
2058 } else if (Current.is(tok::question)) { in determineTokenType()
2072 if (Current.is(tok::lessequal) && Contexts.size() == 1 && in determineTokenType()
2083 } else if (Current.is(tok::comment)) { in determineTokenType()
2095 } else if (Current.is(tok::string_literal)) { in determineTokenType()
2103 } else if (Current.is(tok::l_paren)) { in determineTokenType()
2106 } else if (Current.is(tok::r_paren)) { in determineTokenType()
2118 BeforeParen && BeforeParen->is(tok::identifier) && in determineTokenType()
2128 } else if (Current.is(tok::at) && Current.Next && !Style.isJavaScript() && in determineTokenType()
2144 } else if (Current.is(tok::period)) { in determineTokenType()
2157 Current.Previous && Current.Previous->is(TT_CastRParen) && in determineTokenType()
2160 Current.Previous->MatchingParen->Previous->is( in determineTokenType()
2179 if (Current.Previous->is(tok::at) && in determineTokenType()
2183 if (!Previous || Previous->is(TT_LeadingJavaAnnotation)) in determineTokenType()
2187 } else if (Current.Previous->is(tok::period) && in determineTokenType()
2212 NextNonComment->is(tok::string_literal) || in isStartOfName()
2213 (Line.InPragmaDirective && NextNonComment->is(tok::identifier))))) { in isStartOfName()
2221 if (Style.isJavaScript() && Tok.Previous->is(Keywords.kw_in)) in isStartOfName()
2229 while (PreviousNotConst && PreviousNotConst->is(tok::kw_const)) in isStartOfName()
2244 bool IsPPKeyword = PreviousNotConst->is(tok::identifier) && in isStartOfName()
2246 PreviousNotConst->Previous->is(tok::hash); in isStartOfName()
2248 if (PreviousNotConst->is(TT_TemplateCloser)) { in isStartOfName()
2255 if ((PreviousNotConst->is(tok::r_paren) && in isStartOfName()
2256 PreviousNotConst->is(TT_TypeDeclarationParen)) || in isStartOfName()
2257 PreviousNotConst->is(TT_AttributeRParen)) { in isStartOfName()
2270 if (PreviousNotConst->is(TT_PointerOrReference)) in isStartOfName()
2279 PreviousNotConst->is(tok::r_square)) { in isStartOfName()
2284 return Style.isJavaScript() && PreviousNotConst->is(tok::kw_const); in isStartOfName()
2294 if (LeftOfParens && LeftOfParens->is(TT_TemplateCloser) && in lParenStartsCppCast()
2320 if (Tok.MatchingParen->is(TT_OverloadedOperatorLParen)) in rParenEndsCast()
2327 if (LeftOfParens->is(tok::r_paren) && in rParenEndsCast()
2336 if (LeftOfParens->is(tok::r_square)) { in rParenEndsCast()
2359 LeftOfParens->Previous->is(tok::kw_operator)) { in rParenEndsCast()
2383 if (Tok.Next->is(Keywords.kw_in) && Style.isCSharp()) in rParenEndsCast()
2397 if (Style.Language == FormatStyle::LK_Java && Tok.Next->is(tok::l_paren)) in rParenEndsCast()
2413 if (T->is(TT_AttributeRParen)) { in rParenEndsCast()
2415 assert(T->is(tok::r_paren)); in rParenEndsCast()
2417 assert(T->MatchingParen->is(tok::l_paren)); in rParenEndsCast()
2418 assert(T->MatchingParen->is(TT_AttributeLParen)); in rParenEndsCast()
2424 } else if (T->is(TT_AttributeSquare)) { in rParenEndsCast()
2436 return T && T->is(TT_PointerOrReference); in rParenEndsCast()
2458 if (Token->is(TT_BinaryOperator)) in rParenEndsCast()
2468 if (Tok.Next->is(tok::l_paren) && Tok.Previous && Tok.Previous->Previous) { in rParenEndsCast()
2469 if (Tok.Previous->is(tok::identifier) && in rParenEndsCast()
2470 Tok.Previous->Previous->is(tok::l_paren)) { in rParenEndsCast()
2483 Tok.Next->is(tok::plus) || in rParenEndsCast()
2488 (Tok.Next->Next->is(tok::numeric_constant) || Line.InPPDirective)) { in rParenEndsCast()
2491 if (Line.InPPDirective && Tok.Next->is(tok::minus)) in rParenEndsCast()
2525 if (PrevToken->is(tok::kw_sizeof)) in determineUnaryOperatorByUsage()
2533 if (PrevToken->is(TT_BinaryOperator)) in determineUnaryOperatorByUsage()
2546 if (Style.isCSharp() && Tok.is(tok::ampamp)) in determineStarAmpUsage()
2554 if (Tok.is(tok::star)) in determineStarAmpUsage()
2563 if (PrevToken->is(TT_TypeName)) in determineStarAmpUsage()
2568 if (InTemplateArgument && NextToken && NextToken->is(tok::kw_noexcept)) in determineStarAmpUsage()
2574 (NextToken->is(tok::kw_noexcept) && !IsExpression) || in determineStarAmpUsage()
2576 (NextToken->is(tok::l_brace) && !NextToken->getNextNonComment())) { in determineStarAmpUsage()
2580 if (PrevToken->is(tok::coloncolon)) in determineStarAmpUsage()
2583 if (PrevToken->is(tok::r_paren) && PrevToken->is(TT_TypeDeclarationParen)) in determineStarAmpUsage()
2589 if (NextToken->is(tok::l_square) && NextToken->isNot(TT_LambdaLSquare)) in determineStarAmpUsage()
2591 if (NextToken->is(tok::kw_operator) && !IsExpression) in determineStarAmpUsage()
2606 if (PrevToken->is(tok::r_brace) && Tok.is(tok::star) && in determineStarAmpUsage()
2621 while (NextNonParen && NextNonParen->is(tok::l_paren)) in determineStarAmpUsage()
2637 if (Tok.is(tok::ampamp) && in determineStarAmpUsage()
2646 if (NextNextToken && NextNextToken->is(tok::arrow)) in determineStarAmpUsage()
2667 if (Tok.is(tok::amp) && PrevToken && PrevToken->Tok.isAnyIdentifier() && in determineStarAmpUsage()
2672 (IsChainedOperatorAmpOrMember(NextNext) || NextNext->is(tok::semi))) { in determineStarAmpUsage()
2688 if (PrevToken->is(tok::at)) in determinePlusMinusCaretUsage()
2698 if (!PrevToken || PrevToken->is(TT_CastRParen)) in determineIncrementUsage()
2738 while (Current && (Current->is(tok::kw_return) || in parse()
2739 (Current->is(tok::colon) && in parse()
2784 Current->is(TT_SelectorName)) { in parse()
2796 if (Prev && Prev->is(tok::string_literal) && in parse()
2807 (Current->MatchingParen || Current->is(TT_TemplateString))) || in parse()
2810 Precedence == prec::Assignment && Current->is(tok::colon))) { in parse()
2875 if (Current->is(TT_ConditionalExpr)) in getCurrentPrecedence()
2877 if (NextNonComment && Current->is(TT_SelectorName) && in getCurrentPrecedence()
2879 (Style.isProto() && NextNonComment->is(tok::less)))) { in getCurrentPrecedence()
2882 if (Current->is(TT_JsComputedPropertyName)) in getCurrentPrecedence()
2884 if (Current->is(TT_TrailingReturnArrow)) in getCurrentPrecedence()
2886 if (Current->is(TT_FatArrow)) in getCurrentPrecedence()
2889 (Current->is(tok::comment) && NextNonComment && in getCurrentPrecedence()
2890 NextNonComment->is(TT_SelectorName))) { in getCurrentPrecedence()
2893 if (Current->is(TT_RangeBasedForLoopColon)) in getCurrentPrecedence()
2896 Current->is(Keywords.kw_instanceof)) { in getCurrentPrecedence()
2903 if (Current->is(TT_BinaryOperator) || Current->is(tok::comma)) in getCurrentPrecedence()
2916 if (Style.isVerilog() && Current->is(tok::colon)) in getCurrentPrecedence()
2947 while (Current && Current->is(TT_UnaryOperator)) { in parseUnaryOperator()
3003 if (Tok->is(Keywords.kw_assign)) in verilogGroupDecl()
3016 if (Tok->is(tok::hash)) { in verilogGroupDecl()
3022 } else if (Tok->is(tok::hashhash)) { in verilogGroupDecl()
3039 } else if (Tok->is(tok::l_paren)) { in verilogGroupDecl()
3058 } else if (Tok->is(tok::hash)) { in verilogGroupDecl()
3059 if (Next->is(tok::l_paren)) in verilogGroupDecl()
3071 while (Tok && Tok->is(tok::l_square) && (Tok = Tok->MatchingParen)) in verilogGroupDecl()
3073 if (Tok && (Tok->is(tok::hash) || Keywords.isVerilogIdentifier(*Tok))) in verilogGroupDecl()
3081 if (First && First->is(TT_Unknown)) in verilogGroupDecl()
3091 if (TypedName->is(TT_Unknown)) in verilogGroupDecl()
3171 if (Tok->is(tok::l_square) && Tok->is(TT_AttributeSquare)) { in getFunctionName()
3180 return Tok->is(tok::l_paren) && Tok->isNot(TT_FunctionTypeLParen) && in getFunctionName()
3193 if (Tok->is(tok::coloncolon)) { in getFunctionName()
3208 if (Tok->is(tok::tilde)) { in getFunctionName()
3226 assert(Tok && Tok->is(tok::identifier)); in isCtorOrDtorName()
3229 if (Prev && Prev->is(tok::tilde)) in isCtorOrDtorName()
3278 if (First->is(tok::eof) && First->NewlinesBefore == 0 && in annotate()
3291 if (Current.is(TT_FunctionDeclarationName)) in isFunctionDeclarationName()
3299 if (Next->is(TT_OverloadedOperatorLParen)) in isFunctionDeclarationName()
3301 if (Next->is(TT_OverloadedOperator)) in isFunctionDeclarationName()
3316 if ((Next->isSimpleTypeSpecifier() || Next->is(tok::identifier)) && in isFunctionDeclarationName()
3322 if (Next->is(TT_TemplateOpener) && Next->MatchingParen) { in isFunctionDeclarationName()
3334 if (Current.is(tok::kw_operator)) { in isFunctionDeclarationName()
3340 if (Previous->is(tok::r_paren) && Previous->is(TT_TypeDeclarationParen)) { in isFunctionDeclarationName()
3342 assert(Previous->MatchingParen->is(tok::l_paren)); in isFunctionDeclarationName()
3343 assert(Previous->MatchingParen->is(TT_TypeDeclarationParen)); in isFunctionDeclarationName()
3353 if (Next->is(TT_TemplateOpener) && Next->MatchingParen) { in isFunctionDeclarationName()
3355 } else if (Next->is(tok::coloncolon)) { in isFunctionDeclarationName()
3359 if (Next->is(tok::kw_operator)) { in isFunctionDeclarationName()
3369 } else if (Next->is(tok::l_paren)) { in isFunctionDeclarationName()
3381 assert(ClosingParen->is(tok::r_paren)); in isFunctionDeclarationName()
3383 if (Line.Last->is(tok::l_brace)) in isFunctionDeclarationName()
3388 if (ClosingParen->Next && ClosingParen->Next->is(TT_PointerOrReference)) in isFunctionDeclarationName()
3401 if (IsCpp && Next->Next && Next->Next->is(tok::identifier) && in isFunctionDeclarationName()
3408 if (Tok->is(TT_TypeDeclarationParen)) in isFunctionDeclarationName()
3414 if (Tok->is(tok::kw_const) || Tok->isSimpleTypeSpecifier() || in isFunctionDeclarationName()
3472 if (Tok->is(TT_StartOfName)) in calculateFormattingInformation()
3476 if (const bool IsCtorOrDtor = Tok->is(TT_CtorDtorDeclName); in calculateFormattingInformation()
3487 if (IsCpp && (LineIsFunctionDeclaration || First->is(TT_CtorDtorDeclName)) && in calculateFormattingInformation()
3493 assert(LBrace->is(tok::l_brace)); in calculateFormattingInformation()
3526 Next->Next->is(tok::identifier); in calculateFormattingInformation()
3535 if (Tok->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
3537 if (Tok->is(tok::arrow)) { in calculateFormattingInformation()
3555 if (Current->is(TT_LineComment)) { in calculateFormattingInformation()
3556 if (Prev->is(BK_BracedInit) && Prev->opensScope()) { in calculateFormattingInformation()
3561 } else if (Prev->is(TT_VerilogMultiLineListLParen)) { in calculateFormattingInformation()
3579 if (Parameter->Previous && Parameter->Previous->is(tok::comma)) { in calculateFormattingInformation()
3594 if (!Children.empty() && Children.back()->Last->is(TT_LineComment)) { in calculateFormattingInformation()
3600 Current->is(TT_FunctionDeclarationName)) { in calculateFormattingInformation()
3623 if (Current->is(TT_CtorInitializerColon)) in calculateFormattingInformation()
3637 Current->is(TT_SelectorName) && Current->ParameterIndex > 0) { in calculateFormattingInformation()
3690 if (CurrentToken->is(tok::l_brace)) { in calculateArrayInitializerColumnList()
3705 if (CurrentToken->is(tok::l_brace)) in calculateInitializerColumnList()
3707 else if (CurrentToken->is(tok::r_brace)) in calculateInitializerColumnList()
3727 if (Left.is(tok::semi)) in splitPenalty()
3734 if (Right.is(Keywords.kw_implements)) in splitPenalty()
3736 if (Left.is(tok::comma) && Left.NestingLevel == 0) in splitPenalty()
3739 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
3741 if (Left.is(TT_JsTypeColon)) in splitPenalty()
3743 if ((Left.is(TT_TemplateString) && Left.TokenText.ends_with("${")) || in splitPenalty()
3744 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) { in splitPenalty()
3751 if (Right.is(tok::l_square)) in splitPenalty()
3753 if (Right.is(tok::period)) in splitPenalty()
3757 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in splitPenalty()
3759 if (Right.is(tok::l_square)) { in splitPenalty()
3760 if (Left.is(tok::r_square)) in splitPenalty()
3763 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
3772 if (Left.is(tok::coloncolon)) in splitPenalty()
3775 Right.is(tok::kw_operator)) { in splitPenalty()
3778 if (Left.is(TT_StartOfName)) in splitPenalty()
3784 if (Right.is(TT_PointerOrReference)) in splitPenalty()
3786 if (Right.is(TT_TrailingReturnArrow)) in splitPenalty()
3788 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
3790 if (Left.is(TT_CastRParen)) in splitPenalty()
3794 if (Left.is(tok::comment)) in splitPenalty()
3827 if (Right.is(TT_TrailingAnnotation) && in splitPenalty()
3839 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0); in splitPenalty()
3843 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
3848 if (Right.is(TT_SelectorName)) in splitPenalty()
3850 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) in splitPenalty()
3856 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
3861 if (Left.is(tok::l_paren) && Style.PenaltyBreakOpenParenthesis != 0) in splitPenalty()
3863 if (Left.is(tok::l_paren) && InFunctionDecl && in splitPenalty()
3867 if (Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
3872 if (Left.is(tok::equal) && InFunctionDecl) in splitPenalty()
3874 if (Right.is(tok::r_brace)) in splitPenalty()
3876 if (Left.is(TT_TemplateOpener)) in splitPenalty()
3886 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle) in splitPenalty()
3891 if (Left.is(TT_JavaAnnotation)) in splitPenalty()
3894 if (Left.is(TT_UnaryOperator)) in splitPenalty()
3901 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
3905 if (Left.is(tok::comma)) in splitPenalty()
3907 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
3911 if (Right.is(tok::lessless)) { in splitPenalty()
3923 if (Left.is(TT_ConditionalExpr)) in splitPenalty()
3939 if (Right.is(TT_OverloadedOperatorLParen) && in spaceRequiredBeforeParens()
3953 if (Left.is(tok::kw_return) && in spaceRequiredBetween()
3957 if (Left.is(tok::kw_throw) && Right.is(tok::l_paren) && Right.MatchingParen && in spaceRequiredBetween()
3958 Right.MatchingParen->is(TT_CastRParen)) { in spaceRequiredBetween()
3961 if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java) in spaceRequiredBetween()
3967 if (Right.is(tok::hashhash)) in spaceRequiredBetween()
3968 return Left.is(tok::hash); in spaceRequiredBetween()
3970 return Right.is(tok::hash); in spaceRequiredBetween()
3971 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) || in spaceRequiredBetween()
3972 (Left.is(tok::l_brace) && Left.isNot(BK_Block) && in spaceRequiredBetween()
3973 Right.is(tok::r_brace) && Right.isNot(BK_Block))) { in spaceRequiredBetween()
3978 if (Left.is(tok::l_paren)) in spaceRequiredBetween()
3980 else if (Right.is(tok::r_paren) && Right.MatchingParen) in spaceRequiredBetween()
3983 if (LeftParen->is(TT_ConditionLParen)) in spaceRequiredBetween()
3991 if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace, in spaceRequiredBetween()
3998 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace)) in spaceRequiredBetween()
4002 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && Left.Previous && in spaceRequiredBetween()
4003 Left.Previous->is(tok::kw_operator)) { in spaceRequiredBetween()
4012 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { in spaceRequiredBetween()
4013 return (Right.is(TT_CastRParen) || in spaceRequiredBetween()
4014 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) in spaceRequiredBetween()
4020 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) { in spaceRequiredBetween()
4023 Right.MatchingParen->Next->is(tok::colon); in spaceRequiredBetween()
4026 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
4030 if (Left.is(tok::at) && in spaceRequiredBetween()
4036 if (Left.is(tok::colon)) in spaceRequiredBetween()
4038 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
4040 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
4043 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
4045 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
4053 if (Right.is(tok::ellipsis)) { in spaceRequiredBetween()
4054 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous && in spaceRequiredBetween()
4055 Left.Previous->is(tok::kw_case)); in spaceRequiredBetween()
4057 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
4059 if (Right.is(TT_PointerOrReference)) { in spaceRequiredBetween()
4060 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { in spaceRequiredBetween()
4073 (Left.is(TT_AttributeRParen) || in spaceRequiredBetween()
4081 Right.Next->Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
4092 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
4098 if (Left.is(TT_PointerOrReference)) { in spaceRequiredBetween()
4110 if (Right.is(TT_BlockComment)) in spaceRequiredBetween()
4120 if (Right.is(tok::l_brace) && Right.is(BK_Block)) in spaceRequiredBetween()
4124 Right.Next->is(TT_RangeBasedForLoopColon)) { in spaceRequiredBetween()
4150 if (Left.is(tok::ellipsis) && Left.Previous && in spaceRequiredBetween()
4155 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
4157 if (Left.is(tok::star) && Right.isPointerOrReference()) in spaceRequiredBetween()
4162 if (Previous->is(tok::identifier) || Previous->isSimpleTypeSpecifier()) { in spaceRequiredBetween()
4166 if (Previous->is(TT_TemplateCloser) && Previous->MatchingParen) { in spaceRequiredBetween()
4170 if (Previous->is(tok::coloncolon)) { in spaceRequiredBetween()
4191 if (Previous->is(tok::kw_const) || Previous->is(tok::kw_volatile)) { in spaceRequiredBetween()
4199 if (Style.isCSharp() && Left.is(Keywords.kw_is) && Right.is(tok::l_square)) in spaceRequiredBetween()
4208 if (Left.is(tok::l_square)) { in spaceRequiredBetween()
4209 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
4215 if (Right.is(tok::r_square)) { in spaceRequiredBetween()
4217 ((Right.MatchingParen->is(TT_ArrayInitializerLSquare) && in spaceRequiredBetween()
4225 if (Right.is(tok::l_square) && in spaceRequiredBetween()
4231 Right.is(TT_ArraySubscriptLSquare))) { in spaceRequiredBetween()
4234 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
4236 if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) || in spaceRequiredBetween()
4237 (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
4241 if (Left.is(TT_BlockComment)) { in spaceRequiredBetween()
4248 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare)) in spaceRequiredBetween()
4251 if (Right.is(tok::l_paren)) { in spaceRequiredBetween()
4252 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen)) in spaceRequiredBetween()
4259 if (Left.is(TT_RequiresExpression)) { in spaceRequiredBetween()
4263 if (Left.is(TT_AttributeRParen) || in spaceRequiredBetween()
4264 (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) { in spaceRequiredBetween()
4267 if (Left.is(TT_ForEachMacro)) { in spaceRequiredBetween()
4271 if (Left.is(TT_IfMacro)) { in spaceRequiredBetween()
4278 !(Line.MightBeFunctionDecl && Left.is(TT_FunctionDeclarationName))) { in spaceRequiredBetween()
4283 if (Left.is(tok::semi)) in spaceRequiredBetween()
4288 Right.is(TT_ConditionLParen)) { in spaceRequiredBetween()
4295 if (Right.is(TT_OverloadedOperatorLParen)) in spaceRequiredBetween()
4298 if (Line.MightBeFunctionDecl && (Left.is(TT_FunctionDeclarationName))) { in spaceRequiredBetween()
4308 if (Line.Type != LT_PreprocessorDirective && Left.is(tok::r_square) && in spaceRequiredBetween()
4309 Left.MatchingParen && Left.MatchingParen->is(TT_LambdaLSquare)) { in spaceRequiredBetween()
4324 if (Left.is(tok::r_square) && Left.MatchingParen && in spaceRequiredBetween()
4326 Left.MatchingParen->Previous->is(tok::kw_delete)) { in spaceRequiredBetween()
4333 (Left.Tok.getIdentifierInfo() || Left.is(tok::r_paren))) { in spaceRequiredBetween()
4338 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
4340 if (Right.is(TT_UnaryOperator)) { in spaceRequiredBetween()
4352 Right.is(tok::l_brace) && Right.getNextNonComment() && in spaceRequiredBetween()
4356 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
4360 if (Right.is(tok::hash) && Left.is(tok::identifier) && in spaceRequiredBetween()
4367 if (Left.is(TT_TemplateCloser) && Left.MatchingParen && in spaceRequiredBetween()
4369 (Left.MatchingParen->Previous->is(tok::period) || in spaceRequiredBetween()
4370 Left.MatchingParen->Previous->is(tok::coloncolon))) { in spaceRequiredBetween()
4376 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
4378 if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) { in spaceRequiredBetween()
4382 if (Right.is(tok::r_brace) && Right.MatchingParen && in spaceRequiredBetween()
4390 (!Right.Next || Right.Next->is(tok::semi))) { in spaceRequiredBetween()
4415 if (Left.is(tok::star) && Right.is(tok::comment)) in spaceRequiredBefore()
4419 if (Left.is(TT_OverloadedOperator) && in spaceRequiredBefore()
4424 if (Right.is(tok::period) && Left.is(tok::numeric_constant)) in spaceRequiredBefore()
4428 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis)) in spaceRequiredBefore()
4432 Right.is(TT_ModulePartitionColon)) { in spaceRequiredBefore()
4436 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon)) in spaceRequiredBefore()
4439 if (Left.is(TT_ModulePartitionColon) && in spaceRequiredBefore()
4443 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) && in spaceRequiredBefore()
4444 Line.First->is(Keywords.kw_import)) { in spaceRequiredBefore()
4449 Right.is(tok::coloncolon)) { in spaceRequiredBefore()
4453 if (Left.is(tok::kw_operator)) in spaceRequiredBefore()
4454 return Right.is(tok::coloncolon); in spaceRequiredBefore()
4455 if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) && in spaceRequiredBefore()
4459 if (Left.is(tok::less) && Left.is(TT_OverloadedOperator) && in spaceRequiredBefore()
4460 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
4464 if (Right.is(tok::period) && in spaceRequiredBefore()
4469 if (Right.is(tok::l_paren) && in spaceRequiredBefore()
4473 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
4476 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
4479 Left.MatchingParen->is(TT_ProtoExtensionLSquare) && in spaceRequiredBefore()
4484 if (Left.is(tok::percent)) in spaceRequiredBefore()
4488 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
4491 if (Right.is(tok::colon) && Left.is(tok::string_literal)) in spaceRequiredBefore()
4499 if (Left.is(tok::kw_this) && Right.is(tok::l_square)) in spaceRequiredBefore()
4503 if (Left.is(tok::kw_new) && Right.is(tok::l_paren)) in spaceRequiredBefore()
4507 if (Right.is(tok::l_brace)) in spaceRequiredBefore()
4511 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace)) in spaceRequiredBefore()
4514 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBefore()
4518 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow)) in spaceRequiredBefore()
4522 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon)) in spaceRequiredBefore()
4526 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName)) in spaceRequiredBefore()
4530 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
4534 if (Right.is(TT_CSharpNullable)) in spaceRequiredBefore()
4538 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
4542 if (Left.is(tok::comma) && Right.is(tok::comma)) in spaceRequiredBefore()
4546 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren)) in spaceRequiredBefore()
4550 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
4565 Right.is(tok::l_paren)) { in spaceRequiredBefore()
4569 if (Left.is(TT_FatArrow)) in spaceRequiredBefore()
4572 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
4573 Left.Previous->is(tok::kw_for)) { in spaceRequiredBefore()
4576 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
4581 if (Next && Next->is(TT_FatArrow)) in spaceRequiredBefore()
4584 if ((Left.is(TT_TemplateString) && Left.TokenText.ends_with("${")) || in spaceRequiredBefore()
4585 (Right.is(TT_TemplateString) && Right.TokenText.starts_with("}"))) { in spaceRequiredBefore()
4592 Right.is(TT_TemplateString)) { in spaceRequiredBefore()
4595 if (Right.is(tok::star) && in spaceRequiredBefore()
4604 if (Right.is(tok::l_paren)) { in spaceRequiredBefore()
4610 if (Left.Previous && Left.Previous->is(tok::period) && in spaceRequiredBefore()
4628 (Left.is(Keywords.kw_of) && Left.Previous && in spaceRequiredBefore()
4629 (Left.Previous->is(tok::identifier) || in spaceRequiredBefore()
4635 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
4638 if (Left.is(Keywords.kw_as) && in spaceRequiredBefore()
4642 if (Left.is(tok::kw_default) && Left.Previous && in spaceRequiredBefore()
4643 Left.Previous->is(tok::kw_export)) { in spaceRequiredBefore()
4646 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
4650 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
4652 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
4656 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
4658 if (Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
4666 if (Right.is(TT_NonNullAssertion)) in spaceRequiredBefore()
4668 if (Left.is(TT_NonNullAssertion) && in spaceRequiredBefore()
4673 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
4676 if (Left.is(tok::l_square) || Right.is(tok::r_square)) in spaceRequiredBefore()
4679 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) { in spaceRequiredBefore()
4687 Right.is(TT_TemplateOpener)) { in spaceRequiredBefore()
4692 if (Style.isVerilog() && Left.is(tok::identifier) && in spaceRequiredBefore()
4698 if ((Left.is(TT_VerilogTableItem) && in spaceRequiredBefore()
4700 (Right.is(TT_VerilogTableItem) && Left.isNot(tok::l_paren))) { in spaceRequiredBefore()
4702 return !(Next && Next->is(tok::r_paren)); in spaceRequiredBefore()
4714 (Left.is(tok::r_paren) && Left.MatchingParen && in spaceRequiredBefore()
4720 if (Left.is(Keywords.kw_apostrophe) || in spaceRequiredBefore()
4721 (Left.is(TT_VerilogNumberBase) && Right.is(tok::numeric_constant))) { in spaceRequiredBefore()
4725 if (Left.is(tok::arrow) || Right.is(tok::arrow)) in spaceRequiredBefore()
4730 if (Left.is(tok::at) && Right.isOneOf(tok::l_paren, tok::star, tok::at)) in spaceRequiredBefore()
4733 if (Right.is(tok::l_square) && in spaceRequiredBefore()
4740 Left.getPreviousNonComment()->is(Keywords.kw_tagged)) { in spaceRequiredBefore()
4746 if ((Right.is(Keywords.kw_apostrophe) || in spaceRequiredBefore()
4747 (Right.is(BK_BracedInit) && Right.is(tok::l_brace))) && in spaceRequiredBefore()
4756 if ((Right.is(tok::star) && Left.is(tok::coloncolon)) || in spaceRequiredBefore()
4757 (Left.is(tok::star) && Right.is(tok::semi))) { in spaceRequiredBefore()
4761 if (Left.endsSequence(tok::star, tok::l_paren) && Right.is(tok::identifier)) in spaceRequiredBefore()
4764 if (Right.is(tok::l_paren) && Right.is(TT_VerilogStrength)) in spaceRequiredBefore()
4767 if ((Left.is(tok::l_brace) && in spaceRequiredBefore()
4774 if (Left.is(TT_ImplicitStringLiteral)) in spaceRequiredBefore()
4777 if (Left.is(TT_ObjCMethodSpecifier)) in spaceRequiredBefore()
4779 if (Left.is(tok::r_paren) && Left.isNot(TT_AttributeRParen) && in spaceRequiredBefore()
4788 (Right.is(tok::equal) || Left.is(tok::equal))) { in spaceRequiredBefore()
4792 if (Right.is(TT_TrailingReturnArrow) || Left.is(TT_TrailingReturnArrow)) in spaceRequiredBefore()
4795 if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) && in spaceRequiredBefore()
4801 if (Right.is(tok::comma)) in spaceRequiredBefore()
4803 if (Right.is(TT_ObjCBlockLParen)) in spaceRequiredBefore()
4805 if (Right.is(TT_CtorInitializerColon)) in spaceRequiredBefore()
4807 if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon) in spaceRequiredBefore()
4809 if (Right.is(TT_RangeBasedForLoopColon) && in spaceRequiredBefore()
4813 if (Left.is(TT_BitFieldColon)) { in spaceRequiredBefore()
4817 if (Right.is(tok::colon)) { in spaceRequiredBefore()
4818 if (Right.is(TT_CaseLabelColon)) in spaceRequiredBefore()
4820 if (Right.is(TT_GotoLabelColon)) in spaceRequiredBefore()
4825 if (Right.is(TT_ObjCMethodExpr)) in spaceRequiredBefore()
4827 if (Left.is(tok::question)) in spaceRequiredBefore()
4829 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
4831 if (Right.is(TT_DictLiteral)) in spaceRequiredBefore()
4833 if (Right.is(TT_AttributeColon)) in spaceRequiredBefore()
4835 if (Right.is(TT_CSharpNamedArgumentColon)) in spaceRequiredBefore()
4837 if (Right.is(TT_GenericSelectionColon)) in spaceRequiredBefore()
4839 if (Right.is(TT_BitFieldColon)) { in spaceRequiredBefore()
4852 if (Left.is(TT_UnaryOperator)) { in spaceRequiredBefore()
4857 if (Left.is(tok::exclaim) && Left.TokenText == "not") in spaceRequiredBefore()
4859 if (Left.is(tok::tilde) && Left.TokenText == "compl") in spaceRequiredBefore()
4863 if (Left.is(tok::amp) && Right.is(tok::r_square)) in spaceRequiredBefore()
4866 return (Style.SpaceAfterLogicalNot && Left.is(tok::exclaim)) || in spaceRequiredBefore()
4867 Right.is(TT_BinaryOperator); in spaceRequiredBefore()
4872 if (Left.is(TT_CastRParen)) { in spaceRequiredBefore()
4885 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
4887 (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) { in spaceRequiredBefore()
4890 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
4896 (Right.is(tok::period) && Right.isNot(TT_DesignatedInitializerPeriod))) { in spaceRequiredBefore()
4903 if (Style.Language == FormatStyle::LK_Java && Right.is(tok::coloncolon) && in spaceRequiredBefore()
4904 (Left.is(tok::identifier) || Left.is(tok::kw_this))) { in spaceRequiredBefore()
4907 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) { in spaceRequiredBefore()
4913 if (Right.is(tok::coloncolon) && in spaceRequiredBefore()
4916 return (Left.is(TT_TemplateOpener) && in spaceRequiredBefore()
4922 (Left.is(tok::l_paren) && Style.SpacesInParensOptions.Other); in spaceRequiredBefore()
4924 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
4927 if (Right.is(TT_StructuredBindingLSquare)) { in spaceRequiredBefore()
4932 if (Right.Next && Right.Next->is(TT_StructuredBindingLSquare) && in spaceRequiredBefore()
4936 if ((Right.is(TT_BinaryOperator) && Left.isNot(tok::l_paren)) || in spaceRequiredBefore()
4941 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
4943 Left.MatchingParen->is(TT_OverloadedOperatorLParen)) { in spaceRequiredBefore()
4946 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
4950 if (Right.is(TT_TrailingUnaryOperator)) in spaceRequiredBefore()
4952 if (Left.is(TT_RegexLiteral)) in spaceRequiredBefore()
4959 return Tok.is(tok::l_brace) && Tok.is(BK_Block) && in isAllmanBrace()
4976 return Tok.is(tok::l_brace) && Tok.is(BK_Block) && in isAllmanLambdaBrace()
4987 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) && in mustBreakBefore()
4991 if (Right.is(TT_CSharpNamedArgumentColon) || in mustBreakBefore()
4992 Left.is(TT_CSharpNamedArgumentColon)) { in mustBreakBefore()
4995 if (Right.is(TT_CSharpGenericTypeConstraint)) in mustBreakBefore()
4997 if (Right.Next && Right.Next->is(TT_FatArrow) && in mustBreakBefore()
4998 (Right.is(tok::numeric_constant) || in mustBreakBefore()
4999 (Right.is(tok::identifier) && Right.TokenText == "_"))) { in mustBreakBefore()
5004 if (Left.is(TT_AttributeSquare) && Left.is(tok::r_square) && in mustBreakBefore()
5006 Right.is(Keywords.kw_internal))) { in mustBreakBefore()
5010 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) && in mustBreakBefore()
5011 Left.is(tok::r_square) && Right.is(tok::l_square)) { in mustBreakBefore()
5017 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous && in mustBreakBefore()
5018 Left.Previous->is(tok::string_literal)) { in mustBreakBefore()
5021 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
5022 Left.Previous && Left.Previous->is(tok::equal) && in mustBreakBefore()
5032 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
5041 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && Left.Previous && in mustBreakBefore()
5042 Left.Previous->is(TT_FatArrow)) { in mustBreakBefore()
5060 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
5070 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
5071 Right.Next->is(tok::string_literal)) { in mustBreakBefore()
5076 if (Left.is(TT_VerilogAssignComma)) in mustBreakBefore()
5079 if (Left.is(TT_VerilogTypeComma)) in mustBreakBefore()
5084 (Left.is(TT_VerilogInstancePortComma) || in mustBreakBefore()
5085 (Left.is(tok::r_paren) && Keywords.isVerilogIdentifier(Right) && in mustBreakBefore()
5087 Left.MatchingParen->is(TT_VerilogInstancePortLParen)))) { in mustBreakBefore()
5106 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace)) in mustBreakBefore()
5109 if ((Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) && in mustBreakBefore()
5111 Left.is(tok::comma)) { in mustBreakBefore()
5112 if (Right.is(tok::l_brace)) in mustBreakBefore()
5126 if (Line.startsWith(tok::kw_asm) && Right.is(TT_InlineASMColon) && in mustBreakBefore()
5138 (Style.isJavaScript() && Left.is(tok::l_paren))) && in mustBreakBefore()
5145 Right.MatchingParen->is(tok::l_paren)))) { in mustBreakBefore()
5148 if (BeforeClosingBrace && (BeforeClosingBrace->is(tok::comma) || in mustBreakBefore()
5154 if (Right.is(tok::comment)) { in mustBreakBefore()
5162 if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) && in mustBreakBefore()
5163 Right.Next->is(tok::string_literal)) { in mustBreakBefore()
5166 if (Right.is(TT_RequiresClause)) { in mustBreakBefore()
5181 if (Right.is(tok::kw_concept)) in mustBreakBefore()
5196 (Left.is(TT_CtorInitializerComma) || in mustBreakBefore()
5197 Right.is(TT_CtorInitializerColon))) { in mustBreakBefore()
5214 Right.is(TT_CtorInitializerColon)) { in mustBreakBefore()
5219 Left.is(TT_CtorInitializerColon)) { in mustBreakBefore()
5225 Right.is(TT_InheritanceComma)) { in mustBreakBefore()
5229 Left.is(TT_InheritanceComma)) { in mustBreakBefore()
5232 if (Right.is(tok::string_literal) && Right.TokenText.starts_with("R\"")) { in mustBreakBefore()
5238 if ((Left.is(tok::l_brace) || (Left.is(tok::less) && Left.Previous && in mustBreakBefore()
5239 Left.Previous->is(tok::equal))) && in mustBreakBefore()
5245 if (Right.is(TT_InlineASMBrace)) in mustBreakBefore()
5262 FirstNonComment->Next->is(tok::kw_enum)) { in mustBreakBefore()
5270 FirstNonComment->Next->is(Keywords.kw_interface)) || in mustBreakBefore()
5284 if (Left.is(TT_ObjCBlockLBrace) && in mustBreakBefore()
5291 Right.is(TT_ObjCDecl)) { in mustBreakBefore()
5295 if (Left.is(TT_LambdaLBrace)) { in mustBreakBefore()
5309 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace) && in mustBreakBefore()
5310 (Left.isPointerOrReference() || Left.is(TT_TemplateCloser))) { in mustBreakBefore()
5316 Left.is(TT_LeadingJavaAnnotation) && in mustBreakBefore()
5318 (Line.Last->is(tok::l_brace) || Style.BreakAfterJavaFieldAnnotations)) { in mustBreakBefore()
5322 if (Right.is(TT_ProtoExtensionLSquare)) in mustBreakBefore()
5352 if (Style.isProto() && Right.is(TT_SelectorName) && in mustBreakBefore()
5356 if (Left.is(tok::at)) in mustBreakBefore()
5363 if (LBrace && LBrace->is(tok::colon)) { in mustBreakBefore()
5365 if (LBrace && LBrace->is(tok::at)) { in mustBreakBefore()
5380 ((LBrace->is(tok::l_brace) && in mustBreakBefore()
5381 (LBrace->is(TT_DictLiteral) || in mustBreakBefore()
5382 (LBrace->Next && LBrace->Next->is(tok::r_brace)))) || in mustBreakBefore()
5383 LBrace->is(TT_ArrayInitializerLSquare) || LBrace->is(tok::less))) { in mustBreakBefore()
5422 if (Line.First->is(TT_CSharpGenericTypeConstraint)) in canBreakBefore()
5423 return Left.is(TT_CSharpGenericTypeConstraintComma); in canBreakBefore()
5425 if (Right.is(TT_CSharpNullable)) in canBreakBefore()
5454 if (NonComment && NonComment->is(tok::identifier) && in canBreakBefore()
5458 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
5460 if (Left.is(TT_JsTypeColon)) in canBreakBefore()
5463 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
5468 if (Right.is(Keywords.kw_is)) { in canBreakBefore()
5480 if (Left.is(Keywords.kw_in)) in canBreakBefore()
5482 if (Right.is(Keywords.kw_in)) in canBreakBefore()
5484 if (Right.is(Keywords.kw_as)) in canBreakBefore()
5492 if (Left.is(Keywords.kw_as)) in canBreakBefore()
5494 if (Left.is(TT_NonNullAssertion)) in canBreakBefore()
5496 if (Left.is(Keywords.kw_declare) && in canBreakBefore()
5509 if (Right.is(TT_TemplateString) && Right.closesScope()) in canBreakBefore()
5513 if (Left.is(tok::identifier) && Right.is(TT_TemplateString)) in canBreakBefore()
5515 if (Left.is(TT_TemplateString) && Left.opensScope()) in canBreakBefore()
5519 if (Left.is(tok::at)) in canBreakBefore()
5525 if (Right.is(TT_PointerOrReference)) { in canBreakBefore()
5532 Right.is(tok::kw_operator)) { in canBreakBefore()
5535 if (Left.is(TT_PointerOrReference)) in canBreakBefore()
5543 return Left.is(BK_BracedInit) || in canBreakBefore()
5544 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 && in canBreakBefore()
5547 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
5549 if (Right.is(TT_ConditionalExpr) || Right.is(tok::question)) in canBreakBefore()
5551 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
5553 if (Left.is(TT_InheritanceColon)) in canBreakBefore()
5555 if (Right.is(TT_InheritanceColon)) in canBreakBefore()
5557 if (Right.is(TT_ObjCMethodExpr) && Right.isNot(tok::r_square) && in canBreakBefore()
5562 if (Right.is(tok::colon) && in canBreakBefore()
5566 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) { in canBreakBefore()
5594 if (((Right.is(tok::l_brace) || Right.is(tok::less)) && in canBreakBefore()
5595 Right.is(TT_DictLiteral)) || in canBreakBefore()
5596 Right.is(TT_ArrayInitializerLSquare)) { in canBreakBefore()
5602 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
5603 Right.MatchingParen->is(TT_ProtoExtensionLSquare)) { in canBreakBefore()
5606 if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next && in canBreakBefore()
5607 Right.Next->is(TT_ObjCMethodExpr))) { in canBreakBefore()
5610 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
5612 if (Right.is(tok::kw_concept)) in canBreakBefore()
5614 if (Right.is(TT_RequiresClause)) in canBreakBefore()
5616 if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen)) in canBreakBefore()
5624 if (Left.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
5626 if (Right.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
5628 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) in canBreakBefore()
5630 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
5631 (Left.is(tok::less) && Right.is(tok::less))) { in canBreakBefore()
5634 if (Right.is(TT_BinaryOperator) && in canBreakBefore()
5641 Left.is(tok::kw_operator)) { in canBreakBefore()
5644 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
5648 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
5652 if (Left.is(TT_AttributeLParen) || in canBreakBefore()
5653 (Left.is(tok::l_paren) && Left.is(TT_TypeDeclarationParen))) { in canBreakBefore()
5656 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
5660 if (Right.is(TT_ImplicitStringLiteral)) in canBreakBefore()
5663 if (Right.is(TT_TemplateCloser)) in canBreakBefore()
5665 if (Right.is(tok::r_square) && Right.MatchingParen && in canBreakBefore()
5666 Right.MatchingParen->is(TT_LambdaLSquare)) { in canBreakBefore()
5672 if (Right.is(tok::r_brace)) { in canBreakBefore()
5673 return Right.MatchingParen && (Right.MatchingParen->is(BK_Block) || in canBreakBefore()
5678 if (Right.is(tok::r_paren)) { in canBreakBefore()
5684 if (Next && Next->is(tok::r_paren)) in canBreakBefore()
5686 if (Next && Next->is(tok::l_paren)) in canBreakBefore()
5689 return !(Previous && (Previous->is(tok::kw_for) || Previous->isIf())); in canBreakBefore()
5694 if (Left.is(TT_TrailingAnnotation)) { in canBreakBefore()
5702 if (Right.is(tok::l_square) && Right.is(TT_AttributeSquare)) in canBreakBefore()
5705 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
5708 if (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_DictLiteral)) in canBreakBefore()
5711 if (Left.is(TT_CtorInitializerColon)) { in canBreakBefore()
5715 if (Right.is(TT_CtorInitializerColon)) in canBreakBefore()
5717 if (Left.is(TT_CtorInitializerComma) && in canBreakBefore()
5721 if (Right.is(TT_CtorInitializerComma) && in canBreakBefore()
5725 if (Left.is(TT_InheritanceComma) && in canBreakBefore()
5729 if (Right.is(TT_InheritanceComma) && in canBreakBefore()
5733 if (Left.is(TT_ArrayInitializerLSquare)) in canBreakBefore()
5735 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
5737 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && in canBreakBefore()
5744 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
5745 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) { in canBreakBefore()
5750 if (Style.BraceWrapping.BeforeLambdaBody && Right.is(TT_LambdaLBrace)) { in canBreakBefore()
5757 if (Right.is(tok::kw_noexcept) && Right.is(TT_TrailingAnnotation)) { in canBreakBefore()
5764 return Right.Next && Right.Next->is(tok::l_paren); in canBreakBefore()
5773 (Left.is(tok::r_paren) && in canBreakBefore()
5775 (Left.is(tok::l_paren) && Right.isNot(tok::r_paren)) || in canBreakBefore()
5776 (Left.is(TT_TemplateOpener) && Right.isNot(TT_TemplateCloser)); in canBreakBefore()
5837 assert(PointerOrReference.is(tok::star)); in getTokenPointerOrReferenceAlignment()