@@ -766,7 +766,8 @@ class AnnotatingParser {
766
766
}
767
767
// An arrow after an ObjC method expression is not a lambda arrow.
768
768
if (CurrentToken->getType () == TT_ObjCMethodExpr &&
769
- CurrentToken->Next && CurrentToken->Next ->is (TT_LambdaArrow)) {
769
+ CurrentToken->Next &&
770
+ CurrentToken->Next ->is (TT_TrailingReturnArrow)) {
770
771
CurrentToken->Next ->overwriteFixedType (TT_Unknown);
771
772
}
772
773
Left->MatchingParen = CurrentToken;
@@ -1409,10 +1410,8 @@ class AnnotatingParser {
1409
1410
}
1410
1411
break ;
1411
1412
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))
1414
1414
Tok->setType (TT_TrailingReturnArrow);
1415
- }
1416
1415
break ;
1417
1416
default :
1418
1417
break ;
@@ -1689,11 +1688,11 @@ class AnnotatingParser {
1689
1688
TT_LambdaLSquare, TT_LambdaLBrace, TT_AttributeMacro, TT_IfMacro,
1690
1689
TT_ForEachMacro, TT_TypenameMacro, TT_FunctionLBrace,
1691
1690
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,
1697
1696
TT_RequiresClauseInARequiresExpression, TT_RequiresExpression,
1698
1697
TT_RequiresExpressionLParen, TT_RequiresExpressionLBrace,
1699
1698
TT_BracedListLBrace)) {
@@ -1876,7 +1875,7 @@ class AnnotatingParser {
1876
1875
Contexts.back ().IsExpression = true ;
1877
1876
} else if (Current.is (TT_TrailingReturnArrow)) {
1878
1877
Contexts.back ().IsExpression = false ;
1879
- } else if (Current.is (TT_LambdaArrow) || Current. is ( Keywords.kw_assert )) {
1878
+ } else if (Current.is (Keywords.kw_assert )) {
1880
1879
Contexts.back ().IsExpression = Style .Language == FormatStyle::LK_Java;
1881
1880
} else if (Current.Previous &&
1882
1881
Current.Previous ->is (TT_CtorInitializerColon)) {
@@ -2010,7 +2009,7 @@ class AnnotatingParser {
2010
2009
AutoFound = true ;
2011
2010
} else if (Current.is (tok::arrow) &&
2012
2011
Style .Language == FormatStyle::LK_Java) {
2013
- Current.setType (TT_LambdaArrow );
2012
+ Current.setType (TT_TrailingReturnArrow );
2014
2013
} else if (Current.is (tok::arrow) && AutoFound &&
2015
2014
Line.MightBeFunctionDecl && Current.NestingLevel == 0 &&
2016
2015
!Current.Previous ->isOneOf (tok::kw_operator, tok::identifier)) {
@@ -2857,7 +2856,7 @@ class ExpressionParser {
2857
2856
}
2858
2857
if (Current->is (TT_JsComputedPropertyName))
2859
2858
return prec::Assignment;
2860
- if (Current->is (TT_LambdaArrow ))
2859
+ if (Current->is (TT_TrailingReturnArrow ))
2861
2860
return prec::Comma;
2862
2861
if (Current->is (TT_FatArrow))
2863
2862
return prec::Assignment;
@@ -3742,7 +3741,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
3742
3741
}
3743
3742
if (Right.is (TT_PointerOrReference))
3744
3743
return 190 ;
3745
- if (Right.is (TT_LambdaArrow ))
3744
+ if (Right.is (TT_TrailingReturnArrow ))
3746
3745
return 110 ;
3747
3746
if (Left.is (tok::equal) && Right.is (tok::l_brace))
3748
3747
return 160 ;
@@ -4744,10 +4743,9 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
4744
4743
return false ;
4745
4744
}
4746
4745
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))
4749
4747
return true ;
4750
- }
4748
+
4751
4749
if (Left.is (tok::comma) && Right.isNot (TT_OverloadedOperatorLParen) &&
4752
4750
// In an unexpanded macro call we only find the parentheses and commas
4753
4751
// in a line; the commas and closing parenthesis do not require a space.
@@ -5724,8 +5722,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
5724
5722
return Left.isOneOf (tok::comma, tok::coloncolon, tok::semi, tok::l_brace,
5725
5723
tok::kw_class, tok::kw_struct, tok::comment) ||
5726
5724
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) ||
5729
5727
(Left.is (tok::r_paren) &&
5730
5728
Right.isOneOf (tok::identifier, tok::kw_const)) ||
5731
5729
(Left.is (tok::l_paren) && Right.isNot (tok::r_paren)) ||
0 commit comments