@@ -805,29 +805,26 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
805
805
};
806
806
// Detecting functions is brittle. It would be better if we could annotate
807
807
// the LParen type of functions/calls.
808
- const auto IsFunctionDeclParen = [&](const FormatToken &Tok) {
808
+ auto IsFunctionDeclParen = [&](const FormatToken &Tok) {
809
809
return Tok.is (tok::l_paren) && Tok.Previous &&
810
810
(Tok.Previous ->is (TT_FunctionDeclarationName) ||
811
- (Tok.Previous ->Previous &&
812
- Tok.Previous ->Previous ->is (tok::coloncolon) &&
813
- Tok.Previous ->Previous ->Previous &&
814
- Tok.Previous ->Previous ->Previous ->is (TT_FunctionDeclarationName)));
811
+ Tok.endsSequence (TT_FunctionDeclarationName, tok::coloncolon));
815
812
};
816
- const auto IsLambdaParameterList = [](const FormatToken *Left ) {
813
+ auto IsLambdaParameterList = [](const FormatToken *Tok ) {
817
814
// adapted from TokenAnnotator.cpp:isLambdaParameterList()
818
815
// Skip <...> if present.
819
- if (Left ->Previous && Left ->Previous ->is (tok::greater) &&
820
- Left ->Previous ->MatchingParen &&
821
- Left ->Previous ->MatchingParen ->is (TT_TemplateOpener)) {
822
- Left = Left ->Previous ->MatchingParen ;
816
+ if (Tok ->Previous && Tok ->Previous ->is (tok::greater) &&
817
+ Tok ->Previous ->MatchingParen &&
818
+ Tok ->Previous ->MatchingParen ->is (TT_TemplateOpener)) {
819
+ Tok = Tok ->Previous ->MatchingParen ;
823
820
}
824
821
825
822
// Check for `[...]`.
826
- return Left ->Previous && Left ->Previous ->is (tok::r_square) &&
827
- Left ->Previous ->MatchingParen &&
828
- Left ->Previous ->MatchingParen ->is (TT_LambdaLSquare);
823
+ return Tok ->Previous && Tok ->Previous ->is (tok::r_square) &&
824
+ Tok ->Previous ->MatchingParen &&
825
+ Tok ->Previous ->MatchingParen ->is (TT_LambdaLSquare);
829
826
};
830
- const auto IsFunctionCallParen = [&](const FormatToken &Tok) {
827
+ auto IsFunctionCallParen = [&](const FormatToken &Tok) {
831
828
return Tok.is (tok::l_paren) && Tok.ParameterCount > 0 && Tok.Previous &&
832
829
Tok.Previous ->is (tok::identifier);
833
830
};
0 commit comments