reference, declaration → definition definition → references, declarations, derived classes, virtual overrides reference to multiple definitions → definitions unreferenced |
607 Token Tok = FormatTok->Tok; 608 StringRef TokenText = FormatTok->TokenText; 610 unsigned OriginalColumn = FormatTok->OriginalColumn; 611 FormatTok = new (Allocator.Allocate()) FormatToken; 612 FormatTok->Tok = Tok; 614 FormatTok->Tok.getLocation().getLocWithOffset(Tok.getLength() - 1); 615 FormatTok->Tok.setLocation(TokLocation); 616 FormatTok->WhitespaceRange = SourceRange(TokLocation, TokLocation); 617 FormatTok->TokenText = TokenText; 618 FormatTok->ColumnWidth = 1; 619 FormatTok->OriginalColumn = OriginalColumn + 1; 621 return FormatTok; 630 FormatTok = new (Allocator.Allocate()) FormatToken; 631 readRawToken(*FormatTok); 633 FormatTok->Tok.getLocation().getLocWithOffset(-TrailingWhitespace); 634 FormatTok->IsFirst = IsFirstToken; 639 while (FormatTok->Tok.is(tok::unknown)) { 640 StringRef Text = FormatTok->TokenText; 660 ++FormatTok->NewlinesBefore; 661 FormatTok->HasUnescapedNewline = !EscapesNewline(i - 1); 662 FormatTok->LastNewlineOffset = WhitespaceLength + i + 1; 666 FormatTok->LastNewlineOffset = WhitespaceLength + i + 1; 682 FormatTok->Type = TT_ImplicitStringLiteral; 685 FormatTok->Type = TT_ImplicitStringLiteral; 688 if (FormatTok->Type == TT_ImplicitStringLiteral) 692 if (FormatTok->is(TT_ImplicitStringLiteral)) 694 WhitespaceLength += FormatTok->Tok.getLength(); 696 readRawToken(*FormatTok); 708 FormatTok->is(tok::comment) && FormatTok->TokenText.startswith("//")) { 708 FormatTok->is(tok::comment) && FormatTok->TokenText.startswith("//")) { 709 size_t BackslashPos = FormatTok->TokenText.find('\\'); 711 if (BackslashPos + 1 < FormatTok->TokenText.size() && 712 FormatTok->TokenText[BackslashPos + 1] == '\n') { 714 Offset -= FormatTok->TokenText.size(); 717 FormatTok->TokenText = FormatTok->TokenText.substr(0, BackslashPos + 1); 717 FormatTok->TokenText = FormatTok->TokenText.substr(0, BackslashPos + 1); 718 FormatTok->ColumnWidth = encoding::columnWidthWithTabs( 719 FormatTok->TokenText, FormatTok->OriginalColumn, Style.TabWidth, 719 FormatTok->TokenText, FormatTok->OriginalColumn, Style.TabWidth, 723 BackslashPos = FormatTok->TokenText.find('\\', BackslashPos + 1); 731 while (FormatTok->TokenText.size() > 1 && FormatTok->TokenText[0] == '\\') { 731 while (FormatTok->TokenText.size() > 1 && FormatTok->TokenText[0] == '\\') { 733 if (FormatTok->TokenText.size() > 2 && 734 (FormatTok->TokenText[1] == '\r' && FormatTok->TokenText[2] == '\n')) 734 (FormatTok->TokenText[1] == '\r' && FormatTok->TokenText[2] == '\n')) 736 else if (FormatTok->TokenText[1] == '\n') 741 ++FormatTok->NewlinesBefore; 743 FormatTok->LastNewlineOffset = SkippedWhitespace; 745 FormatTok->TokenText = FormatTok->TokenText.substr(SkippedWhitespace); 745 FormatTok->TokenText = FormatTok->TokenText.substr(SkippedWhitespace); 748 FormatTok->WhitespaceRange = SourceRange( 751 FormatTok->OriginalColumn = Column; 754 if (FormatTok->Tok.is(tok::comment)) { 756 StringRef UntrimmedText = FormatTok->TokenText; 757 FormatTok->TokenText = FormatTok->TokenText.rtrim(" \t\v\f"); 757 FormatTok->TokenText = FormatTok->TokenText.rtrim(" \t\v\f"); 758 TrailingWhitespace = UntrimmedText.size() - FormatTok->TokenText.size(); 759 } else if (FormatTok->Tok.is(tok::raw_identifier)) { 760 IdentifierInfo &Info = IdentTable.get(FormatTok->TokenText); 761 FormatTok->Tok.setIdentifierInfo(&Info); 762 FormatTok->Tok.setKind(Info.getTokenID()); 764 FormatTok->isOneOf(tok::kw_struct, tok::kw_union, tok::kw_delete, 766 FormatTok->Tok.setKind(tok::identifier); 767 FormatTok->Tok.setIdentifierInfo(nullptr); 769 FormatTok->isOneOf(tok::kw_struct, tok::kw_union, 771 FormatTok->Tok.setKind(tok::identifier); 772 FormatTok->Tok.setIdentifierInfo(nullptr); 774 } else if (FormatTok->Tok.is(tok::greatergreater)) { 775 FormatTok->Tok.setKind(tok::greater); 776 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); 776 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); 779 } else if (FormatTok->Tok.is(tok::lessless)) { 780 FormatTok->Tok.setKind(tok::less); 781 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); 781 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1); 788 StringRef Text = FormatTok->TokenText; 793 FormatTok->ColumnWidth = 795 Column += FormatTok->ColumnWidth; 797 FormatTok->IsMultiline = true; 800 FormatTok->ColumnWidth = encoding::columnWidthWithTabs( 805 FormatTok->LastLineColumnWidth = encoding::columnWidthWithTabs( 807 Column = FormatTok->LastLineColumnWidth; 811 auto it = Macros.find(FormatTok->Tok.getIdentifierInfo()); 816 FormatTok->Type = it->second; 817 } else if (FormatTok->is(tok::identifier)) { 819 FormatTok->Type = TT_MacroBlockBegin; 821 FormatTok->Type = TT_MacroBlockEnd; 826 return FormatTok;