Lines Matching refs:Line

23 bool startsExternCBlock(const AnnotatedLine &Line) {  in startsExternCBlock()  argument
24 const FormatToken *Next = Line.First->getNextNonComment(); in startsExternCBlock()
26 return Line.startsWith(tok::kw_extern) && Next && Next->isStringLiteral() && in startsExternCBlock()
59 void nextLine(const AnnotatedLine &Line) { in nextLine() argument
60 Offset = getIndentOffset(*Line.First); in nextLine()
63 if (Line.Level >= IndentForLevel.size()) in nextLine()
64 IndentForLevel.resize(Line.Level + 1, -1); in nextLine()
66 (Line.InPPDirective || in nextLine()
68 Line.Type == LT_CommentAbovePPDirective))) { in nextLine()
71 Indent = Line.InMacroBody in nextLine()
72 ? Line.PPLevel * PPIndentWidth + in nextLine()
73 (Line.Level - Line.PPLevel) * Style.IndentWidth in nextLine()
74 : Line.Level * PPIndentWidth; in nextLine()
80 if (!Line.InPPDirective) { in nextLine()
81 assert(Line.Level <= IndentForLevel.size()); in nextLine()
82 IndentForLevel.resize(Line.Level + 1); in nextLine()
84 Indent = getIndent(Line.Level); in nextLine()
88 if (Line.IsContinuation) in nextLine()
89 Indent = Line.Level * Style.IndentWidth + Style.ContinuationIndentWidth; in nextLine()
97 void adjustToUnmodifiedLine(const AnnotatedLine &Line) { in adjustToUnmodifiedLine() argument
98 if (Line.InPPDirective || Line.IsContinuation) in adjustToUnmodifiedLine()
100 assert(Line.Level < IndentForLevel.size()); in adjustToUnmodifiedLine()
101 if (Line.First->is(tok::comment) && IndentForLevel[Line.Level] != -1) in adjustToUnmodifiedLine()
103 unsigned LevelIndent = Line.First->OriginalColumn; in adjustToUnmodifiedLine()
106 IndentForLevel[Line.Level] = LevelIndent; in adjustToUnmodifiedLine()
188 const AnnotatedLine *Line, in getMatchingNamespaceToken() argument
190 if (!Line->startsWith(tok::r_brace)) in getMatchingNamespaceToken()
192 size_t StartLineIndex = Line->MatchingOpeningBlockLineIndex; in getMatchingNamespaceToken()
199 StringRef getNamespaceTokenText(const AnnotatedLine *Line) { in getNamespaceTokenText() argument
200 const FormatToken *NamespaceToken = Line->First->getNamespaceToken(); in getNamespaceTokenText()
205 const AnnotatedLine *Line, in getMatchingNamespaceTokenText() argument
208 getMatchingNamespaceToken(Line, AnnotatedLines); in getMatchingNamespaceTokenText()
335 const AnnotatedLine *Line = nullptr; in tryFitMultipleLinesInOne() local
340 Line = *J; in tryFitMultipleLinesInOne()
345 if (!Line) in tryFitMultipleLinesInOne()
349 const auto *LastNonComment = Line->getLastNonComment(); in tryFitMultipleLinesInOne()
630 AnnotatedLine &Line = **I; in tryMergeSimpleControlStatement() local
631 if (Line.First->isNot(tok::kw_do) && Line.First->isNot(tok::kw_else) && in tryMergeSimpleControlStatement()
632 Line.Last->isNot(tok::kw_else) && Line.Last->isNot(tok::r_paren)) { in tryMergeSimpleControlStatement()
636 if (Line.First->is(tok::kw_do) && Line.Last->isNot(tok::kw_do)) in tryMergeSimpleControlStatement()
648 if (I + 2 != E && Line.startsWith(tok::kw_if) && in tryMergeSimpleControlStatement()
675 const AnnotatedLine *Line = I[1 + NumStmts]; in tryMergeShortCaseLabels() local
676 if (Line->InPPDirective != InPPDirective) in tryMergeShortCaseLabels()
678 if (Line->InMacroBody != InMacroBody) in tryMergeShortCaseLabels()
680 if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace)) in tryMergeShortCaseLabels()
682 if (Line->First->isOneOf(tok::kw_if, tok::kw_for, tok::kw_switch, in tryMergeShortCaseLabels()
687 if (Line->First->is(tok::comment)) { in tryMergeShortCaseLabels()
688 if (Level != Line->Level) in tryMergeShortCaseLabels()
692 Line = *J; in tryMergeShortCaseLabels()
693 if (Line->InPPDirective != InPPDirective) in tryMergeShortCaseLabels()
695 if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace)) in tryMergeShortCaseLabels()
697 if (Line->First->isNot(tok::comment) || Level != Line->Level) in tryMergeShortCaseLabels()
702 if (Line->Last->is(tok::comment)) in tryMergeShortCaseLabels()
719 AnnotatedLine &Line = **I; in tryMergeSimpleBlock() local
725 Line.First->isOneOf(tok::at, tok::minus, tok::plus)) { in tryMergeSimpleBlock()
731 if (Line.First->is(tok::kw_case) || in tryMergeSimpleBlock()
732 (Line.First->Next && Line.First->Next->is(tok::kw_else))) { in tryMergeSimpleBlock()
736 if (Line.First->is(tok::kw_default)) { in tryMergeSimpleBlock()
737 const FormatToken *Tok = Line.First->getNextNonComment(); in tryMergeSimpleBlock()
742 auto IsCtrlStmt = [](const auto &Line) { in tryMergeSimpleBlock() argument
743 return Line.First->isOneOf(tok::kw_if, tok::kw_else, tok::kw_while, in tryMergeSimpleBlock()
752 if (IsCtrlStmt(Line) || in tryMergeSimpleBlock()
753 Line.First->isOneOf(tok::kw_try, tok::kw___try, tok::kw_catch, in tryMergeSimpleBlock()
761 Line.First->isOneOf(tok::kw_if, tok::kw_else) && in tryMergeSimpleBlock()
767 Line.First->isOneOf(tok::kw_if, tok::kw_else) && in tryMergeSimpleBlock()
774 Line.First->isOneOf(tok::kw_while, tok::kw_do, tok::kw_for, in tryMergeSimpleBlock()
781 Line.First->isOneOf(tok::kw_while, tok::kw_do, tok::kw_for, in tryMergeSimpleBlock()
793 if (Line.First->isOneOf(tok::kw_try, tok::kw___try, tok::kw_catch, in tryMergeSimpleBlock()
799 if (const auto *LastNonComment = Line.getLastNonComment(); in tryMergeSimpleBlock()
801 if (IsSplitBlock && Line.First == Line.Last && in tryMergeSimpleBlock()
817 (Style.SpaceInEmptyBlock || Line.Last->is(tok::comment)) ? 1 : 0; in tryMergeSimpleBlock()
820 } else if (Limit != 0 && !Line.startsWithNamespace() && in tryMergeSimpleBlock()
821 !startsExternCBlock(Line)) { in tryMergeSimpleBlock()
823 if (isRecordLBrace(*Line.Last)) in tryMergeSimpleBlock()
859 if (Line.First == Line.Last && Line.First->isNot(TT_FunctionLBrace) && in tryMergeSimpleBlock()
910 bool containsMustBreak(const AnnotatedLine *Line) { in containsMustBreak() argument
911 assert(Line->First); in containsMustBreak()
914 for (const FormatToken *Tok = Line->First->Next; Tok; Tok = Tok->Next) in containsMustBreak()
996 virtual unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent,
1069 State.Line->InPPDirective); in formatChildren()
1099 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1103 &Line, /*DryRun=*/false); in formatLine()
1125 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1129 Indenter->getInitialState(FirstIndent, FirstStartColumn, &Line, DryRun); in formatLine()
1150 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1153 Indenter->getInitialState(FirstIndent, FirstStartColumn, &Line, DryRun); in formatLine()
1157 if (State.Line->Type == LT_ObjCMethodDecl) in formatLine()
1348 for (const AnnotatedLine *Line = in format() local
1350 Line; PrevPrevLine = PreviousLine, PreviousLine = Line, Line = NextLine, in format()
1352 assert(Line->First); in format()
1353 const AnnotatedLine &TheLine = *Line; in format()
1374 Status->Line = in format()
1451 static auto computeNewlines(const AnnotatedLine &Line, in computeNewlines() argument
1456 const auto &RootToken = *Line.First; in computeNewlines()
1464 !getNamespaceToken(&Line, Lines)) { in computeNewlines()
1468 if (!PreviousLine && Line.Level > 0) in computeNewlines()
1542 const AnnotatedLine &Line, const AnnotatedLine *PreviousLine, in formatFirstToken() argument
1546 FormatToken &RootToken = *Line.First; in formatFirstToken()
1559 computeNewlines(Line, PreviousLine, PrevPrevLine, Lines, Style); in formatFirstToken()
1570 (Line.Type == LT_PreprocessorDirective || in formatFirstToken()
1571 Line.Type == LT_ImportStatement)) { in formatFirstToken()
1577 Line.InPPDirective && in formatFirstToken()