Lines Matching refs:Current

331   void updateParameterCount(FormatToken *Left, FormatToken *Current) {
332 if (Current->Type == TT_LambdaLSquare ||
333 (Current->is(tok::caret) && Current->Type == TT_UnaryOperator) ||
335 Current->TokenText == "function")) {
338 if (Current->is(tok::comma)) {
342 Left->Role->CommaFound(Current);
343 } else if (Left->ParameterCount == 0 && Current->isNot(tok::comment)) {
692 void determineTokenType(FormatToken &Current) {
693 if (Current.getPrecedence() == prec::Assignment &&
695 (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) {
697 for (FormatToken *Previous = Current.Previous;
707 } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) {
709 } else if (Current.is(tok::l_paren) && !Line.MustBeDeclaration &&
711 (!Current.Previous ||
712 Current.Previous->isNot(tok::kw_decltype))) {
714 Current.Previous && Current.Previous->is(tok::r_paren) &&
715 Current.Previous->MatchingParen &&
716 Current.Previous->MatchingParen->Type == TT_FunctionTypeLParen;
717 bool IsForOrCatch = Current.Previous &&
718 Current.Previous->isOneOf(tok::kw_for, tok::kw_catch);
720 } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) {
721 for (FormatToken *Previous = Current.Previous;
725 } else if (Current.Previous &&
726 Current.Previous->Type == TT_CtorInitializerColon) {
729 } else if (Current.is(tok::kw_new)) {
731 } else if (Current.is(tok::semi) || Current.is(tok::exclaim)) {
736 if (Current.Type == TT_Unknown) {
738 // function declaration have been found. In this case, 'Current' is a
740 if (isStartOfName(Current) && !Line.MightBeFunctionDecl) {
741 Contexts.back().FirstStartOfName = &Current;
742 Current.Type = TT_StartOfName;
743 } else if (Current.is(tok::kw_auto)) {
745 } else if (Current.is(tok::arrow) && AutoFound &&
747 Current.Type = TT_TrailingReturnArrow;
748 } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) {
749 Current.Type =
750 determineStarAmpUsage(Current, Contexts.back().CanBeExpression &&
753 } else if (Current.isOneOf(tok::minus, tok::plus, tok::caret)) {
754 Current.Type = determinePlusMinusCaretUsage(Current);
755 if (Current.Type == TT_UnaryOperator && Current.is(tok::caret))
757 } else if (Current.isOneOf(tok::minusminus, tok::plusplus)) {
758 Current.Type = determineIncrementUsage(Current);
759 } else if (Current.is(tok::exclaim)) {
760 Current.Type = TT_UnaryOperator;
761 } else if (Current.is(tok::question)) {
762 Current.Type = TT_ConditionalExpr;
763 } else if (Current.isBinaryOperator() &&
764 (!Current.Previous ||
765 Current.Previous->isNot(tok::l_square))) {
766 Current.Type = TT_BinaryOperator;
767 } else if (Current.is(tok::comment)) {
768 if (Current.TokenText.startswith("//"))
769 Current.Type = TT_LineComment;
771 Current.Type = TT_BlockComment;
772 } else if (Current.is(tok::r_paren)) {
773 if (rParenEndsCast(Current))
774 Current.Type = TT_CastRParen;
775 } else if (Current.is(tok::at) && Current.Next) {
776 switch (Current.Next->Tok.getObjCKeywordID()) {
780 Current.Type = TT_ObjCDecl;
783 Current.Type = TT_ObjCProperty;
788 } else if (Current.is(tok::period)) {
789 FormatToken *PreviousNoComment = Current.getPreviousNonComment();
792 Current.Type = TT_DesignatedInitializerPeriod;
793 } else if (Current.isOneOf(tok::identifier, tok::kw_const) &&
794 Current.Previous && Current.Previous->isNot(tok::equal) &&
798 Current.Type = TT_TrailingAnnotation;
1003 ExpressionParser(AnnotatedLine &Line) : Current(Line.First) {
1005 if (Current->is(tok::r_brace))
1013 while (Current &&
1014 (Current->is(tok::kw_return) ||
1015 (Current->is(tok::colon) && (Current->Type == TT_ObjCMethodExpr ||
1016 Current->Type == TT_DictLiteral))))
1019 if (!Current || Precedence > PrecedenceArrowAndPeriod)
1035 FormatToken *Start = Current;
1039 while (Current) {
1045 if (Current && Current->Type == TT_SelectorName &&
1049 Start = Current;
1054 if (!Current || Current->closesScope() ||
1069 if (Current->opensScope()) {
1070 while (Current && !Current->closesScope()) {
1078 LatestOperator = Current;
1079 Current->OperatorIndex = OperatorIndex;
1092 if (Current) {
1093 if (Current->Type == TT_ConditionalExpr)
1095 else if (Current->is(tok::semi) || Current->Type == TT_InlineASMColon ||
1096 Current->Type == TT_SelectorName)
1098 else if (Current->Type == TT_RangeBasedForLoopColon)
1100 else if (Current->Type == TT_BinaryOperator || Current->is(tok::comma))
1101 return Current->getPrecedence();
1102 else if (Current->isOneOf(tok::period, tok::arrow))
1112 if (Current) {
1113 ++Current->Previous->FakeRParens;
1115 Current->Previous->EndsBinaryExpression = true;
1122 if (!Current || Current->Type != TT_UnaryOperator) {
1127 FormatToken *Start = Current;
1136 FormatToken *Start = Current;
1138 if (!Current || !Current->is(tok::question))
1142 if (!Current || Current->Type != TT_ConditionalExpr)
1150 if (Current)
1151 Current = Current->Next;
1152 while (Current && Current->isTrailingComment())
1153 Current = Current->Next;
1156 FormatToken *Current;
1202 // This function heuristically determines whether 'Current' starts the name of a
1204 static bool isFunctionDeclarationName(const FormatToken &Current) {
1205 if (Current.Type != TT_StartOfName ||
1206 Current.NestingLevel != 0 ||
1207 Current.Previous->Type == TT_StartOfName)
1209 const FormatToken *Next = Current.Next;
1250 FormatToken *Current = Line.First->Next;
1252 while (Current) {
1253 if (isFunctionDeclarationName(*Current))
1254 Current->Type = TT_FunctionDeclarationName;
1255 if (Current->Type == TT_LineComment) {
1256 if (Current->Previous->BlockKind == BK_BracedInit &&
1257 Current->Previous->opensScope())
1258 Current->SpacesRequiredBefore = Style.Cpp11BracedListStyle ? 0 : 1;
1260 Current->SpacesRequiredBefore = Style.SpacesBeforeTrailingComments;
1269 if (!Current->HasUnescapedNewline) {
1270 for (FormatToken *Parameter = Current->Previous; Parameter;
1282 } else if (Current->SpacesRequiredBefore == 0 &&
1283 spaceRequiredBefore(Line, *Current)) {
1284 Current->SpacesRequiredBefore = 1;
1287 Current->MustBreakBefore =
1288 Current->MustBreakBefore || mustBreakBefore(Line, *Current);
1290 Current->CanBreakBefore =
1291 Current->MustBreakBefore || canBreakBefore(Line, *Current);
1293 if (Current->Previous->Children.size() == 1) {
1294 FormatToken &LastOfChild = *Current->Previous->Children[0]->Last;
1298 if (Current->MustBreakBefore || Current->Previous->Children.size() > 1 ||
1299 Current->IsMultiline)
1300 Current->TotalLength = Current->Previous->TotalLength + Style.ColumnLimit;
1302 Current->TotalLength = Current->Previous->TotalLength +
1303 Current->ColumnWidth + ChildSize +
1304 Current->SpacesRequiredBefore;
1306 if (Current->Type == TT_CtorInitializerColon)
1312 Current->SplitPenalty = 20 * Current->BindingStrength +
1313 splitPenalty(Line, *Current, InFunctionDecl);
1315 Current = Current->Next;
1319 for (Current = Line.First; Current != nullptr; Current = Current->Next) {
1320 if (Current->Role)
1321 Current->Role->precomputeFormattingInfos(Current);
1329 FormatToken *Current = Line.Last;
1330 while (Current) {
1331 Current->UnbreakableTailLength = UnbreakableTailLength;
1332 if (Current->CanBreakBefore ||
1333 Current->isOneOf(tok::comment, tok::string_literal)) {
1337 Current->ColumnWidth + Current->SpacesRequiredBefore;
1339 Current = Current->Previous;