Mercurial > hg > CbC > CbC_llvm
comparison clang/lib/Format/BreakableToken.cpp @ 173:0572611fdcc8 llvm10 llvm12
reorgnization done
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 11:55:54 +0900 |
parents | 1d019706d866 |
children | 2e18cbf3894f |
comparison
equal
deleted
inserted
replaced
172:9fbae9c8bf63 | 173:0572611fdcc8 |
---|---|
586 unsigned BreakOffsetInToken = | 586 unsigned BreakOffsetInToken = |
587 Text.data() - tokenAt(LineIndex).TokenText.data() + Split.first; | 587 Text.data() - tokenAt(LineIndex).TokenText.data() + Split.first; |
588 unsigned CharsToRemove = Split.second; | 588 unsigned CharsToRemove = Split.second; |
589 assert(LocalIndentAtLineBreak >= Prefix.size()); | 589 assert(LocalIndentAtLineBreak >= Prefix.size()); |
590 std::string PrefixWithTrailingIndent = std::string(Prefix); | 590 std::string PrefixWithTrailingIndent = std::string(Prefix); |
591 for (unsigned I = 0; I < ContentIndent; ++I) | 591 PrefixWithTrailingIndent.append(ContentIndent, ' '); |
592 PrefixWithTrailingIndent += " "; | |
593 Whitespaces.replaceWhitespaceInToken( | 592 Whitespaces.replaceWhitespaceInToken( |
594 tokenAt(LineIndex), BreakOffsetInToken, CharsToRemove, "", | 593 tokenAt(LineIndex), BreakOffsetInToken, CharsToRemove, "", |
595 PrefixWithTrailingIndent, InPPDirective, /*Newlines=*/1, | 594 PrefixWithTrailingIndent, InPPDirective, /*Newlines=*/1, |
596 /*Spaces=*/LocalIndentAtLineBreak + ContentIndent - | 595 /*Spaces=*/LocalIndentAtLineBreak + ContentIndent - |
597 PrefixWithTrailingIndent.size()); | 596 PrefixWithTrailingIndent.size()); |
862 if (LineIndex > 0 && Tokens[LineIndex] != Tokens[LineIndex - 1]) { | 861 if (LineIndex > 0 && Tokens[LineIndex] != Tokens[LineIndex - 1]) { |
863 // Reflow happens between tokens. Replace the whitespace between the | 862 // Reflow happens between tokens. Replace the whitespace between the |
864 // tokens by the empty string. | 863 // tokens by the empty string. |
865 Whitespaces.replaceWhitespace( | 864 Whitespaces.replaceWhitespace( |
866 *Tokens[LineIndex], /*Newlines=*/0, /*Spaces=*/0, | 865 *Tokens[LineIndex], /*Newlines=*/0, /*Spaces=*/0, |
867 /*StartOfTokenColumn=*/StartColumn, /*InPPDirective=*/false); | 866 /*StartOfTokenColumn=*/StartColumn, /*IsAligned=*/true, |
867 /*InPPDirective=*/false); | |
868 } else if (LineIndex > 0) { | 868 } else if (LineIndex > 0) { |
869 // In case we're reflowing after the '\' in: | 869 // In case we're reflowing after the '\' in: |
870 // | 870 // |
871 // // line comment \ | 871 // // line comment \ |
872 // // line 2 | 872 // // line 2 |
930 // comments if they are untouchable. | 930 // comments if they are untouchable. |
931 Whitespaces.replaceWhitespace(*Tokens[LineIndex], | 931 Whitespaces.replaceWhitespace(*Tokens[LineIndex], |
932 /*Newlines=*/1, | 932 /*Newlines=*/1, |
933 /*Spaces=*/LineColumn, | 933 /*Spaces=*/LineColumn, |
934 /*StartOfTokenColumn=*/LineColumn, | 934 /*StartOfTokenColumn=*/LineColumn, |
935 /*IsAligned=*/true, | |
935 /*InPPDirective=*/false); | 936 /*InPPDirective=*/false); |
936 } | 937 } |
937 if (OriginalPrefix[LineIndex] != Prefix[LineIndex]) { | 938 if (OriginalPrefix[LineIndex] != Prefix[LineIndex]) { |
938 // Adjust the prefix if necessary. | 939 // Adjust the prefix if necessary. |
939 | 940 |