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); 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()
114 int getIndentOffset(const AnnotatedLine &Line) { in getIndentOffset() argument
121 if (Line.Type == LT_AccessModifier || RootToken.isObjCAccessSpecifier()) in getIndentOffset()
141 if (IsAccessModifier(*Line.First)) { in getIndentOffset()
187 const AnnotatedLine *Line, in getMatchingNamespaceToken() argument
189 if (!Line->startsWith(tok::r_brace)) in getMatchingNamespaceToken()
191 size_t StartLineIndex = Line->MatchingOpeningBlockLineIndex; in getMatchingNamespaceToken()
198 StringRef getNamespaceTokenText(const AnnotatedLine *Line) { in getNamespaceTokenText() argument
199 const FormatToken *NamespaceToken = Line->First->getNamespaceToken(); in getNamespaceTokenText()
204 const AnnotatedLine *Line, in getMatchingNamespaceTokenText() argument
207 getMatchingNamespaceToken(Line, AnnotatedLines); in getMatchingNamespaceTokenText()
334 const AnnotatedLine *Line = nullptr; in tryFitMultipleLinesInOne() local
339 Line = *J; in tryFitMultipleLinesInOne()
344 if (!Line) in tryFitMultipleLinesInOne()
348 const auto *LastNonComment = Line->getLastNonComment(); in tryFitMultipleLinesInOne()
635 AnnotatedLine &Line = **I; in tryMergeSimpleControlStatement() local
636 if (Line.First->isNot(tok::kw_do) && Line.First->isNot(tok::kw_else) && in tryMergeSimpleControlStatement()
637 Line.Last->isNot(tok::kw_else) && Line.Last->isNot(tok::r_paren)) { in tryMergeSimpleControlStatement()
641 if (Line.First->is(tok::kw_do) && Line.Last->isNot(tok::kw_do)) in tryMergeSimpleControlStatement()
653 if (I + 2 != E && Line.startsWith(tok::kw_if) && in tryMergeSimpleControlStatement()
680 const AnnotatedLine *Line = I[1 + NumStmts]; in tryMergeShortCaseLabels() local
681 if (Line->InPPDirective != InPPDirective) in tryMergeShortCaseLabels()
683 if (Line->InMacroBody != InMacroBody) in tryMergeShortCaseLabels()
685 if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace)) in tryMergeShortCaseLabels()
687 if (Line->First->isOneOf(tok::kw_if, tok::kw_for, tok::kw_switch, in tryMergeShortCaseLabels()
692 if (Line->First->is(tok::comment)) { in tryMergeShortCaseLabels()
693 if (Level != Line->Level) in tryMergeShortCaseLabels()
697 Line = *J; in tryMergeShortCaseLabels()
698 if (Line->InPPDirective != InPPDirective) in tryMergeShortCaseLabels()
700 if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace)) in tryMergeShortCaseLabels()
702 if (Line->First->isNot(tok::comment) || Level != Line->Level) in tryMergeShortCaseLabels()
707 if (Line->Last->is(tok::comment)) in tryMergeShortCaseLabels()
724 AnnotatedLine &Line = **I; in tryMergeSimpleBlock() local
730 Line.First->isOneOf(tok::at, tok::minus, tok::plus)) { in tryMergeSimpleBlock()
736 if (Line.First->is(tok::kw_case) || in tryMergeSimpleBlock()
737 (Line.First->Next && Line.First->Next->is(tok::kw_else))) { in tryMergeSimpleBlock()
741 if (Line.First->is(tok::kw_default)) { in tryMergeSimpleBlock()
742 const FormatToken *Tok = Line.First->getNextNonComment(); in tryMergeSimpleBlock()
747 auto IsCtrlStmt = [](const auto &Line) { in tryMergeSimpleBlock() argument
748 return Line.First->isOneOf(tok::kw_if, tok::kw_else, tok::kw_while, in tryMergeSimpleBlock()
757 if (IsCtrlStmt(Line) || in tryMergeSimpleBlock()
758 Line.First->isOneOf(tok::kw_try, tok::kw___try, tok::kw_catch, in tryMergeSimpleBlock()
766 Line.First->isOneOf(tok::kw_if, tok::kw_else) && in tryMergeSimpleBlock()
772 Line.First->isOneOf(tok::kw_if, tok::kw_else) && in tryMergeSimpleBlock()
779 Line.First->isOneOf(tok::kw_while, tok::kw_do, tok::kw_for, in tryMergeSimpleBlock()
786 Line.First->isOneOf(tok::kw_while, tok::kw_do, tok::kw_for, in tryMergeSimpleBlock()
798 if (Line.First->isOneOf(tok::kw_try, tok::kw___try, tok::kw_catch, in tryMergeSimpleBlock()
804 if (Line.endsWith(tok::l_brace)) { in tryMergeSimpleBlock()
806 Line.First->is(TT_BlockLBrace)) { in tryMergeSimpleBlock()
810 if (IsSplitBlock && Line.First == Line.Last && in tryMergeSimpleBlock()
826 (Style.SpaceInEmptyBlock || Line.Last->is(tok::comment)) ? 1 : 0; in tryMergeSimpleBlock()
829 } else if (Limit != 0 && !Line.startsWithNamespace() && in tryMergeSimpleBlock()
830 !startsExternCBlock(Line)) { in tryMergeSimpleBlock()
832 if (isRecordLBrace(*Line.Last)) in tryMergeSimpleBlock()
868 if (Line.First == Line.Last && Line.First->isNot(TT_FunctionLBrace) && in tryMergeSimpleBlock()
919 bool containsMustBreak(const AnnotatedLine *Line) { in containsMustBreak() argument
920 assert(Line->First); in containsMustBreak()
923 for (const FormatToken *Tok = Line->First->Next; Tok; Tok = Tok->Next) in containsMustBreak()
1005 virtual unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent,
1078 State.Line->InPPDirective); in formatChildren()
1108 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1112 &Line, /*DryRun=*/false); in formatLine()
1134 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1138 Indenter->getInitialState(FirstIndent, FirstStartColumn, &Line, DryRun); in formatLine()
1159 unsigned formatLine(const AnnotatedLine &Line, unsigned FirstIndent, in formatLine() argument
1162 Indenter->getInitialState(FirstIndent, FirstStartColumn, &Line, DryRun); in formatLine()
1166 if (State.Line->Type == LT_ObjCMethodDecl) in formatLine()
1357 for (const AnnotatedLine *Line = in format() local
1359 Line; PrevPrevLine = PreviousLine, PreviousLine = Line, Line = NextLine, in format()
1361 assert(Line->First); in format()
1362 const AnnotatedLine &TheLine = *Line; in format()
1383 Status->Line = in format()
1460 static auto computeNewlines(const AnnotatedLine &Line, in computeNewlines() argument
1465 const auto &RootToken = *Line.First; in computeNewlines()
1473 !getNamespaceToken(&Line, Lines)) { in computeNewlines()
1477 if (!PreviousLine && Line.Level > 0) in computeNewlines()
1553 const AnnotatedLine &Line, const AnnotatedLine *PreviousLine, in formatFirstToken() argument
1557 FormatToken &RootToken = *Line.First; in formatFirstToken()
1570 computeNewlines(Line, PreviousLine, PrevPrevLine, Lines, Style); in formatFirstToken()
1581 (Line.Type == LT_PreprocessorDirective || in formatFirstToken()
1582 Line.Type == LT_ImportStatement)) { in formatFirstToken()
1588 Line.InPPDirective && in formatFirstToken()