Lines Matching full:left
63 /// With `Left` being '(', check if we're at either `[...](` or
65 static bool isLambdaParameterList(const FormatToken *Left) {
67 if (Left->Previous && Left->Previous->is(tok::greater) &&
68 Left->Previous->MatchingParen &&
69 Left->Previous->MatchingParen->is(TT_TemplateOpener)) {
70 Left = Left->Previous->MatchingParen;
74 return Left->Previous && Left->Previous->is(tok::r_square) &&
75 Left->Previous->MatchingParen &&
76 Left->Previous->MatchingParen->is(TT_LambdaLSquare);
175 FormatToken *Left = CurrentToken->Previous;
176 Left->ParentBracket = Contexts.back().ContextKind;
180 const auto *BeforeLess = Left->Previous;
204 Left->ParentBracket != tok::less &&
216 Left->MatchingParen = CurrentToken;
217 CurrentToken->MatchingParen = Left;
258 updateParameterCount(Left, CurrentToken);
680 FormatToken *Left = CurrentToken->Previous;
681 Left->ParentBracket = Contexts.back().ContextKind;
682 FormatToken *Parent = Left->getPreviousNonComment();
694 isCppAttribute(IsCpp, *Left) || IsInnerSquare;
698 isCSharpAttributeSpecifier(*Left) ||
702 bool IsCppStructuredBinding = Left->isCppStructuredBinding(IsCpp);
706 Contexts.back().CanBeExpression && Left->isNot(TT_LambdaLSquare) &&
720 Left->setType(TT_StructuredBindingLSquare);
721 } else if (Left->is(TT_Unknown)) {
723 Left->setType(TT_ObjCMethodExpr);
725 Left->setType(TT_InlineASMSymbolicNameLSquare);
727 Left->setType(TT_AttributeSquare);
728 if (!IsInnerSquare && Left->Previous)
729 Left->Previous->EndsCppAttributeGroup = false;
733 Left->setType(TT_JsComputedPropertyName);
736 Left->setType(TT_DesignatedInitializerLSquare);
738 Left->setType(TT_AttributeSquare);
741 Left->setType(TT_ArraySubscriptLSquare);
769 Left->setType(TT_ArrayInitializerLSquare);
770 if (!Left->endsSequence(tok::l_square, tok::numeric_constant,
772 !Left->endsSequence(tok::l_square, tok::numeric_constant,
774 !Left->endsSequence(tok::l_square, tok::colon, TT_SelectorName)) {
775 Left->setType(TT_ProtoExtensionLSquare);
784 Left->setType(TT_ArrayInitializerLSquare);
787 Left->setType(TT_ArraySubscriptLSquare);
812 CurrentToken->Previous->Previous == Left)) &&
813 Left->is(TT_ObjCMethodExpr)) {
819 Left->setType(TT_Unknown);
821 if (StartsObjCMethodExpr && CurrentToken->Previous != Left) {
841 Left->MatchingParen = CurrentToken;
842 CurrentToken->MatchingParen = Left;
854 Left->ParameterCount =
860 if (Left->BlockParameterCount > 1)
863 if (Style.isTableGen() && Left->is(TT_TableGenListOpener))
878 Left->isOneOf(TT_ArraySubscriptLSquare,
880 Left->setType(TT_ObjCMethodExpr);
890 if (CurrentToken->is(tok::comma) && Left->is(TT_ObjCMethodExpr) &&
892 Left->setType(TT_ArrayInitializerLSquare);
905 updateParameterCount(Left, Tok);
910 updateParameterCount(Left, Tok);
1246 void updateParameterCount(FormatToken *Left, FormatToken *Current) {
1251 ++Left->BlockParameterCount;
1253 ++Left->ParameterCount;
1254 if (!Left->Role)
1255 Left->Role.reset(new CommaSeparatedList(Style));
1256 Left->Role->CommaFound(Current);
1257 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) {
1258 Left->ParameterCount = 1;
1517 // In the following example all 4 left parentheses will be treated as
1838 // We still want to format the whitespace left of the first token of the
2703 // If there is a closing parenthesis left of the current
4144 const FormatToken &Left = *Tok.Previous;
4147 if (Left.is(tok::semi))
4156 if (Left.is(tok::comma) && Left.NestingLevel == 0)
4159 if (Right.is(Keywords.kw_function) && Left.isNot(tok::comma))
4161 if (Left.is(TT_JsTypeColon))
4163 if ((Left.is(TT_TemplateString) && Left.TokenText.ends_with("${")) ||
4168 if (Left.opensScope() && Right.closesScope())
4180 if (Left.is(tok::r_square))
4183 if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal))
4192 if (Left.is(tok::coloncolon))
4198 if (Left.is(TT_StartOfName))
4208 if (Left.is(tok::equal) && Right.is(tok::l_brace))
4210 if (Left.is(TT_CastRParen))
4212 if (Left.isOneOf(tok::kw_class, tok::kw_struct, tok::kw_union))
4214 if (Left.is(tok::comment))
4217 if (Left.isOneOf(TT_RangeBasedForLoopColon, TT_InheritanceColon,
4259 return (Left.is(tok::r_paren) ? 100 : 120) + (is_short_annotation ? 50 : 0);
4263 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal))
4270 if (Left.is(tok::colon) && Left.is(TT_ObjCMethodExpr))
4276 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous &&
4277 Left.Previous->isOneOf(tok::identifier, tok::greater)) {
4281 if (Left.is(tok::l_paren) && Style.PenaltyBreakOpenParenthesis != 0)
4283 if (Left.is(tok::l_paren) && InFunctionDecl &&
4287 if (Left.is(tok::l_paren) && Left.Previous &&
4288 (Left.Previous->isOneOf(tok::kw_for, tok::kw__Generic) ||
4289 Left.Previous->isIf())) {
4292 if (Left.is(tok::equal) && InFunctionDecl)
4296 if (Left.is(TT_TemplateOpener))
4298 if (Left.opensScope()) {
4303 (Left.ParameterCount <= 1 || Style.AllowAllArgumentsOnNextLine)) {
4306 if (Left.is(tok::l_brace) && !Style.Cpp11BracedListStyle)
4308 return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter
4311 if (Left.is(TT_JavaAnnotation))
4314 if (Left.is(TT_UnaryOperator))
4316 if (Left.isOneOf(tok::plus, tok::comma) && Left.Previous &&
4317 Left.Previous->isLabelString() &&
4318 (Left.NextOperator || Left.OperatorIndex != 0)) {
4321 if (Right.is(tok::plus) && Left.isLabelString() &&
4325 if (Left.is(tok::comma))
4327 if (Right.is(tok::lessless) && Left.isLabelString() &&
4333 if (Left.isNot(tok::r_paren) || Right.OperatorIndex > 0) {
4339 if (Left.ClosesTemplateDeclaration)
4341 if (Left.ClosesRequiresClause)
4343 if (Left.is(TT_ConditionalExpr))
4345 prec::Level Level = Left.getPrecedence();
4371 const FormatToken &Left,
4373 if (Left.is(tok::kw_return) &&
4377 if (Left.is(tok::kw_throw) && Right.is(tok::l_paren) && Right.MatchingParen &&
4381 if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java)
4384 Left.Tok.getObjCKeywordID() == tok::objc_property) {
4388 return Left.is(tok::hash);
4389 if (Left.isOneOf(tok::hashhash, tok::hash))
4391 if (Left.is(BK_Block) && Right.is(tok::r_brace) &&
4392 Right.MatchingParen == &Left && Line.Children.empty()) {
4395 if ((Left.is(tok::l_paren) && Right.is(tok::r_paren)) ||
4396 (Left.is(tok::l_brace) && Left.isNot(BK_Block) &&
4402 Left.is(tok::r_paren) && Right.is(tok::r_paren)) {
4403 auto *InnerLParen = Left.MatchingParen;
4411 if (Left.is(tok::l_paren))
4412 LeftParen = &Left;
4424 if (Left.is(tok::kw_auto) && Right.isOneOf(TT_LambdaLBrace, TT_FunctionLBrace,
4431 if (Left.is(tok::kw_auto) && Right.isOneOf(tok::l_paren, tok::l_brace))
4434 const auto *BeforeLeft = Left.Previous;
4437 if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) && BeforeLeft &&
4442 if (Left.isOneOf(tok::kw_co_await, tok::kw_co_yield, tok::kw_co_return) &&
4447 if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) {
4449 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen)))
4461 if (Right.is(tok::less) && Left.is(tok::kw_template))
4463 if (Left.isOneOf(tok::exclaim, tok::tilde))
4465 if (Left.is(tok::at) &&
4471 if (Left.is(tok::colon))
4472 return Left.isNot(TT_ObjCMethodExpr);
4473 if (Left.is(tok::coloncolon))
4475 if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) {
4478 (Left.is(TT_DictLiteral) || Right.is(TT_DictLiteral)))) {
4480 if (Left.is(tok::less) && Right.is(tok::greater))
4489 return Left.Tok.isLiteral() || (Left.is(tok::identifier) && BeforeLeft &&
4492 if (Left.is(tok::l_square) && Right.is(tok::amp))
4495 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) {
4496 if (!Left.MatchingParen)
4499 Left.MatchingParen->getPreviousNonComment();
4500 if (!TokenBeforeMatchingParen || Left.isNot(TT_TypeDeclarationParen))
4508 (Left.is(TT_AttributeRParen) ||
4509 Left.canBePointerOrReferenceQualifier())) {
4512 if (Left.Tok.isLiteral())
4515 if (Left.isTypeOrIdentifier(LangOpts) && Right.Next && Right.Next->Next &&
4520 return !Left.isOneOf(TT_PointerOrReference, tok::l_paren) &&
4524 (Left.NestingLevel == 0 ||
4525 (Left.NestingLevel == 1 && startsWithInitStatement(Line)))));
4527 if (Right.is(TT_FunctionTypeLParen) && Left.isNot(tok::l_paren) &&
4528 (Left.isNot(TT_PointerOrReference) ||
4529 (getTokenPointerOrReferenceAlignment(Left) != FormatStyle::PAS_Right &&
4533 if (Left.is(TT_PointerOrReference)) {
4560 return getTokenPointerOrReferenceAlignment(Left) !=
4567 if (getTokenPointerOrReferenceAlignment(Left) == FormatStyle::PAS_Right)
4576 (Left.NestingLevel == Line.First->NestingLevel ||
4577 ((Left.NestingLevel == Line.First->NestingLevel + 1) &&
4584 if (Left.isNot(tok::star))
4596 if (Left.is(tok::ellipsis) && BeforeLeft &&
4601 if (Right.is(tok::star) && Left.is(tok::l_paren))
4603 if (Left.is(tok::star) && Right.isPointerOrReference())
4606 const FormatToken *Previous = &Left;
4645 if (Style.isCSharp() && Left.is(Keywords.kw_is) && Right.is(tok::l_square))
4654 if (Left.is(tok::l_square)) {
4655 return (Left.is(TT_ArrayInitializerLSquare) && Right.isNot(tok::r_square) &&
4656 SpaceRequiredForArrayInitializerLSquare(Left, Style)) ||
4657 (Left.isOneOf(TT_ArraySubscriptLSquare, TT_StructuredBindingLSquare,
4675 !Left.isOneOf(tok::numeric_constant, TT_DictLiteral) &&
4676 !(Left.isNot(tok::r_square) && Style.SpaceBeforeSquareBrackets &&
4680 if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
4681 return !Left.Children.empty(); // No spaces in "{}".
4682 if ((Left.is(tok::l_brace) && Left.isNot(BK_Block)) ||
4687 if (Left.is(TT_BlockComment)) {
4689 return Style.isJavaScript() || !Left.TokenText.ends_with("=*/");
4694 if (Left.is(TT_TemplateCloser) && Right.is(TT_AttributeSquare))
4698 if (Left.is(TT_TemplateCloser) && Right.isNot(TT_FunctionTypeLParen))
4700 if (Left.isOneOf(TT_RequiresClause,
4705 if (Left.is(TT_RequiresExpression)) {
4709 if (Left.is(TT_AttributeRParen) ||
4710 (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) {
4713 if (Left.is(TT_ForEachMacro)) {
4717 if (Left.is(TT_IfMacro)) {
4722 Left.isOneOf(tok::kw_new, tok::kw_delete) &&
4724 !(Line.MightBeFunctionDecl && Left.is(TT_FunctionDeclarationName))) {
4729 if (Left.is(tok::semi))
4731 if (Left.isOneOf(tok::pp_elif, tok::kw_for, tok::kw_while, tok::kw_switch,
4733 Left.isIf(Line.Type != LT_PreprocessorDirective) ||
4753 if (Line.Type != LT_PreprocessorDirective && Left.is(tok::r_square) &&
4754 Left.MatchingParen && Left.MatchingParen->is(TT_LambdaLSquare)) {
4759 if (Left.isOneOf(tok::kw_try, Keywords.kw___except, tok::kw_catch)) {
4763 if (Left.isOneOf(tok::kw_new, tok::kw_delete)) {
4769 if (Left.is(tok::r_square) && Left.MatchingParen &&
4770 Left.MatchingParen->Previous &&
4771 Left.MatchingParen->Previous->is(tok::kw_delete)) {
4778 (Left.Tok.getIdentifierInfo() || Left.is(tok::r_paren))) {
4783 if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword)
4786 return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) &&
4787 (Left.isNot(tok::colon) || Left.isNot(TT_ObjCMethodExpr));
4794 (Left.isOneOf(tok::identifier, tok::greater, tok::r_square,
4796 Left.isTypeName(LangOpts)) &&
4801 if (Left.is(tok::period) || Right.is(tok::period))
4805 if (Right.is(tok::hash) && Left.is(tok::identifier) &&
4806 (Left.TokenText == "L" || Left.TokenText == "u" ||
4807 Left.TokenText == "U" || Left.TokenText == "u8" ||
4808 Left.TokenText == "LR" || Left.TokenText == "uR" ||
4809 Left.TokenText == "UR" || Left.TokenText == "u8R")) {
4812 if (Left.is(TT_TemplateCloser) && Left.MatchingParen &&
4813 Left.MatchingParen->Previous &&
4814 (Left.MatchingParen->Previous->is(tok::period) ||
4815 Left.MatchingParen->Previous->is(tok::coloncolon))) {
4821 if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square))
4823 if (Left.is(tok::l_brace) && Left.endsSequence(TT_DictLiteral, tok::at)) {
4833 Left.isOneOf(tok::kw_const, tok::kw_volatile) &&
4846 const FormatToken &Left = *Right.Previous;
4850 if (Left.Finalized)
4858 Keywords.isWordLike(Left, IsVerilog)) {
4864 if (Left.is(tok::star) && Right.is(tok::comment))
4868 if (Left.is(TT_OverloadedOperator) &&
4873 if (Right.is(tok::period) && Left.is(tok::numeric_constant))
4877 if (Left.is(Keywords.kw_import) && Right.isOneOf(tok::less, tok::ellipsis))
4880 if (Left.isOneOf(Keywords.kw_module, Keywords.kw_import) &&
4885 if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon))
4888 if (Left.is(TT_ModulePartitionColon) &&
4892 if (Left.is(tok::ellipsis) && Right.is(tok::identifier) &&
4897 if (Left.isOneOf(TT_AttributeRParen, TT_AttributeMacro) &&
4902 if (Left.is(tok::kw_operator))
4905 !Left.opensScope() && Style.SpaceBeforeCpp11BracedList) {
4908 if (Left.is(tok::less) && Left.is(TT_OverloadedOperator) &&
4913 if (Left.is(tok::identifier) && Right.is(tok::numeric_constant))
4915 // `Left` is a keyword (including C++ alternative operator) or identifier.
4916 if (Left.Tok.getIdentifierInfo() && Right.Tok.isLiteral())
4920 Left.isOneOf(Keywords.kw_optional, Keywords.kw_required,
4925 Left.isOneOf(Keywords.kw_returns, Keywords.kw_option)) {
4928 if (Right.isOneOf(tok::l_brace, tok::less) && Left.is(TT_SelectorName))
4931 if (Left.is(tok::slash) || Right.is(tok::slash))
4933 if (Left.MatchingParen &&
4934 Left.MatchingParen->is(TT_ProtoExtensionLSquare) &&
4939 if (Left.is(tok::percent))
4943 if (Left.is(tok::numeric_constant) && Right.is(tok::percent))
4946 if (Right.is(tok::colon) && Left.is(tok::string_literal))
4954 if (Left.is(tok::kw_this) && Right.is(tok::l_square))
4958 if (Left.is(tok::kw_new) && Right.is(tok::l_paren))
4966 if (Left.is(tok::l_brace) && Right.isNot(tok::r_brace))
4969 if (Left.isNot(tok::l_brace) && Right.is(tok::r_brace))
4973 if (Left.is(TT_FatArrow) || Right.is(TT_FatArrow))
4977 if (Left.is(TT_AttributeColon) || Right.is(TT_AttributeColon))
4981 if (Left.is(TT_TemplateCloser) && Right.is(TT_StartOfName))
4985 if (Left.is(tok::l_square) || Right.is(tok::r_square))
4997 if (Left.is(tok::comma) && Right.is(tok::comma))
5001 if (Left.is(Keywords.kw_var) && Right.is(tok::l_paren))
5006 if (Left.isOneOf(tok::kw_using, Keywords.kw_async, Keywords.kw_when,
5015 if ((Left.isAccessSpecifierKeyword() ||
5016 Left.isOneOf(tok::kw_virtual, tok::kw_extern, tok::kw_static,
5024 if (Left.is(TT_FatArrow))
5027 if (Right.is(tok::l_paren) && Left.is(Keywords.kw_await) && Left.Previous &&
5028 Left.Previous->is(tok::kw_for)) {
5031 if (Left.is(Keywords.kw_async) && Right.is(tok::l_paren) &&
5039 if ((Left.is(TT_TemplateString) && Left.TokenText.ends_with("${")) ||
5045 if (Keywords.isJavaScriptIdentifier(Left,
5051 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield)) {
5055 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield,
5061 if (Line.MustBeDeclaration && Left.Tok.getIdentifierInfo())
5065 if (Left.Previous && Left.Previous->is(tok::period) &&
5066 Left.Tok.getIdentifierInfo()) {
5070 if (Left.isOneOf(tok::kw_throw, Keywords.kw_await, Keywords.kw_typeof,
5076 if (Left.endsSequence(tok::kw_const, Keywords.kw_as))
5078 if ((Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in,
5083 (Left.is(Keywords.kw_of) && Left.Previous &&
5084 (Left.Previous->is(tok::identifier) ||
5085 Left.Previous->isOneOf(tok::r_square, tok::r_brace)))) &&
5086 (!Left.Previous || Left.Previous->isNot(tok::period))) {
5089 if (Left.isOneOf(tok::kw_for, Keywords.kw_as) && Left.Previous &&
5090 Left.Previous->is(tok::period) && Right.is(tok::l_paren)) {
5093 if (Left.is(Keywords.kw_as) &&
5097 if (Left.is(tok::kw_default) && Left.Previous &&
5098 Left.Previous->is(tok::kw_export)) {
5101 if (Left.is(Keywords.kw_is) && Right.is(tok::l_brace))
5105 if (Left.is(TT_JsTypeOperator) || Right.is(TT_JsTypeOperator))
5107 if ((Left.is(tok::l_brace) || Right.is(tok::r_brace)) &&
5111 if (Left.is(tok::ellipsis))
5113 if (Left.is(TT_TemplateCloser) &&
5123 if (Left.is(TT_NonNullAssertion) &&
5128 if (Left.is(TT_CaseLabelArrow) || Right.is(TT_CaseLabelArrow))
5130 if (Left.is(tok::r_square) && Right.is(tok::l_brace))
5133 if (Left.is(tok::l_square) || Right.is(tok::r_square))
5136 if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren)) {
5140 if ((Left.isAccessSpecifierKeyword() ||
5141 Left.isOneOf(tok::kw_static, Keywords.kw_final, Keywords.kw_abstract,
5148 if (Left.is(tok::identifier) && Left.TokenText[0] == '\\')
5152 if ((Left.is(TT_VerilogTableItem) &&
5154 (Right.is(TT_VerilogTableItem) && Left.isNot(tok::l_paren))) {
5159 if (Left.isNot(TT_BinaryOperator) &&
5160 Left.isOneOf(Keywords.kw_verilogHash, Keywords.kw_verilogHashHash)) {
5165 (Left.endsSequence(tok::numeric_constant, Keywords.kw_verilogHash) ||
5166 Left.endsSequence(tok::numeric_constant,
5168 (Left.is(tok::r_paren) && Left.MatchingParen &&
5169 Left.MatchingParen->endsSequence(tok::l_paren, tok::at)))) {
5174 if (Left.is(Keywords.kw_apostrophe) ||
5175 (Left.is(TT_VerilogNumberBase) && Right.is(tok::numeric_constant))) {
5179 if (Left.is(tok::arrow) || Right.is(tok::arrow))
5184 if (Left.is(tok::at) && Right.isOneOf(tok::l_paren, tok::star, tok::at))
5188 Left.isOneOf(TT_VerilogDimensionedTypeName, Keywords.kw_function)) {
5193 Keywords.isVerilogIdentifier(Left) && Left.getPreviousNonComment() &&
5194 Left.getPreviousNonComment()->is(Keywords.kw_tagged)) {
5202 !(Left.isOneOf(Keywords.kw_assign, Keywords.kw_unique) ||
5203 Keywords.isVerilogWordOperator(Left)) &&
5204 (Left.isOneOf(tok::r_square, tok::r_paren, tok::r_brace,
5206 Keywords.isWordLike(Left))) {
5210 if ((Right.is(tok::star) && Left.is(tok::coloncolon)) ||
5211 (Left.is(tok::star) && Right.is(tok::semi))) {
5215 if (Left.endsSequence(tok::star, tok::l_paren) && Right.is(tok::identifier))
5221 if ((Left.is(tok::l_brace) &&
5223 (Left.endsSequence(tok::lessless, tok::l_brace) ||
5224 Left.endsSequence(tok::greatergreater, tok::l_brace))) {
5229 if (Left.is(tok::l_square) && Right.is(tok::l_brace))
5231 if (Left.is(tok::r_brace) && Right.is(tok::r_square))
5236 Left.isOneOf(TT_TableGenDAGArgListColon,
5242 if (Left.isOneOf(TT_TableGenDAGArgOperatorID,
5249 Left.isOneOf(TT_TableGenBangOperator, TT_TableGenCondOperator)) {
5254 if (Left.is(TT_TableGenTrailingPasteOperator) &&
5259 if (Left.is(tok::hash) || Right.is(tok::hash))
5262 if (Keywords.isTableGenDefinition(Left))
5266 if (Left.is(TT_ImplicitStringLiteral))
5269 if (Left.is(TT_ObjCMethodSpecifier))
5271 if (Left.is(tok::r_paren) && Left.isNot(TT_AttributeRParen) &&
5280 (Right.is(tok::equal) || Left.is(tok::equal))) {
5285 Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow)) {
5288 if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) &&
5291 (Left.Children.empty() || !Left.MacroParent)) {
5306 if (Left.is(TT_BitFieldColon)) {
5320 if (Left.is(tok::question))
5322 if (Right.is(TT_InlineASMColon) && Left.is(tok::coloncolon))
5339 if ((Left.isOneOf(tok::minus, tok::minusminus) &&
5341 (Left.isOneOf(tok::plus, tok::plusplus) &&
5345 if (Left.is(TT_UnaryOperator)) {
5348 if (Left.is(tok::amp) && Right.is(tok::r_square))
5350 return Style.SpaceAfterLogicalNot && Left.is(tok::exclaim);
5355 if (Left.is(TT_CastRParen)) {
5368 if (Left.is(tok::greater) && Right.is(tok::greater)) {
5370 (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) {
5373 return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) &&
5378 Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) ||
5382 if (!Style.SpaceBeforeAssignmentOperators && Left.isNot(TT_TemplateCloser) &&
5387 (Left.is(tok::identifier) || Left.is(tok::kw_this))) {
5390 if (Right.is(tok::coloncolon) && Left.is(tok::identifier)) {
5397 !Left.isOneOf(tok::l_brace, tok::comment, tok::l_paren)) {
5399 return (Left.is(TT_TemplateOpener) &&
5402 !(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square,
5405 (Left.is(tok::l_paren) && Style.SpacesInParensOptions.Other);
5407 if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser)))
5411 return !Left.isOneOf(tok::amp, tok::ampamp) ||
5412 getTokenReferenceAlignment(Left) != FormatStyle::PAS_Right;
5419 if ((Right.is(TT_BinaryOperator) && Left.isNot(tok::l_paren)) ||
5420 (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) &&
5424 if (Right.is(TT_TemplateOpener) && Left.is(tok::r_paren) &&
5425 Left.MatchingParen &&
5426 Left.MatchingParen->is(TT_OverloadedOperatorLParen)) {
5429 if (Right.is(tok::less) && Left.isNot(tok::l_paren) &&
5435 if (Left.is(TT_RegexLiteral))
5437 return spaceRequiredBetween(Line, Left, Right);
5465 const FormatToken &Left = *Right.Previous;
5470 Line.mightBeFunctionDefinition() && Left.MightBeFunctionDeclParen &&
5471 Left.ParameterCount > 0) {
5475 const auto *BeforeLeft = Left.Previous;
5479 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace) &&
5484 Left.is(TT_CSharpNamedArgumentColon)) {
5496 if (Left.is(TT_AttributeSquare) && Left.is(tok::r_square) &&
5502 if (Left.is(TT_AttributeSquare) && Right.is(TT_AttributeSquare) &&
5503 Left.is(tok::r_square) && Right.is(tok::l_square)) {
5508 if (Right.is(tok::string_literal) && Left.is(tok::plus) && BeforeLeft &&
5512 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 &&
5523 if (Left.is(tok::l_brace) && Line.Level == 0 &&
5532 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) && BeforeLeft &&
5541 return !Left.Children.empty();
5545 return (Left.NestingLevel == 0 && Line.Level == 0) &&
5546 !Left.Children.empty();
5551 if (Right.is(tok::r_brace) && Left.is(tok::l_brace) &&
5552 !Left.Children.empty()) {
5556 (Left.NestingLevel == 0 && Line.Level == 0 &&
5561 if (Right.is(tok::plus) && Left.is(tok::string_literal) && AfterRight &&
5567 if (Left.is(TT_VerilogAssignComma))
5570 if (Left.is(TT_VerilogTypeComma))
5575 (Left.is(TT_VerilogInstancePortComma) ||
5576 (Left.is(tok::r_paren) && Keywords.isVerilogIdentifier(Right) &&
5577 Left.MatchingParen &&
5578 Left.MatchingParen->is(TT_VerilogInstancePortLParen)))) {
5583 if (!Keywords.isVerilogBegin(Right) && Keywords.isVerilogEndOfLabel(Left))
5588 if (Left.isStringLiteral() && Right.isStringLiteral())
5597 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace))
5600 if ((Left.is(TT_ArrayInitializerLSquare) && Left.is(tok::l_square) &&
5602 Left.is(tok::comma)) {
5619 if (Left.is(TT_TableGenCondOperatorComma))
5621 if (Left.is(TT_TableGenDAGArgOperatorToBreak) &&
5625 if (Left.is(TT_TableGenDAGArgListCommaToBreak))
5629 &Left != Right.MatchingParen->Next) {
5646 if ((Left.isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) ||
5647 (Style.isJavaScript() && Left.is(tok::l_paren))) &&
5648 Left.isNot(BK_Block) && Left.MatchingParen) {
5649 BeforeClosingBrace = Left.MatchingParen->Previous;
5655 BeforeClosingBrace = &Left;
5664 return Left.isNot(BK_BracedInit) && Left.isNot(TT_CtorInitializerColon) &&
5667 if (Left.isTrailingComment())
5669 if (Left.IsUnterminatedLiteral)
5673 Left.is(tok::string_literal) && Right.is(tok::lessless) && AfterRight &&
5688 if (Left.ClosesTemplateDeclaration && Left.MatchingParen &&
5689 Left.MatchingParen->NestingLevel == 0) {
5699 if (Left.ClosesRequiresClause && Right.isNot(tok::semi)) {
5710 (Left.is(TT_CtorInitializerComma) ||
5716 Left.isOneOf(TT_CtorInitializerColon, TT_CtorInitializerComma)) {
5733 Left.is(TT_CtorInitializerColon)) {
5743 Left.is(TT_InheritanceComma)) {
5752 if ((Left.is(tok::l_brace) ||
5753 (Left.is(tok::less) && BeforeLeft && BeforeLeft->is(tok::equal))) &&
5762 if (isAllmanBrace(Left) || isAllmanBrace(Right)) {
5797 if (Left.is(TT_ObjCBlockLBrace) &&
5803 if (Left.isOneOf(TT_AttributeRParen, TT_AttributeMacro) &&
5808 if (Left.is(TT_LambdaLBrace)) {
5809 if (IsFunctionArgument(Left) &&
5816 (!Left.Children.empty() &&
5823 (Left.isPointerOrReference() || Left.is(TT_TemplateCloser))) {
5829 Left.is(TT_LeadingJavaAnnotation) &&
5869 if (Left.is(tok::at))
5897 // If Left.ParameterCount is 0, then this submessage entry is not the
5899 // If Left.ParameterCount is greater than 0, then its parent submessage
5903 if (Left.ParameterCount == 0)
5906 // submessage, Left.ParameterCount might be 1 in some cases.
5913 // left---. .---right
5918 if (Left.isOneOf(tok::r_brace, tok::greater, tok::r_square))
5927 const FormatToken &Left = *Right.Previous;
5930 if (Left.isOneOf(TT_CSharpNamedArgumentColon, TT_AttributeColon) ||
5936 return Left.is(TT_CSharpGenericTypeConstraintComma);
5941 if (Left.isOneOf(Keywords.kw_throws, Keywords.kw_extends,
5962 (Left.Tok.getIdentifierInfo() ||
5963 Left.isOneOf(tok::r_square, tok::r_paren)) &&
5971 if (Left.is(TT_FatArrow) && Right.is(tok::l_brace))
5973 if (Left.is(TT_JsTypeColon))
5976 if (Left.is(tok::exclaim) && Right.is(tok::colon))
5993 if (Left.is(Keywords.kw_in))
6005 if (Left.is(Keywords.kw_as))
6007 if (Left.is(TT_NonNullAssertion))
6009 if (Left.is(Keywords.kw_declare) &&
6018 if (Left.isOneOf(Keywords.kw_module, tok::kw_namespace) &&
6026 if (Left.is(tok::identifier) && Right.is(TT_TemplateString))
6028 if (Left.is(TT_TemplateString) && Left.opensScope())
6032 if (Keywords.isTableGenDefinition(Left))
6036 return !Left.isOneOf(TT_TableGenBangOperator, TT_TableGenCondOperator,
6040 if (Left.is(TT_TableGenValueSuffix))
6043 if (Left.is(tok::hash) || Right.is(tok::hash))
6045 if (Left.isOneOf(TT_TableGenBangOperator, TT_TableGenCondOperator))
6049 if (Left.is(tok::at))
6051 if (Left.Tok.getObjCKeywordID() == tok::objc_interface)
6053 if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation))
6065 if (Left.is(TT_PointerOrReference))
6073 return Left.is(BK_BracedInit) ||
6074 (Left.is(TT_CtorInitializerColon) && Right.NewlinesBefore > 0 &&
6077 if (Left.is(tok::question) && Right.is(tok::colon))
6081 if (Left.is(TT_ConditionalExpr) || Left.is(tok::question))
6083 if (Left.is(TT_InheritanceColon))
6088 Left.isNot(TT_SelectorName)) {
6096 if (Left.is(tok::colon) && Left.isOneOf(TT_DictLiteral, TT_ObjCMethodExpr)) {
6138 return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls.
6140 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty)
6146 if (Left.ClosesTemplateDeclaration) {
6150 if (Left.is(TT_FunctionAnnotationRParen))
6152 if (Left.ClosesRequiresClause)
6158 if (Left.is(TT_RangeBasedForLoopColon))
6162 if (Left.is(TT_TemplateCloser) && Right.is(TT_TemplateOpener))
6164 if ((Left.is(tok::greater) && Right.is(tok::greater)) ||
6165 (Left.is(tok::less) && Right.is(tok::less))) {
6174 if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) ||
6175 Left.is(tok::kw_operator)) {
6178 if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) &&
6179 Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0) {
6182 if (Left.is(tok::equal) && Right.is(tok::l_brace) &&
6186 if (Left.is(TT_AttributeLParen) ||
6187 (Left.is(tok::l_paren) && Left.is(TT_TypeDeclarationParen))) {
6190 if (Left.is(tok::l_paren) && Left.Previous &&
6191 (Left.Previous->isOneOf(TT_BinaryOperator, TT_CastRParen))) {
6228 if (Left.is(TT_TrailingAnnotation)) {
6237 return Left.isNot(TT_AttributeSquare);
6239 if (Left.is(tok::identifier) && Right.is(tok::string_literal))
6245 if (Left.is(TT_CtorInitializerColon)) {
6251 if (Left.is(TT_CtorInitializerComma) &&
6259 if (Left.is(TT_InheritanceComma) &&
6267 if (Left.is(TT_ArrayInitializerLSquare))
6269 if (Right.is(tok::kw_typename) && Left.isNot(tok::kw_const))
6271 if ((Left.isBinaryOperator() || Left.is(TT_BinaryOperator)) &&
6272 !Left.isOneOf(tok::arrowstar, tok::lessless) &&
6275 Left.getPrecedence() == prec::Assignment)) {
6278 if ((Left.is(TT_AttributeSquare) && Right.is(tok::l_square)) ||
6279 (Left.is(tok::r_square) && Right.is(TT_AttributeSquare))) {
6285 if (isAllmanLambdaBrace(Left))
6286 return !isItAnEmptyLambdaAllowed(Left, ShortLambdaOption);
6302 return Left.isOneOf(tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
6307 (Left.is(tok::r_paren) &&
6309 (Left.is(tok::l_paren) && Right.isNot(tok::r_paren)) ||
6310 (Left.is(TT_TemplateOpener) && Right.isNot(TT_TemplateCloser));