reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/lib/Format/WhitespaceManager.cpp
   52   Changes.push_back(Change(Tok, /*CreateReplacement=*/true, Tok.WhitespaceRange,
   62   Changes.push_back(Change(Tok, /*CreateReplacement=*/false,
   81   Changes.push_back(
   89   if (Changes.empty())
   92   llvm::sort(Changes, Change::IsBeforeInFile(SourceMgr));
  105   Changes[0].PreviousEndOfTokenColumn = 0;
  106   Change *LastOutsideTokenChange = &Changes[0];
  107   for (unsigned i = 1, e = Changes.size(); i != e; ++i) {
  109         Changes[i].OriginalWhitespaceRange.getBegin();
  111         Changes[i - 1].OriginalWhitespaceRange.getEnd();
  146       Changes[i - 1].TokenLength = OriginalWhitespaceStartOffset -
  148                                    Changes[i].PreviousLinePostfix.size() +
  149                                    Changes[i - 1].CurrentLinePrefix.size();
  151       Changes[i - 1].TokenLength =
  152           NewlinePos + Changes[i - 1].CurrentLinePrefix.size();
  157     if (Changes[i - 1].IsInsideToken && Changes[i - 1].NewlinesBefore == 0)
  157     if (Changes[i - 1].IsInsideToken && Changes[i - 1].NewlinesBefore == 0)
  159           Changes[i - 1].TokenLength + Changes[i - 1].Spaces;
  159           Changes[i - 1].TokenLength + Changes[i - 1].Spaces;
  161       LastOutsideTokenChange = &Changes[i - 1];
  163     Changes[i].PreviousEndOfTokenColumn =
  164         Changes[i - 1].StartOfTokenColumn + Changes[i - 1].TokenLength;
  164         Changes[i - 1].StartOfTokenColumn + Changes[i - 1].TokenLength;
  166     Changes[i - 1].IsTrailingComment =
  167         (Changes[i].NewlinesBefore > 0 || Changes[i].Tok->is(tok::eof) ||
  167         (Changes[i].NewlinesBefore > 0 || Changes[i].Tok->is(tok::eof) ||
  168          (Changes[i].IsInsideToken && Changes[i].Tok->is(tok::comment))) &&
  168          (Changes[i].IsInsideToken && Changes[i].Tok->is(tok::comment))) &&
  169         Changes[i - 1].Tok->is(tok::comment) &&
  204   Changes.back().TokenLength = 0;
  205   Changes.back().IsTrailingComment = Changes.back().Tok->is(tok::comment);
  205   Changes.back().IsTrailingComment = Changes.back().Tok->is(tok::comment);
  208   for (auto &Change : Changes) {
  521   for (unsigned E = Changes.size(); I != E; ++I) {
  522     if (Changes[I].NewlinesBefore != 0) {
  526       if (Changes[I].NewlinesBefore > 1 || !FoundMatchOnLine)
  528                            FoundMatchOnLine, AlignMacrosMatches, Changes);
  533     if (!AlignMacrosMatches(Changes[I]))
  541     unsigned ChangeMinColumn = Changes[I].StartOfTokenColumn;
  542     int LineLengthAfter = -Changes[I].Spaces;
  543     for (unsigned j = I; j != E && Changes[j].NewlinesBefore == 0; ++j)
  544       LineLengthAfter += Changes[j].Spaces + Changes[j].TokenLength;
  544       LineLengthAfter += Changes[j].Spaces + Changes[j].TokenLength;
  553                      FoundMatchOnLine, AlignMacrosMatches, Changes);
  568         if (&C != &Changes.back() && (&C + 1)->NewlinesBefore > 0)
  573       Changes, /*StartAt=*/0);
  607       Changes, /*StartAt=*/0);
  616   for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
  617     if (Changes[i].StartOfBlockComment)
  619     Newlines += Changes[i].NewlinesBefore;
  620     if (!Changes[i].IsTrailingComment)
  623     unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn;
  628     else if (Style.ColumnLimit >= Changes[i].TokenLength)
  629       ChangeMaxColumn = Style.ColumnLimit - Changes[i].TokenLength;
  635     if (!Changes[i].CreateReplacement)
  638     if (i + 1 != e && Changes[i + 1].ContinuesPPDirective)
  642     bool FollowsRBraceInColumn0 = i > 0 && Changes[i].NewlinesBefore == 0 &&
  643                                   Changes[i - 1].Tok->is(tok::r_brace) &&
  644                                   Changes[i - 1].StartOfTokenColumn == 0;
  646     if (Changes[i].NewlinesBefore == 1) { // A comment on its own line.
  648           Changes[i].OriginalWhitespaceRange.getEnd());
  650         if (Changes[j].Tok->is(tok::comment))
  654             Changes[j].OriginalWhitespaceRange.getEnd());
  672                (Changes[i].NewlinesBefore == 1 && i > 0 &&
  673                 !Changes[i - 1].IsTrailingComment) ||
  683     BreakBeforeNext = (i == 0) || (Changes[i].NewlinesBefore > 1) ||
  686                       (Changes[i].NewlinesBefore == 1 && StartOfSequence == i);
  689   alignTrailingComments(StartOfSequence, Changes.size(), MinColumn);
  696     if (Changes[i].IsTrailingComment) {
  697       Shift = Column - Changes[i].StartOfTokenColumn;
  699     if (Changes[i].StartOfBlockComment) {
  700       Shift = Changes[i].IndentationOffset +
  701               Changes[i].StartOfBlockComment->StartOfTokenColumn -
  702               Changes[i].StartOfTokenColumn;
  705     Changes[i].Spaces += Shift;
  706     if (i + 1 != Changes.size())
  707       Changes[i + 1].PreviousEndOfTokenColumn += Shift;
  708     Changes[i].StartOfTokenColumn += Shift;
  719   for (unsigned i = 1, e = Changes.size(); i < e; ++i) {
  720     Change &C = Changes[i];
  731   alignEscapedNewlines(StartOfMacro + 1, Changes.size(), MaxEndOfLine);
  737     Change &C = Changes[i];
  749   for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
  750     const Change &C = Changes[i];
  752       assert(Changes[i - 1].OriginalWhitespaceRange.getBegin() !=