Lines Matching refs:Current

47 // Returns \c true if \c Current starts a new parameter.
48 static bool startsNextParameter(const FormatToken &Current,
50 const FormatToken &Previous = *Current.Previous;
51 if (Current.Type == TT_CtorInitializerComma &&
54 return Previous.is(tok::comma) && !Current.isTrailingComment() &&
92 const FormatToken &Current = *State.NextToken;
93 const FormatToken &Previous = *Current.Previous;
94 assert(&Previous == Current.Previous);
95 if (!Current.CanBreakBefore && !(State.Stack.back().BreakBeforeClosingBrace &&
96 Current.closesBlockTypeList(Style)))
100 if (!Current.MustBreakBefore && Previous.is(tok::l_brace) &&
113 if (Current.isMemberAccess() && State.Stack.back().ContainsUnwrappedBuilder)
128 const FormatToken &Current = *State.NextToken;
129 const FormatToken &Previous = *Current.Previous;
130 if (Current.MustBreakBefore || Current.Type == TT_InlineASMColon)
133 Current.closesBlockTypeList(Style))
137 if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
139 (Current.is(tok::question) || (Current.Type == TT_ConditionalExpr &&
143 State.Stack.back().BreakBeforeParameter && !Current.isTrailingComment() &&
144 !Current.isOneOf(tok::r_paren, tok::r_brace))
157 if (Current.Type == TT_CtorInitializerColon &&
185 Current.Type != TT_BinaryOperator && // For >>.
186 !Current.isTrailingComment() && !Previous.is(tok::lessless) &&
193 if (Current.is(tok::lessless) && Current.Type != TT_OverloadedOperator &&
198 if (Current.Type == TT_SelectorName &&
202 if (Previous.ClosesTemplateDeclaration && Current.NestingLevel == 0 &&
203 !Current.isTrailingComment())
207 if ((Current.Type == TT_FunctionDeclarationName ||
208 Current.is(tok::kw_operator)) &&
212 if (startsSegmentOfBuilderTypeCall(Current) &&
222 Previous.is(tok::l_brace) && !Current.isOneOf(tok::r_brace, tok::comment))
231 const FormatToken &Current = *State.NextToken;
234 if ((Current.Type == TT_ImplicitStringLiteral &&
235 (Current.Previous->Tok.getIdentifierInfo() == nullptr ||
236 Current.Previous->Tok.getIdentifierInfo()->getPPKeywordID() ==
259 FormatToken &Current = *State.NextToken;
261 if (Current.is(tok::equal) &&
262 (State.Line->First->is(tok::kw_for) || Current.NestingLevel == 0) &&
277 unsigned Spaces = Current.SpacesRequiredBefore + ExtraSpaces;
280 Whitespaces.replaceWhitespace(Current, /*Newlines=*/0, /*IndentLevel=*/0,
283 if (Current.Type == TT_SelectorName &&
285 if (Current.LongestObjCSelectorName == 0)
287 else if (State.Stack.back().Indent + Current.LongestObjCSelectorName >
288 State.Column + Spaces + Current.ColumnWidth)
290 State.Stack.back().Indent + Current.LongestObjCSelectorName;
292 State.Stack.back().ColonPos = State.Column + Spaces + Current.ColumnWidth;
296 (Current.Type != TT_LineComment || Previous.BlockKind == BK_BracedInit))
298 if (State.Stack.back().AvoidBinPacking && startsNextParameter(Current, Style))
300 if (startsSegmentOfBuilderTypeCall(Current))
304 if (Current.isNot(tok::comment) && Previous.is(tok::l_paren) &&
309 else if (!Current.isOneOf(tok::comment, tok::caret) &&
319 Current.StartsBinaryExpression))
346 FormatToken &Current = *State.NextToken;
353 const FormatToken *PreviousNonComment = Current.getPreviousNonComment();
356 NextNonComment = &Current;
412 if (Previous.Type == TT_TemplateCloser && Current.NestingLevel == 0)
420 1u, std::min(Current.NewlinesBefore, Style.MaxEmptyLinesToKeep + 1));
421 Whitespaces.replaceWhitespace(Current, Newlines,
426 if (!Current.isTrailingComment())
428 State.StartOfLineLevel = Current.NestingLevel;
429 State.LowestLevelOnLine = Current.NestingLevel;
434 Current.is(tok::r_brace) &&
447 Current.Type != TT_BinaryOperator && !PreviousNonComment->opensScope())
475 FormatToken &Current = *State.NextToken;
481 const FormatToken *PreviousNonComment = Current.getPreviousNonComment();
484 NextNonComment = &Current;
486 return Current.NestingLevel == 0 ? State.FirstIndent
488 if (Current.isOneOf(tok::r_brace, tok::r_square)) {
492 if (Current.closesBlockTypeList(Style) ||
493 (Current.MatchingParen &&
494 Current.MatchingParen->BlockKind == BK_BracedInit))
499 if (Current.is(tok::identifier) && Current.Next &&
500 Current.Next->Type == TT_DictLiteral)
573 const FormatToken &Current = *State.NextToken;
575 if (Current.Type == TT_InheritanceColon)
577 if (Current.is(tok::lessless) && Current.Type != TT_OverloadedOperator) {
583 if ((Current.Type == TT_BinaryOperator && Current.isNot(tok::lessless)) ||
584 Current.Type == TT_ConditionalExpr)
586 if (Current.Type == TT_ArraySubscriptLSquare &&
589 if ((Current.is(tok::question) && Style.BreakBeforeTernaryOperators) ||
590 (Current.getPreviousNonComment() && Current.isNot(tok::colon) &&
591 Current.getPreviousNonComment()->is(tok::question) &&
594 if (!Current.opensScope() && !Current.closesScope())
596 std::min(State.LowestLevelOnLine, Current.NestingLevel);
597 if (Current.isMemberAccess())
599 Current.LastOperator ? 0 : State.Column + Current.ColumnWidth;
600 if (Current.Type == TT_SelectorName)
602 if (Current.Type == TT_CtorInitializerColon) {
618 if (Current.Type == TT_ObjCMethodSpecifier)
622 const FormatToken *Previous = Current.getPreviousNonComment();
631 if (Current.isNot(tok::comment) && Previous && Previous->is(tok::l_brace) &&
640 if (Current.TokenText == "function")
649 if (Current.isStringLiteral() && State.StartOfStringLiteral == 0) {
651 } else if (!Current.isOneOf(tok::comment, tok::identifier, tok::hash) &&
652 !Current.isStringLiteral()) {
656 State.Column += Current.ColumnWidth;
658 unsigned Penalty = breakProtrudingToken(Current, State, DryRun);
664 if (Current.Role)
665 Current.Role->formatFromToken(State, this, DryRun);
679 const FormatToken &Current = *State.NextToken;
680 const FormatToken *Previous = Current.getPreviousNonComment();
690 I = Current.FakeLParens.rbegin(),
691 E = Current.FakeLParens.rend();
803 const FormatToken &Current = *State.NextToken;
804 if (!Current.opensScope())
807 if (Current.MatchingParen && Current.BlockKind == BK_Block) {
816 if (Current.is(tok::l_brace) || Current.Type == TT_ArrayInitializerLSquare) {
818 consumeRParens(State, *Current.MatchingParen);
821 if (Current.opensBlockTypeList(Style)) {
829 const FormatToken *NextNoComment = Current.getNextNonComment();
830 AvoidBinPacking = Current.Type == TT_ArrayInitializerLSquare ||
831 Current.Type == TT_DictLiteral ||
842 (Current.PackingKind == PPK_OnePerLine ||
844 Current.PackingKind == PPK_Inconclusive)));
847 if (Current.Type == TT_ObjCMethodExpr && Style.ColumnLimit != 0 &&
848 getLengthToMatchingParen(Current) + State.Column >
853 (Current.Type == TT_TemplateOpener &&
859 State.Stack.back().HasMultipleNestedBlocks = Current.BlockParameterCount > 1;
863 const FormatToken &Current = *State.NextToken;
864 if (!Current.closesScope())
870 (Current.isOneOf(tok::r_paren, tok::r_square) ||
871 (Current.is(tok::r_brace) && State.NextToken != State.Line->First) ||
875 if (Current.is(tok::r_square)) {
877 const FormatToken *NextNonComment = Current.getNextNonComment();
901 unsigned ContinuationIndenter::addMultilineToken(const FormatToken &Current,
910 State.Column = Current.LastLineColumnWidth;
935 unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current,
940 if (Current.Type != TT_BlockComment && Current.IsMultiline)
941 return addMultilineToken(Current, State);
944 if (Current.Type == TT_ImplicitStringLiteral)
947 if (!Current.isStringLiteral() && !Current.is(tok::comment))
951 unsigned StartColumn = State.Column - Current.ColumnWidth;
954 if (Current.isStringLiteral()) {
964 if (Current.IsUnterminatedLiteral)
967 StringRef Text = Current.TokenText;
975 if (Text.startswith("\"") && Current.Previous &&
976 Current.Previous->is(tok::at)) {
988 Current, State.Line->Level, StartColumn, Prefix, Postfix,
993 } else if (Current.Type == TT_BlockComment && Current.isTrailingComment()) {
994 if (CommentPragmasRegex.match(Current.TokenText.substr(2)))
997 Current, State.Line->Level, StartColumn, Current.OriginalColumn,
998 !Current.Previous, State.Line->InPPDirective, Encoding, Style));
999 } else if (Current.Type == TT_LineComment &&
1000 (Current.Previous == nullptr ||
1001 Current.Previous->Type != TT_ImplicitStringLiteral)) {
1002 if (CommentPragmasRegex.match(Current.TokenText.substr(2)))
1004 Token.reset(new BreakableLineComment(Current, State.Line->Level,
1012 if (Current.UnbreakableTailLength >= ColumnLimit)
1015 unsigned RemainingSpace = ColumnLimit - Current.UnbreakableTailLength;
1057 Penalty += Current.SplitPenalty;
1075 if (Current.Type != TT_LineComment) {
1080 Penalty += Current.isStringLiteral() ? Style.PenaltyBreakString
1094 const FormatToken &Current = *State.NextToken;
1095 if (!Current.isStringLiteral() || Current.Type == TT_ImplicitStringLiteral)
1100 if (Current.TokenText.startswith("R\""))
1102 if (Current.IsMultiline)
1104 if (Current.getNextNonComment() &&
1105 Current.getNextNonComment()->isStringLiteral())
1107 if (State.Column + Current.ColumnWidth + Current.UnbreakableTailLength >