Lines Matching refs:Changes
53 Changes.push_back(Change(Tok, /*CreateReplacement=*/true, Tok.WhitespaceRange, in replaceWhitespace()
63 Changes.push_back(Change(Tok, /*CreateReplacement=*/false, in addUntouchableToken()
82 Changes.push_back( in replaceWhitespaceInToken()
91 if (Changes.empty()) in generateReplacements()
94 llvm::sort(Changes, Change::IsBeforeInFile(SourceMgr)); in generateReplacements()
109 Changes[0].PreviousEndOfTokenColumn = 0; in calculateLineBreakInformation()
110 Change *LastOutsideTokenChange = &Changes[0]; in calculateLineBreakInformation()
111 for (unsigned i = 1, e = Changes.size(); i != e; ++i) { in calculateLineBreakInformation()
113 Changes[i].OriginalWhitespaceRange.getBegin(); in calculateLineBreakInformation()
115 Changes[i - 1].OriginalWhitespaceRange.getEnd(); in calculateLineBreakInformation()
150 Changes[i - 1].TokenLength = OriginalWhitespaceStartOffset - in calculateLineBreakInformation()
152 Changes[i].PreviousLinePostfix.size() + in calculateLineBreakInformation()
153 Changes[i - 1].CurrentLinePrefix.size(); in calculateLineBreakInformation()
155 Changes[i - 1].TokenLength = in calculateLineBreakInformation()
156 NewlinePos + Changes[i - 1].CurrentLinePrefix.size(); in calculateLineBreakInformation()
161 if (Changes[i - 1].IsInsideToken && Changes[i - 1].NewlinesBefore == 0) in calculateLineBreakInformation()
163 Changes[i - 1].TokenLength + Changes[i - 1].Spaces; in calculateLineBreakInformation()
165 LastOutsideTokenChange = &Changes[i - 1]; in calculateLineBreakInformation()
167 Changes[i].PreviousEndOfTokenColumn = in calculateLineBreakInformation()
168 Changes[i - 1].StartOfTokenColumn + Changes[i - 1].TokenLength; in calculateLineBreakInformation()
170 Changes[i - 1].IsTrailingComment = in calculateLineBreakInformation()
171 (Changes[i].NewlinesBefore > 0 || Changes[i].Tok->is(tok::eof) || in calculateLineBreakInformation()
172 (Changes[i].IsInsideToken && Changes[i].Tok->is(tok::comment))) && in calculateLineBreakInformation()
173 Changes[i - 1].Tok->is(tok::comment) && in calculateLineBreakInformation()
208 Changes.back().TokenLength = 0; in calculateLineBreakInformation()
209 Changes.back().IsTrailingComment = Changes.back().Tok->is(tok::comment); in calculateLineBreakInformation()
212 for (auto &Change : Changes) { in calculateLineBreakInformation()
240 for (auto &Change : Changes) { in calculateLineBreakInformation()
266 SmallVector<WhitespaceManager::Change, 16> &Changes) { in AlignTokenSequence() argument
286 Changes[i].indentAndNestingLevel() < in AlignTokenSequence()
287 Changes[ScopeStack.back()].indentAndNestingLevel()) in AlignTokenSequence()
294 Changes[PreviousNonComment].Tok->is(tok::comment)) in AlignTokenSequence()
296 if (i != Start && Changes[i].indentAndNestingLevel() > in AlignTokenSequence()
297 Changes[PreviousNonComment].indentAndNestingLevel()) in AlignTokenSequence()
302 if (Changes[i].NewlinesBefore > 0 && !InsideNestedScope) { in AlignTokenSequence()
310 if (!FoundMatchOnLine && !InsideNestedScope && Matches(Changes[i])) { in AlignTokenSequence()
312 Shift = Column - Changes[i].StartOfTokenColumn; in AlignTokenSequence()
313 Changes[i].Spaces += Shift; in AlignTokenSequence()
318 if (InsideNestedScope && Changes[i].NewlinesBefore > 0) { in AlignTokenSequence()
320 if (Changes[ScopeStart - 1].Tok->is(TT_FunctionDeclarationName) || in AlignTokenSequence()
322 Changes[ScopeStart - 2].Tok->is(TT_FunctionDeclarationName)) || in AlignTokenSequence()
323 Changes[i].Tok->is(TT_ConditionalExpr) || in AlignTokenSequence()
324 (Changes[i].Tok->Previous && in AlignTokenSequence()
325 Changes[i].Tok->Previous->is(TT_ConditionalExpr))) in AlignTokenSequence()
326 Changes[i].Spaces += Shift; in AlignTokenSequence()
330 Changes[i].StartOfTokenColumn += Shift; in AlignTokenSequence()
331 if (i + 1 != Changes.size()) in AlignTokenSequence()
332 Changes[i + 1].PreviousEndOfTokenColumn += Shift; in AlignTokenSequence()
365 SmallVector<WhitespaceManager::Change, 16> &Changes, in AlignTokens() argument
376 auto IndentAndNestingLevel = StartAt < Changes.size() in AlignTokens()
377 ? Changes[StartAt].indentAndNestingLevel() in AlignTokens()
399 Changes); in AlignTokens()
407 for (unsigned e = Changes.size(); i != e; ++i) { in AlignTokens()
408 if (Changes[i].indentAndNestingLevel() < IndentAndNestingLevel) in AlignTokens()
411 if (Changes[i].NewlinesBefore != 0) { in AlignTokens()
416 if (Changes[i].NewlinesBefore > 1 || !FoundMatchOnLine) in AlignTokens()
422 if (Changes[i].Tok->is(tok::comma)) { in AlignTokens()
424 } else if (Changes[i].indentAndNestingLevel() > IndentAndNestingLevel) { in AlignTokens()
426 unsigned StoppedAt = AlignTokens(Style, Matches, Changes, i); in AlignTokens()
431 if (!Matches(Changes[i])) in AlignTokens()
445 unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn; in AlignTokens()
446 int LineLengthAfter = Changes[i].TokenLength; in AlignTokens()
447 for (unsigned j = i + 1; j != e && Changes[j].NewlinesBefore == 0; ++j) { in AlignTokens()
448 LineLengthAfter += Changes[j].Spaces; in AlignTokens()
454 if (!Changes[j].IsInsideToken) in AlignTokens()
455 LineLengthAfter += Changes[j].TokenLength; in AlignTokens()
486 SmallVector<WhitespaceManager::Change, 16> &Changes) { in AlignMacroSequence() argument
493 if (Changes[I].NewlinesBefore > 0) { in AlignMacroSequence()
501 if (!FoundMatchOnLine && AlignMacrosMatches(Changes[I])) { in AlignMacroSequence()
503 Shift = MinColumn - Changes[I].StartOfTokenColumn; in AlignMacroSequence()
504 Changes[I].Spaces += Shift; in AlignMacroSequence()
508 Changes[I].StartOfTokenColumn += Shift; in AlignMacroSequence()
509 if (I + 1 != Changes.size()) in AlignMacroSequence()
510 Changes[I + 1].PreviousEndOfTokenColumn += Shift; in AlignMacroSequence()
564 for (unsigned E = Changes.size(); I != E; ++I) { in alignConsecutiveMacros()
565 if (Changes[I].NewlinesBefore != 0) { in alignConsecutiveMacros()
569 if (Changes[I].NewlinesBefore > 1 || !FoundMatchOnLine) in alignConsecutiveMacros()
571 FoundMatchOnLine, AlignMacrosMatches, Changes); in alignConsecutiveMacros()
576 if (!AlignMacrosMatches(Changes[I])) in alignConsecutiveMacros()
584 unsigned ChangeMinColumn = Changes[I].StartOfTokenColumn; in alignConsecutiveMacros()
585 int LineLengthAfter = -Changes[I].Spaces; in alignConsecutiveMacros()
586 for (unsigned j = I; j != E && Changes[j].NewlinesBefore == 0; ++j) in alignConsecutiveMacros()
587 LineLengthAfter += Changes[j].Spaces + Changes[j].TokenLength; in alignConsecutiveMacros()
596 FoundMatchOnLine, AlignMacrosMatches, Changes); in alignConsecutiveMacros()
611 if (&C != &Changes.back() && (&C + 1)->NewlinesBefore > 0) in alignConsecutiveAssignments()
616 Changes, /*StartAt=*/0); in alignConsecutiveAssignments()
631 if (&C != &Changes.back() && (&C + 1)->NewlinesBefore > 0) in alignConsecutiveBitFields()
636 Changes, /*StartAt=*/0); in alignConsecutiveBitFields()
670 Changes, /*StartAt=*/0); in alignConsecutiveDeclarations()
685 Changes, /*StartAt=*/0); in alignChainedConditionals()
698 for (Change &C : Changes) { in alignChainedConditionals()
709 &C != &Changes.back() && (&C + 1)->NewlinesBefore == 0 && in alignChainedConditionals()
713 Changes, /*StartAt=*/0); in alignChainedConditionals()
723 for (unsigned i = 0, e = Changes.size(); i != e; ++i) { in alignTrailingComments()
724 if (Changes[i].StartOfBlockComment) in alignTrailingComments()
726 Newlines += Changes[i].NewlinesBefore; in alignTrailingComments()
727 if (!Changes[i].IsTrailingComment) in alignTrailingComments()
730 unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn; in alignTrailingComments()
735 else if (Style.ColumnLimit >= Changes[i].TokenLength) in alignTrailingComments()
736 ChangeMaxColumn = Style.ColumnLimit - Changes[i].TokenLength; in alignTrailingComments()
742 if (!Changes[i].CreateReplacement) in alignTrailingComments()
745 if (i + 1 != e && Changes[i + 1].ContinuesPPDirective) in alignTrailingComments()
749 bool FollowsRBraceInColumn0 = i > 0 && Changes[i].NewlinesBefore == 0 && in alignTrailingComments()
750 Changes[i - 1].Tok->is(tok::r_brace) && in alignTrailingComments()
751 Changes[i - 1].StartOfTokenColumn == 0; in alignTrailingComments()
753 if (Changes[i].NewlinesBefore == 1) { // A comment on its own line. in alignTrailingComments()
755 Changes[i].OriginalWhitespaceRange.getEnd()); in alignTrailingComments()
757 if (Changes[j].Tok->is(tok::comment)) in alignTrailingComments()
761 Changes[j].OriginalWhitespaceRange.getEnd()); in alignTrailingComments()
779 (Changes[i].NewlinesBefore == 1 && i > 0 && in alignTrailingComments()
780 !Changes[i - 1].IsTrailingComment) || in alignTrailingComments()
790 BreakBeforeNext = (i == 0) || (Changes[i].NewlinesBefore > 1) || in alignTrailingComments()
793 (Changes[i].NewlinesBefore == 1 && StartOfSequence == i); in alignTrailingComments()
796 alignTrailingComments(StartOfSequence, Changes.size(), MinColumn); in alignTrailingComments()
803 if (Changes[i].IsTrailingComment) { in alignTrailingComments()
804 Shift = Column - Changes[i].StartOfTokenColumn; in alignTrailingComments()
806 if (Changes[i].StartOfBlockComment) { in alignTrailingComments()
807 Shift = Changes[i].IndentationOffset + in alignTrailingComments()
808 Changes[i].StartOfBlockComment->StartOfTokenColumn - in alignTrailingComments()
809 Changes[i].StartOfTokenColumn; in alignTrailingComments()
812 Changes[i].Spaces += Shift; in alignTrailingComments()
813 if (i + 1 != Changes.size()) in alignTrailingComments()
814 Changes[i + 1].PreviousEndOfTokenColumn += Shift; in alignTrailingComments()
815 Changes[i].StartOfTokenColumn += Shift; in alignTrailingComments()
826 for (unsigned i = 1, e = Changes.size(); i < e; ++i) { in alignEscapedNewlines()
827 Change &C = Changes[i]; in alignEscapedNewlines()
838 alignEscapedNewlines(StartOfMacro + 1, Changes.size(), MaxEndOfLine); in alignEscapedNewlines()
844 Change &C = Changes[i]; in alignEscapedNewlines()
856 for (unsigned i = 0, e = Changes.size(); i != e; ++i) { in generateChanges()
857 const Change &C = Changes[i]; in generateChanges()
859 assert(Changes[i - 1].OriginalWhitespaceRange.getBegin() != in generateChanges()