Lines Matching refs:Left

75     FormatToken *Left = CurrentToken->Previous;  in parseAngle()  local
76 Left->ParentBracket = Contexts.back().ContextKind; in parseAngle()
87 Left->Previous && Left->Previous->Tok.isNot(tok::kw_template); in parseAngle()
95 Left->MatchingParen = CurrentToken; in parseAngle()
96 CurrentToken->MatchingParen = Left; in parseAngle()
103 (Style.Language == FormatStyle::LK_Proto && Left->Previous && in parseAngle()
104 Left->Previous->isOneOf(TT_SelectorName, TT_DictLiteral))) in parseAngle()
132 updateParameterCount(Left, CurrentToken); in parseAngle()
150 FormatToken *Left = CurrentToken->Previous; in parseParens() local
151 Left->ParentBracket = Contexts.back().ContextKind; in parseParens()
159 if (FormatToken *MaybeSel = Left->Previous) { in parseParens()
167 if (Left->is(TT_OverloadedOperatorLParen)) { in parseParens()
176 } else if (Left->Previous && in parseParens()
177 (Left->Previous->isOneOf(tok::kw_static_assert, tok::kw_decltype, in parseParens()
180 Left->Previous->endsSequence(tok::kw_constexpr, tok::kw_if) || in parseParens()
181 Left->Previous->is(TT_BinaryOperator))) { in parseParens()
184 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous && in parseParens()
185 (Left->Previous->is(Keywords.kw_function) || in parseParens()
186 (Left->Previous->endsSequence(tok::identifier, in parseParens()
190 } else if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous && in parseParens()
191 Left->Previous->is(TT_JsTypeColon)) { in parseParens()
194 } else if (Left->Previous && Left->Previous->is(tok::r_square) && in parseParens()
195 Left->Previous->MatchingParen && in parseParens()
196 Left->Previous->MatchingParen->is(TT_LambdaLSquare)) { in parseParens()
200 (!Left->Previous || !Left->Previous->is(tok::identifier))) { in parseParens()
205 } else if (Left->Previous && Left->Previous->is(tok::kw___attribute)) { in parseParens()
206 Left->Type = TT_AttributeParen; in parseParens()
207 } else if (Left->Previous && Left->Previous->is(TT_ForEachMacro)) { in parseParens()
211 } else if (Left->Previous && Left->Previous->MatchingParen && in parseParens()
212 Left->Previous->MatchingParen->is(TT_ObjCBlockLParen)) { in parseParens()
216 Left->Previous && Left->Previous->isOneOf(tok::kw_for, tok::kw_catch); in parseParens()
222 Left->Type = TT_ObjCMethodExpr; in parseParens()
238 Left->Previous && Left->Previous->is(tok::kw_for); in parseParens()
271 Left->Type = Left->Next->is(tok::caret) ? TT_ObjCBlockLParen in parseParens()
273 Left->MatchingParen = CurrentToken; in parseParens()
274 CurrentToken->MatchingParen = Left; in parseParens()
277 Left->Previous && Left->Previous->is(tok::l_paren)) { in parseParens()
281 for (FormatToken *Tok = Left; Tok != CurrentToken; Tok = Tok->Next) { in parseParens()
296 if (Left->is(TT_AttributeParen)) in parseParens()
298 if (Left->Previous && Left->Previous->is(TT_JavaAnnotation)) in parseParens()
300 if (Left->Previous && Left->Previous->is(TT_LeadingJavaAnnotation)) in parseParens()
304 Left->PackingKind = PPK_Inconclusive; in parseParens()
306 Left->PackingKind = PPK_BinPacked; in parseParens()
308 Left->PackingKind = PPK_OnePerLine; in parseParens()
317 Left->Type = TT_Unknown; // Not TT_ObjCBlockLParen in parseParens()
345 updateParameterCount(Left, Tok); in parseParens()
387 FormatToken *Left = CurrentToken->Previous; in parseSquare() local
388 Left->ParentBracket = Contexts.back().ContextKind; in parseSquare()
389 FormatToken *Parent = Left->getPreviousNonComment(); in parseSquare()
399 bool IsCpp11AttributeSpecifier = isCpp11AttributeSpecifier(*Left) || in parseSquare()
406 Left->isNot(TT_LambdaLSquare) && in parseSquare()
418 if (Left->isCppStructuredBinding(Style)) { in parseSquare()
419 Left->Type = TT_StructuredBindingLSquare; in parseSquare()
420 } else if (Left->is(TT_Unknown)) { in parseSquare()
422 Left->Type = TT_ObjCMethodExpr; in parseSquare()
424 Left->Type = TT_AttributeSquare; in parseSquare()
428 Left->Type = TT_JsComputedPropertyName; in parseSquare()
431 Left->Type = TT_DesignatedInitializerLSquare; in parseSquare()
434 Left->Type = TT_ArraySubscriptLSquare; in parseSquare()
463 Left->Type = TT_ArrayInitializerLSquare; in parseSquare()
464 if (!Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
466 !Left->endsSequence(tok::l_square, tok::numeric_constant, in parseSquare()
468 !Left->endsSequence(tok::l_square, tok::colon, TT_SelectorName)) { in parseSquare()
469 Left->Type = TT_ProtoExtensionLSquare; in parseSquare()
478 Left->Type = TT_ArrayInitializerLSquare; in parseSquare()
481 Left->Type = TT_ArraySubscriptLSquare; in parseSquare()
499 Left->is(TT_ObjCMethodExpr)) { in parseSquare()
503 Left->Type = TT_Unknown; in parseSquare()
505 if (StartsObjCMethodExpr && CurrentToken->Previous != Left) { in parseSquare()
519 Left->MatchingParen = CurrentToken; in parseSquare()
520 CurrentToken->MatchingParen = Left; in parseSquare()
532 Left->ParameterCount = in parseSquare()
538 if (Left->BlockParameterCount > 1) in parseSquare()
553 } else if (Left->isOneOf(TT_ArraySubscriptLSquare, in parseSquare()
555 Left->Type = TT_ObjCMethodExpr; in parseSquare()
564 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) && in parseSquare()
566 Left->Type = TT_ArrayInitializerLSquare; in parseSquare()
570 updateParameterCount(Left, Tok); in parseSquare()
577 FormatToken *Left = CurrentToken->Previous; in parseBrace() local
578 Left->ParentBracket = Contexts.back().ContextKind; in parseBrace()
581 Left->Type = TT_ObjCBlockLBrace; in parseBrace()
586 if (Left->BlockKind == BK_BracedInit) in parseBrace()
588 if (Style.Language == FormatStyle::LK_JavaScript && Left->Previous && in parseBrace()
589 Left->Previous->is(TT_JsTypeColon)) in parseBrace()
594 Left->MatchingParen = CurrentToken; in parseBrace()
595 CurrentToken->MatchingParen = Left; in parseBrace()
601 updateParameterCount(Left, CurrentToken); in parseBrace()
610 Left->Type = TT_DictLiteral; in parseBrace()
617 Left->Type = TT_DictLiteral; in parseBrace()
621 Left->Type = TT_DictLiteral; in parseBrace()
629 void updateParameterCount(FormatToken *Left, FormatToken *Current) { in updateParameterCount() argument
634 ++Left->BlockParameterCount; in updateParameterCount()
636 ++Left->ParameterCount; in updateParameterCount()
637 if (!Left->Role) in updateParameterCount()
638 Left->Role.reset(new CommaSeparatedList(Style)); in updateParameterCount()
639 Left->Role->CommaFound(Current); in updateParameterCount()
640 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) { in updateParameterCount()
641 Left->ParameterCount = 1; in updateParameterCount()
2206 const FormatToken &Left = *Tok.Previous; in splitPenalty() local
2209 if (Left.is(tok::semi)) in splitPenalty()
2217 if (Left.is(tok::comma) && Left.NestingLevel == 0) in splitPenalty()
2220 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma)) in splitPenalty()
2222 if (Left.is(TT_JsTypeColon)) in splitPenalty()
2224 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in splitPenalty()
2228 if (Left.opensScope() && Right.closesScope()) in splitPenalty()
2237 if (Left.is(tok::r_square)) in splitPenalty()
2240 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal)) in splitPenalty()
2252 if (Left.is(TT_StartOfName)) in splitPenalty()
2262 if (Left.is(tok::equal) && Right.is(tok::l_brace)) in splitPenalty()
2264 if (Left.is(TT_CastRParen)) in splitPenalty()
2266 if (Left.is(tok::coloncolon) || in splitPenalty()
2269 if (Left.isOneOf(tok::kw_class, tok::kw_struct)) in splitPenalty()
2271 if (Left.is(tok::comment)) in splitPenalty()
2274 if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon, in splitPenalty()
2315 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0); in splitPenalty()
2319 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
2326 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr)) in splitPenalty()
2332 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
2333 Left.Previous->isOneOf(tok::identifier, tok::greater)) in splitPenalty()
2336 if (Left.is(tok::l_paren) && InFunctionDecl && in splitPenalty()
2339 if (Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
2340 (Left.Previous->isOneOf(tok::kw_if, tok::kw_for) || in splitPenalty()
2341 Left.Previous->endsSequence(tok::kw_constexpr, tok::kw_if))) in splitPenalty()
2343 if (Left.is(tok::equal) && InFunctionDecl) in splitPenalty()
2347 if (Left.is(TT_TemplateOpener)) in splitPenalty()
2349 if (Left.opensScope()) { in splitPenalty()
2352 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle) in splitPenalty()
2354 return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter in splitPenalty()
2357 if (Left.is(TT_JavaAnnotation)) in splitPenalty()
2360 if (Left.isOneOf(tok::plus, tok::comma) && Left.Previous && in splitPenalty()
2361 Left.Previous->isLabelString() && in splitPenalty()
2362 (Left.NextOperator || Left.OperatorIndex != 0)) in splitPenalty()
2364 if (Right.is(tok::plus) && Left.isLabelString() && in splitPenalty()
2367 if (Left.is(tok::comma)) in splitPenalty()
2369 if (Right.is(tok::lessless) && Left.isLabelString() && in splitPenalty()
2374 if (!Left.is(tok::r_paren) || Right.OperatorIndex > 0) in splitPenalty()
2379 if (Left.ClosesTemplateDeclaration) in splitPenalty()
2381 if (Left.is(TT_ConditionalExpr)) in splitPenalty()
2383 prec::Level Level = Left.getPrecedence(); in splitPenalty()
2395 const FormatToken &Left, in spaceRequiredBetween() argument
2397 if (Left.is(tok::kw_return) && Right.isNot(tok::semi)) in spaceRequiredBetween()
2399 if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java) in spaceRequiredBetween()
2402 Left.Tok.getObjCKeywordID() == tok::objc_property) in spaceRequiredBetween()
2405 return Left.is(tok::hash); in spaceRequiredBetween()
2406 if (Left.isOneOf(tok::hashhash, tok::hash)) in spaceRequiredBetween()
2408 if (Left.is(tok::l_paren) && Right.is(tok::r_paren)) in spaceRequiredBetween()
2410 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) in spaceRequiredBetween()
2412 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) in spaceRequiredBetween()
2423 if (Right.is(tok::less) && Left.is(tok::kw_template)) in spaceRequiredBetween()
2425 if (Left.isOneOf(tok::exclaim, tok::tilde)) in spaceRequiredBetween()
2427 if (Left.is(tok::at) && in spaceRequiredBetween()
2432 if (Left.is(tok::colon)) in spaceRequiredBetween()
2433 return !Left.is(TT_ObjCMethodExpr); in spaceRequiredBetween()
2434 if (Left.is(tok::coloncolon)) in spaceRequiredBetween()
2436 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) { in spaceRequiredBetween()
2439 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) { in spaceRequiredBetween()
2441 if (Left.is(tok::less) && Right.is(tok::greater)) in spaceRequiredBetween()
2448 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous && in spaceRequiredBetween()
2449 Left.Previous->is(tok::kw_case)); in spaceRequiredBetween()
2450 if (Left.is(tok::l_square) && Right.is(tok::amp)) in spaceRequiredBetween()
2453 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { in spaceRequiredBetween()
2454 if (!Left.MatchingParen) in spaceRequiredBetween()
2457 Left.MatchingParen->getPreviousNonComment(); in spaceRequiredBetween()
2462 return (Left.Tok.isLiteral() || in spaceRequiredBetween()
2463 (!Left.isOneOf(TT_PointerOrReference, tok::l_paren) && in spaceRequiredBetween()
2466 (Left.NestingLevel == 0 || in spaceRequiredBetween()
2467 (Left.NestingLevel == 1 && Line.First->is(tok::kw_for))))))); in spaceRequiredBetween()
2469 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) && in spaceRequiredBetween()
2470 (!Left.is(TT_PointerOrReference) || in spaceRequiredBetween()
2474 if (Left.is(TT_PointerOrReference)) in spaceRequiredBetween()
2483 Left.Previous && in spaceRequiredBetween()
2484 !Left.Previous->isOneOf(tok::l_paren, tok::coloncolon)); in spaceRequiredBetween()
2485 if (Right.is(tok::star) && Left.is(tok::l_paren)) in spaceRequiredBetween()
2496 if (Left.is(tok::l_square)) in spaceRequiredBetween()
2497 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) && in spaceRequiredBetween()
2498 SpaceRequiredForArrayInitializerLSquare(Left, Style)) || in spaceRequiredBetween()
2499 (Left.isOneOf(TT_ArraySubscriptLSquare, in spaceRequiredBetween()
2515 !Left.isOneOf(tok::numeric_constant, TT_DictLiteral)) in spaceRequiredBetween()
2517 if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) in spaceRequiredBetween()
2518 return !Left.Children.empty(); // No spaces in "{}". in spaceRequiredBetween()
2519 if ((Left.is(tok::l_brace) && Left.BlockKind != BK_Block) || in spaceRequiredBetween()
2523 if (Left.is(TT_BlockComment)) in spaceRequiredBetween()
2526 !Left.TokenText.endswith("=*/"); in spaceRequiredBetween()
2528 if ((Left.is(tok::r_paren) && Left.is(TT_AttributeParen)) || in spaceRequiredBetween()
2529 (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) in spaceRequiredBetween()
2531 return Line.Type == LT_ObjCDecl || Left.is(tok::semi) || in spaceRequiredBetween()
2533 (Left.isOneOf(tok::kw_if, tok::pp_elif, tok::kw_for, tok::kw_while, in spaceRequiredBetween()
2536 Left.endsSequence(tok::kw_constexpr, tok::kw_if) || in spaceRequiredBetween()
2537 (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch, in spaceRequiredBetween()
2539 (!Left.Previous || Left.Previous->isNot(tok::period))))) || in spaceRequiredBetween()
2541 (Left.is(tok::identifier) || Left.isFunctionLikeKeyword() || in spaceRequiredBetween()
2542 Left.is(tok::r_paren)) && in spaceRequiredBetween()
2545 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) in spaceRequiredBetween()
2548 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) && in spaceRequiredBetween()
2549 (Left.isNot(tok::colon) || Left.isNot(TT_ObjCMethodExpr)); in spaceRequiredBetween()
2550 if ((Left.isOneOf(tok::identifier, tok::greater, tok::r_square, in spaceRequiredBetween()
2552 Left.isSimpleTypeSpecifier()) && in spaceRequiredBetween()
2556 if (Left.is(tok::period) || Right.is(tok::period)) in spaceRequiredBetween()
2558 if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L") in spaceRequiredBetween()
2560 if (Left.is(TT_TemplateCloser) && Left.MatchingParen && in spaceRequiredBetween()
2561 Left.MatchingParen->Previous && in spaceRequiredBetween()
2562 (Left.MatchingParen->Previous->is(tok::period) || in spaceRequiredBetween()
2563 Left.MatchingParen->Previous->is(tok::coloncolon))) in spaceRequiredBetween()
2568 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) in spaceRequiredBetween()
2570 if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) in spaceRequiredBetween()
2582 const FormatToken &Left = *Right.Previous; in spaceRequiredBefore() local
2583 if (Right.Tok.getIdentifierInfo() && Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
2586 if (Left.is(tok::kw_operator)) in spaceRequiredBefore()
2589 !Left.opensScope() && Style.SpaceBeforeCpp11BracedList) in spaceRequiredBefore()
2594 Left.isOneOf(Keywords.kw_optional, Keywords.kw_required, in spaceRequiredBefore()
2598 Left.isOneOf(Keywords.kw_returns, Keywords.kw_option)) in spaceRequiredBefore()
2600 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName)) in spaceRequiredBefore()
2603 if (Left.is(tok::slash) || Right.is(tok::slash)) in spaceRequiredBefore()
2605 if (Left.MatchingParen && Left.MatchingParen->is(TT_ProtoExtensionLSquare) && in spaceRequiredBefore()
2609 if (Left.is(tok::percent)) in spaceRequiredBefore()
2613 if (Left.is(tok::numeric_constant) && Right.is(tok::percent)) in spaceRequiredBefore()
2616 if (Left.is(TT_JsFatArrow)) in spaceRequiredBefore()
2619 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous && in spaceRequiredBefore()
2620 Left.Previous->is(tok::kw_for)) in spaceRequiredBefore()
2622 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) && in spaceRequiredBefore()
2630 if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) || in spaceRequiredBefore()
2636 if (Left.is(tok::identifier) && Keywords.IsJavaScriptIdentifier(Left) && in spaceRequiredBefore()
2640 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield)) in spaceRequiredBefore()
2643 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield, in spaceRequiredBefore()
2648 if (Line.MustBeDeclaration && Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
2652 if (Left.Previous && Left.Previous->is(tok::period) && in spaceRequiredBefore()
2653 Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
2656 if (Left.isOneOf(tok::kw_throw, Keywords.kw_await, Keywords.kw_typeof, in spaceRequiredBefore()
2660 if ((Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in, in spaceRequiredBefore()
2665 (Left.is(Keywords.kw_of) && Left.Previous && in spaceRequiredBefore()
2666 (Left.Previous->Tok.is(tok::identifier) || in spaceRequiredBefore()
2667 Left.Previous->isOneOf(tok::r_square, tok::r_brace)))) && in spaceRequiredBefore()
2668 (!Left.Previous || !Left.Previous->is(tok::period))) in spaceRequiredBefore()
2670 if (Left.isOneOf(tok::kw_for, Keywords.kw_as) && Left.Previous && in spaceRequiredBefore()
2671 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) in spaceRequiredBefore()
2673 if (Left.is(Keywords.kw_as) && in spaceRequiredBefore()
2676 if (Left.is(tok::kw_default) && Left.Previous && in spaceRequiredBefore()
2677 Left.Previous->is(tok::kw_export)) in spaceRequiredBefore()
2679 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace)) in spaceRequiredBefore()
2683 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator)) in spaceRequiredBefore()
2685 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) && in spaceRequiredBefore()
2688 if (Left.is(tok::ellipsis)) in spaceRequiredBefore()
2690 if (Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
2699 if (Left.is(TT_JsNonNullAssertion) && in spaceRequiredBefore()
2703 if (Left.is(tok::r_square) && Right.is(tok::l_brace)) in spaceRequiredBefore()
2705 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) in spaceRequiredBefore()
2707 if ((Left.isOneOf(tok::kw_static, tok::kw_public, tok::kw_private, in spaceRequiredBefore()
2709 Left.isOneOf(Keywords.kw_final, Keywords.kw_abstract, in spaceRequiredBefore()
2714 if (Left.is(TT_ImplicitStringLiteral)) in spaceRequiredBefore()
2717 if (Left.is(TT_ObjCMethodSpecifier)) in spaceRequiredBefore()
2719 if (Left.is(tok::r_paren) && canBeObjCSelectorComponent(Right)) in spaceRequiredBefore()
2726 (Right.is(tok::equal) || Left.is(tok::equal))) in spaceRequiredBefore()
2730 Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow)) in spaceRequiredBefore()
2734 if (Left.is(tok::comma)) in spaceRequiredBefore()
2753 if (Left.is(tok::question)) in spaceRequiredBefore()
2755 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon)) in spaceRequiredBefore()
2763 if (Left.is(TT_UnaryOperator)) in spaceRequiredBefore()
2768 if (Left.is(TT_CastRParen)) in spaceRequiredBefore()
2772 if (Left.is(tok::greater) && Right.is(tok::greater)) { in spaceRequiredBefore()
2774 (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) in spaceRequiredBefore()
2776 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && in spaceRequiredBefore()
2780 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) || in spaceRequiredBefore()
2787 (Left.is(tok::identifier) || Left.is(tok::kw_this))) in spaceRequiredBefore()
2789 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) in spaceRequiredBefore()
2794 if (Right.is(tok::coloncolon) && !Left.isOneOf(tok::l_brace, tok::comment)) in spaceRequiredBefore()
2795 return (Left.is(TT_TemplateOpener) && in spaceRequiredBefore()
2797 !(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square, in spaceRequiredBefore()
2800 (Left.is(tok ::l_paren) && Style.SpacesInParentheses); in spaceRequiredBefore()
2801 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) in spaceRequiredBefore()
2805 return !Left.isOneOf(tok::amp, tok::ampamp) || in spaceRequiredBefore()
2811 if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || in spaceRequiredBefore()
2812 (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && in spaceRequiredBefore()
2815 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_paren) && in spaceRequiredBefore()
2818 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) && in spaceRequiredBefore()
2819 Left.MatchingParen && Left.MatchingParen->is(TT_OverloadedOperatorLParen)) in spaceRequiredBefore()
2821 if (Right.is(tok::less) && Left.isNot(tok::l_paren) && in spaceRequiredBefore()
2826 if (Left.is(TT_RegexLiteral)) in spaceRequiredBefore()
2828 return spaceRequiredBetween(Line, Left, Right); in spaceRequiredBefore()
2839 const FormatToken &Left = *Right.Previous; in mustBreakBefore() local
2845 if (Right.is(tok::string_literal) && Left.is(tok::plus) && Left.Previous && in mustBreakBefore()
2846 Left.Previous->is(tok::string_literal)) in mustBreakBefore()
2848 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
2849 Left.Previous && Left.Previous->is(tok::equal) && in mustBreakBefore()
2858 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
2866 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && in mustBreakBefore()
2867 !Left.Children.empty()) in mustBreakBefore()
2871 (Left.NestingLevel == 0 && Line.Level == 0 && in mustBreakBefore()
2875 if (Right.is(tok::plus) && Left.is(tok::string_literal) && Right.Next && in mustBreakBefore()
2883 if (Left.isStringLiteral() && Right.isStringLiteral()) in mustBreakBefore()
2893 if ((Left.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) || in mustBreakBefore()
2895 Left.is(tok::l_paren))) && in mustBreakBefore()
2896 Left.BlockKind != BK_Block && Left.MatchingParen) in mustBreakBefore()
2897 BeforeClosingBrace = Left.MatchingParen->Previous; in mustBreakBefore()
2903 BeforeClosingBrace = &Left; in mustBreakBefore()
2910 return Left.BlockKind != BK_BracedInit && in mustBreakBefore()
2911 Left.isNot(TT_CtorInitializerColon) && in mustBreakBefore()
2913 if (Left.isTrailingComment()) in mustBreakBefore()
2953 if (isAllmanBrace(Left) || isAllmanBrace(Right)) in mustBreakBefore()
2959 if (Left.is(TT_ObjCBlockLBrace) && !Style.AllowShortBlocksOnASingleLine) in mustBreakBefore()
2964 Left.is(TT_LeadingJavaAnnotation) && in mustBreakBefore()
3038 if (Left.ParameterCount == 0) in mustBreakBefore()
3053 if (Left.isOneOf(tok::r_brace, tok::greater, tok::r_square)) in mustBreakBefore()
3062 Left.is(tok::l_paren) && Left.BlockParameterCount > 0 && in mustBreakBefore()
3065 if (Left.BlockParameterCount > 1) in mustBreakBefore()
3069 if (!Left.Role) in mustBreakBefore()
3071 auto Comma = Left.Role->lastComma(); in mustBreakBefore()
3086 const FormatToken &Left = *Right.Previous; in canBreakBefore() local
3090 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends, in canBreakBefore()
3107 (Left.Tok.getIdentifierInfo() || in canBreakBefore()
3108 Left.isOneOf(tok::r_square, tok::r_paren)) && in canBreakBefore()
3111 if (Left.is(TT_JsFatArrow) && Right.is(tok::l_brace)) in canBreakBefore()
3113 if (Left.is(TT_JsTypeColon)) in canBreakBefore()
3116 if (Left.is(tok::exclaim) && Right.is(tok::colon)) in canBreakBefore()
3133 if (Left.is(Keywords.kw_in)) in canBreakBefore()
3145 if (Left.is(Keywords.kw_as)) in canBreakBefore()
3147 if (Left.is(TT_JsNonNullAssertion)) in canBreakBefore()
3149 if (Left.is(Keywords.kw_declare) && in canBreakBefore()
3157 if (Left.isOneOf(Keywords.kw_module, tok::kw_namespace) && in canBreakBefore()
3162 if (Left.is(TT_TemplateString) && Left.opensScope()) in canBreakBefore()
3166 if (Left.is(tok::at)) in canBreakBefore()
3168 if (Left.Tok.getObjCKeywordID() == tok::objc_interface) in canBreakBefore()
3170 if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation)) in canBreakBefore()
3179 if (Left.is(TT_PointerOrReference)) in canBreakBefore()
3187 return Left.BlockKind == BK_BracedInit || in canBreakBefore()
3188 (Left.is(TT_CtorInitializerColon) && in canBreakBefore()
3190 if (Left.is(tok::question) && Right.is(tok::colon)) in canBreakBefore()
3194 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question)) in canBreakBefore()
3196 if (Left.is(TT_InheritanceColon)) in canBreakBefore()
3201 Left.isNot(TT_SelectorName)) in canBreakBefore()
3207 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) { in canBreakBefore()
3248 return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls. in canBreakBefore()
3249 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
3251 if (Left.ClosesTemplateDeclaration || Left.is(TT_FunctionAnnotationRParen)) in canBreakBefore()
3256 if (Left.is(TT_RangeBasedForLoopColon)) in canBreakBefore()
3260 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener)) in canBreakBefore()
3262 if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) || in canBreakBefore()
3263 Left.is(tok::kw_operator)) in canBreakBefore()
3265 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) && in canBreakBefore()
3266 Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0) in canBreakBefore()
3268 if (Left.is(tok::equal) && Right.is(tok::l_brace) && in canBreakBefore()
3271 if (Left.is(tok::l_paren) && Left.is(TT_AttributeParen)) in canBreakBefore()
3273 if (Left.is(tok::l_paren) && Left.Previous && in canBreakBefore()
3274 (Left.Previous->isOneOf(TT_BinaryOperator, TT_CastRParen))) in canBreakBefore()
3292 if (Left.is(TT_TrailingAnnotation)) in canBreakBefore()
3300 if (Left.is(tok::identifier) && Right.is(tok::string_literal)) in canBreakBefore()
3306 if (Left.is(TT_CtorInitializerColon)) in canBreakBefore()
3310 if (Left.is(TT_CtorInitializerComma) && in canBreakBefore()
3316 if (Left.is(TT_InheritanceComma) && in canBreakBefore()
3322 if ((Left.is(tok::greater) && Right.is(tok::greater)) || in canBreakBefore()
3323 (Left.is(tok::less) && Right.is(tok::less))) in canBreakBefore()
3330 if (Left.is(TT_ArrayInitializerLSquare)) in canBreakBefore()
3332 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const)) in canBreakBefore()
3334 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) && in canBreakBefore()
3335 !Left.isOneOf(tok::arrowstar, tok::lessless) && in canBreakBefore()
3338 Left.getPrecedence() == prec::Assignment)) in canBreakBefore()
3340 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) || in canBreakBefore()
3341 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) in canBreakBefore()
3343 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace, in canBreakBefore()
3348 (Left.is(tok::r_paren) && in canBreakBefore()
3350 (Left.is(tok::l_paren) && !Right.is(tok::r_paren)) || in canBreakBefore()
3351 (Left.is(TT_TemplateOpener) && !Right.is(TT_TemplateCloser)); in canBreakBefore()