Lines Matching refs:Line
22 bool startsExternCBlock(const AnnotatedLine &Line) { in startsExternCBlock() argument
23 const FormatToken *Next = Line.First->getNextNonComment(); in startsExternCBlock()
25 return Line.startsWith(tok::kw_extern) && Next && Next->isStringLiteral() && in startsExternCBlock()
58 void nextLine(const AnnotatedLine &Line) { in nextLine() argument
59 Offset = getIndentOffset(*Line.First); in nextLine()
62 skipLine(Line, /*UnknownIndent=*/true); in nextLine()
64 (Line.InPPDirective || in nextLine()
66 Line.Type == LT_CommentAbovePPDirective))) { in nextLine()
69 Indent = Line.InMacroBody in nextLine()
70 ? Line.PPLevel * PPIndentWidth + in nextLine()
71 (Line.Level - Line.PPLevel) * Style.IndentWidth in nextLine()
72 : Line.Level * PPIndentWidth; in nextLine()
75 Indent = getIndent(Line.Level); in nextLine()
79 if (Line.IsContinuation) in nextLine()
80 Indent = Line.Level * Style.IndentWidth + Style.ContinuationIndentWidth; in nextLine()
85 void skipLine(const AnnotatedLine &Line, bool UnknownIndent = false) { in skipLine() argument
86 if (Line.Level >= IndentForLevel.size()) in skipLine()
87 IndentForLevel.resize(Line.Level + 1, UnknownIndent ? -1 : Indent); in skipLine()
95 void adjustToUnmodifiedLine(const AnnotatedLine &Line) { in adjustToUnmodifiedLine() argument
96 unsigned LevelIndent = Line.First->OriginalColumn; in adjustToUnmodifiedLine()
99 assert(Line.Level < IndentForLevel.size()); in adjustToUnmodifiedLine()
100 if ((!Line.First->is(tok::comment) || IndentForLevel[Line.Level] == -1) && in adjustToUnmodifiedLine()
101 !Line.InPPDirective) { in adjustToUnmodifiedLine()
102 IndentForLevel[Line.Level] = LevelIndent; in adjustToUnmodifiedLine()
181 const AnnotatedLine *Line, in getMatchingNamespaceToken() argument
183 if (!Line->startsWith(tok::r_brace)) in getMatchingNamespaceToken()
185 size_t StartLineIndex = Line->MatchingOpeningBlockLineIndex; in getMatchingNamespaceToken()
192 StringRef getNamespaceTokenText(const AnnotatedLine *Line) { in getNamespaceTokenText() argument
193 const FormatToken *NamespaceToken = Line->First->getNamespaceToken(); in getNamespaceTokenText()
198 const AnnotatedLine *Line, in getMatchingNamespaceTokenText() argument
201 getMatchingNamespaceToken(Line, AnnotatedLines); in getMatchingNamespaceTokenText()
328 const AnnotatedLine *Line = nullptr; in tryFitMultipleLinesInOne() local
333 Line = *J; in tryFitMultipleLinesInOne()
338 if (!Line) in tryFitMultipleLinesInOne()
342 const FormatToken *LastNonComment = Line->Last; in tryFitMultipleLinesInOne()
611 AnnotatedLine &Line = **I; in tryMergeSimpleControlStatement() local
612 if (!Line.First->is(tok::kw_do) && !Line.First->is(tok::kw_else) && in tryMergeSimpleControlStatement()
613 !Line.Last->is(tok::kw_else) && Line.Last->isNot(tok::r_paren)) { in tryMergeSimpleControlStatement()
617 if (Line.First->is(tok::kw_do) && !Line.Last->is(tok::kw_do)) in tryMergeSimpleControlStatement()
629 if (I + 2 != E && Line.startsWith(tok::kw_if) && in tryMergeSimpleControlStatement()
656 const AnnotatedLine *Line = I[1 + NumStmts]; in tryMergeShortCaseLabels() local
657 if (Line->InPPDirective != InPPDirective) in tryMergeShortCaseLabels()
659 if (Line->InMacroBody != InMacroBody) in tryMergeShortCaseLabels()
661 if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace)) in tryMergeShortCaseLabels()
663 if (Line->First->isOneOf(tok::kw_if, tok::kw_for, tok::kw_switch, in tryMergeShortCaseLabels()
668 if (Line->First->is(tok::comment)) { in tryMergeShortCaseLabels()
669 if (Level != Line->Level) in tryMergeShortCaseLabels()
673 Line = *J; in tryMergeShortCaseLabels()
674 if (Line->InPPDirective != InPPDirective) in tryMergeShortCaseLabels()
676 if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace)) in tryMergeShortCaseLabels()
678 if (Line->First->isNot(tok::comment) || Level != Line->Level) in tryMergeShortCaseLabels()
683 if (Line->Last->is(tok::comment)) in tryMergeShortCaseLabels()
700 AnnotatedLine &Line = **I; in tryMergeSimpleBlock() local
706 Line.First->isOneOf(tok::at, tok::minus, tok::plus)) { in tryMergeSimpleBlock()
712 if (Line.First->is(tok::kw_case) || in tryMergeSimpleBlock()
713 (Line.First->Next && Line.First->Next->is(tok::kw_else))) { in tryMergeSimpleBlock()
717 if (Line.First->is(tok::kw_default)) { in tryMergeSimpleBlock()
718 const FormatToken *Tok = Line.First->getNextNonComment(); in tryMergeSimpleBlock()
723 auto IsCtrlStmt = [](const auto &Line) { in tryMergeSimpleBlock() argument
724 return Line.First->isOneOf(tok::kw_if, tok::kw_else, tok::kw_while, in tryMergeSimpleBlock()
733 if (IsCtrlStmt(Line) || in tryMergeSimpleBlock()
734 Line.First->isOneOf(tok::kw_try, tok::kw___try, tok::kw_catch, in tryMergeSimpleBlock()
742 Line.First->isOneOf(tok::kw_if, tok::kw_else) && in tryMergeSimpleBlock()
748 Line.First->isOneOf(tok::kw_if, tok::kw_else) && in tryMergeSimpleBlock()
755 Line.First->isOneOf(tok::kw_while, tok::kw_do, tok::kw_for, in tryMergeSimpleBlock()
762 Line.First->isOneOf(tok::kw_while, tok::kw_do, tok::kw_for, in tryMergeSimpleBlock()
774 if (Line.First->isOneOf(tok::kw_try, tok::kw___try, tok::kw_catch, in tryMergeSimpleBlock()
780 if (Line.Last->is(tok::l_brace)) { in tryMergeSimpleBlock()
781 if (IsSplitBlock && Line.First == Line.Last && in tryMergeSimpleBlock()
799 } else if (Limit != 0 && !Line.startsWithNamespace() && in tryMergeSimpleBlock()
800 !startsExternCBlock(Line)) { in tryMergeSimpleBlock()
802 if (isRecordLBrace(*Line.Last)) in tryMergeSimpleBlock()
838 if (Line.First == Line.Last && Line.First->isNot(TT_FunctionLBrace) && in tryMergeSimpleBlock()
889 bool containsMustBreak(const AnnotatedLine *Line) { in containsMustBreak() argument
890 for (const FormatToken *Tok = Line->First; Tok; Tok = Tok->Next) in containsMustBreak()
951 virtual unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent,
1035 State.Line->InPPDirective); in formatChildren()
1063 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1067 &Line, /*DryRun=*/false); in formatLine()
1089 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1093 Indenter->getInitialState(FirstIndent, FirstStartColumn, &Line, DryRun); in formatLine()
1114 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1117 Indenter->getInitialState(FirstIndent, FirstStartColumn, &Line, DryRun); in formatLine()
1121 if (State.Line->Type == LT_ObjCMethodDecl) in formatLine()
1312 for (const AnnotatedLine *Line = in format() local
1314 Line; PrevPrevLine = PreviousLine, PreviousLine = Line, Line = NextLine, in format()
1316 assert(Line->First); in format()
1317 const AnnotatedLine &TheLine = *Line; in format()
1338 Status->Line = in format()
1415 const AnnotatedLine &Line, const AnnotatedLine *PreviousLine, in formatFirstToken() argument
1419 FormatToken &RootToken = *Line.First; in formatFirstToken()
1434 !getNamespaceToken(&Line, Lines)) { in formatFirstToken()
1438 if (PreviousLine == nullptr && Line.Level > 0) in formatFirstToken()
1513 (Line.Type == LT_PreprocessorDirective || in formatFirstToken()
1514 Line.Type == LT_ImportStatement)) { in formatFirstToken()
1520 Line.InPPDirective && in formatFirstToken()