@@ -766,7 +766,8 @@ class AnnotatingParser {
766766 }
767767 // An arrow after an ObjC method expression is not a lambda arrow.
768768 if (CurrentToken->getType () == TT_ObjCMethodExpr &&
769- CurrentToken->Next && CurrentToken->Next ->is (TT_LambdaArrow)) {
769+ CurrentToken->Next &&
770+ CurrentToken->Next ->is (TT_TrailingReturnArrow)) {
770771 CurrentToken->Next ->overwriteFixedType (TT_Unknown);
771772 }
772773 Left->MatchingParen = CurrentToken;
@@ -1409,10 +1410,8 @@ class AnnotatingParser {
14091410 }
14101411 break ;
14111412 case tok::arrow:
1412- if (Tok->isNot (TT_LambdaArrow) && Tok->Previous &&
1413- Tok->Previous ->is (tok::kw_noexcept)) {
1413+ if (Tok->Previous && Tok->Previous ->is (tok::kw_noexcept))
14141414 Tok->setType (TT_TrailingReturnArrow);
1415- }
14161415 break ;
14171416 default :
14181417 break ;
@@ -1689,11 +1688,11 @@ class AnnotatingParser {
16891688 TT_LambdaLSquare, TT_LambdaLBrace, TT_AttributeMacro, TT_IfMacro,
16901689 TT_ForEachMacro, TT_TypenameMacro, TT_FunctionLBrace,
16911690 TT_ImplicitStringLiteral, TT_InlineASMBrace, TT_FatArrow,
1692- TT_LambdaArrow, TT_NamespaceMacro, TT_OverloadedOperator,
1693- TT_RegexLiteral, TT_TemplateString, TT_ObjCStringLiteral,
1694- TT_UntouchableMacroFunc, TT_StatementAttributeLikeMacro ,
1695- TT_FunctionLikeOrFreestandingMacro, TT_ClassLBrace, TT_EnumLBrace,
1696- TT_RecordLBrace, TT_StructLBrace, TT_UnionLBrace, TT_RequiresClause,
1691+ TT_NamespaceMacro, TT_OverloadedOperator, TT_RegexLiteral ,
1692+ TT_TemplateString, TT_ObjCStringLiteral, TT_UntouchableMacroFunc ,
1693+ TT_StatementAttributeLikeMacro, TT_FunctionLikeOrFreestandingMacro ,
1694+ TT_ClassLBrace, TT_EnumLBrace, TT_RecordLBrace, TT_StructLBrace ,
1695+ TT_UnionLBrace, TT_RequiresClause,
16971696 TT_RequiresClauseInARequiresExpression, TT_RequiresExpression,
16981697 TT_RequiresExpressionLParen, TT_RequiresExpressionLBrace,
16991698 TT_BracedListLBrace)) {
@@ -1876,7 +1875,7 @@ class AnnotatingParser {
18761875 Contexts.back ().IsExpression = true ;
18771876 } else if (Current.is (TT_TrailingReturnArrow)) {
18781877 Contexts.back ().IsExpression = false ;
1879- } else if (Current.is (TT_LambdaArrow) || Current. is ( Keywords.kw_assert )) {
1878+ } else if (Current.is (Keywords.kw_assert )) {
18801879 Contexts.back ().IsExpression = Style.Language == FormatStyle::LK_Java;
18811880 } else if (Current.Previous &&
18821881 Current.Previous ->is (TT_CtorInitializerColon)) {
@@ -2010,7 +2009,7 @@ class AnnotatingParser {
20102009 AutoFound = true ;
20112010 } else if (Current.is (tok::arrow) &&
20122011 Style.Language == FormatStyle::LK_Java) {
2013- Current.setType (TT_LambdaArrow );
2012+ Current.setType (TT_TrailingReturnArrow );
20142013 } else if (Current.is (tok::arrow) && AutoFound &&
20152014 Line.MightBeFunctionDecl && Current.NestingLevel == 0 &&
20162015 !Current.Previous ->isOneOf (tok::kw_operator, tok::identifier)) {
@@ -2857,7 +2856,7 @@ class ExpressionParser {
28572856 }
28582857 if (Current->is (TT_JsComputedPropertyName))
28592858 return prec::Assignment;
2860- if (Current->is (TT_LambdaArrow ))
2859+ if (Current->is (TT_TrailingReturnArrow ))
28612860 return prec::Comma;
28622861 if (Current->is (TT_FatArrow))
28632862 return prec::Assignment;
@@ -3742,7 +3741,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
37423741 }
37433742 if (Right.is (TT_PointerOrReference))
37443743 return 190 ;
3745- if (Right.is (TT_LambdaArrow ))
3744+ if (Right.is (TT_TrailingReturnArrow ))
37463745 return 110 ;
37473746 if (Left.is (tok::equal) && Right.is (tok::l_brace))
37483747 return 160 ;
@@ -4744,10 +4743,9 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
47444743 return false ;
47454744 }
47464745
4747- if (Right.isOneOf (TT_TrailingReturnArrow, TT_LambdaArrow) ||
4748- Left.isOneOf (TT_TrailingReturnArrow, TT_LambdaArrow)) {
4746+ if (Right.is (TT_TrailingReturnArrow) || Left.is (TT_TrailingReturnArrow))
47494747 return true ;
4750- }
4748+
47514749 if (Left.is (tok::comma) && Right.isNot (TT_OverloadedOperatorLParen) &&
47524750 // In an unexpanded macro call we only find the parentheses and commas
47534751 // in a line; the commas and closing parenthesis do not require a space.
@@ -5724,8 +5722,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
57245722 return Left.isOneOf (tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
57255723 tok::kw_class, tok::kw_struct, tok::comment) ||
57265724 Right.isMemberAccess () ||
5727- Right.isOneOf (TT_TrailingReturnArrow, TT_LambdaArrow , tok::lessless ,
5728- tok::colon, tok:: l_square, tok::at) ||
5725+ Right.isOneOf (TT_TrailingReturnArrow, tok::lessless , tok::colon ,
5726+ tok::l_square, tok::at) ||
57295727 (Left.is (tok::r_paren) &&
57305728 Right.isOneOf (tok::identifier, tok::kw_const)) ||
57315729 (Left.is (tok::l_paren) && Right.isNot (tok::r_paren)) ||
0 commit comments