• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/contrib/llvm-project/clang/lib/Format/

Lines Matching refs:FormatTok

30     : FormatTok(nullptr), IsFirstToken(true), StateStack({LexerState::NORMAL}),
810 Token Tok = FormatTok->Tok;
811 StringRef TokenText = FormatTok->TokenText;
813 unsigned OriginalColumn = FormatTok->OriginalColumn;
814 FormatTok = new (Allocator.Allocate()) FormatToken;
815 FormatTok->Tok = Tok;
817 FormatTok->Tok.getLocation().getLocWithOffset(Tok.getLength() - 1);
818 FormatTok->Tok.setLocation(TokLocation);
819 FormatTok->WhitespaceRange = SourceRange(TokLocation, TokLocation);
820 FormatTok->TokenText = TokenText;
821 FormatTok->ColumnWidth = 1;
822 FormatTok->OriginalColumn = OriginalColumn + 1;
824 return FormatTok;
833 FormatTok = new (Allocator.Allocate()) FormatToken;
834 readRawToken(*FormatTok);
836 FormatTok->Tok.getLocation().getLocWithOffset(-TrailingWhitespace);
837 FormatTok->IsFirst = IsFirstToken;
842 while (FormatTok->Tok.is(tok::unknown)) {
843 StringRef Text = FormatTok->TokenText;
863 ++FormatTok->NewlinesBefore;
864 FormatTok->HasUnescapedNewline = !EscapesNewline(i - 1);
865 FormatTok->LastNewlineOffset = WhitespaceLength + i + 1;
869 FormatTok->LastNewlineOffset = WhitespaceLength + i + 1;
885 FormatTok->setType(TT_ImplicitStringLiteral);
888 FormatTok->setType(TT_ImplicitStringLiteral);
891 if (FormatTok->getType() == TT_ImplicitStringLiteral)
895 if (FormatTok->is(TT_ImplicitStringLiteral))
897 WhitespaceLength += FormatTok->Tok.getLength();
899 readRawToken(*FormatTok);
911 FormatTok->is(tok::comment) && FormatTok->TokenText.startswith("//")) {
912 size_t BackslashPos = FormatTok->TokenText.find('\\');
914 if (BackslashPos + 1 < FormatTok->TokenText.size() &&
915 FormatTok->TokenText[BackslashPos + 1] == '\n') {
917 Offset -= FormatTok->TokenText.size();
920 FormatTok->TokenText = FormatTok->TokenText.substr(0, BackslashPos + 1);
921 FormatTok->ColumnWidth = encoding::columnWidthWithTabs(
922 FormatTok->TokenText, FormatTok->OriginalColumn, Style.TabWidth,
926 BackslashPos = FormatTok->TokenText.find('\\', BackslashPos + 1);
934 while (FormatTok->TokenText.size() > 1 && FormatTok->TokenText[0] == '\\') {
936 if (FormatTok->TokenText.size() > 2 &&
937 (FormatTok->TokenText[1] == '\r' && FormatTok->TokenText[2] == '\n'))
939 else if (FormatTok->TokenText[1] == '\n')
944 ++FormatTok->NewlinesBefore;
946 FormatTok->LastNewlineOffset = SkippedWhitespace;
948 FormatTok->TokenText = FormatTok->TokenText.substr(SkippedWhitespace);
951 FormatTok->WhitespaceRange = SourceRange(
954 FormatTok->OriginalColumn = Column;
957 if (FormatTok->Tok.is(tok::comment)) {
959 StringRef UntrimmedText = FormatTok->TokenText;
960 FormatTok->TokenText = FormatTok->TokenText.rtrim(" \t\v\f");
961 TrailingWhitespace = UntrimmedText.size() - FormatTok->TokenText.size();
962 } else if (FormatTok->Tok.is(tok::raw_identifier)) {
963 IdentifierInfo &Info = IdentTable.get(FormatTok->TokenText);
964 FormatTok->Tok.setIdentifierInfo(&Info);
965 FormatTok->Tok.setKind(Info.getTokenID());
967 FormatTok->isOneOf(tok::kw_struct, tok::kw_union, tok::kw_delete,
969 FormatTok->Tok.setKind(tok::identifier);
970 FormatTok->Tok.setIdentifierInfo(nullptr);
972 FormatTok->isOneOf(tok::kw_struct, tok::kw_union,
974 FormatTok->Tok.setKind(tok::identifier);
975 FormatTok->Tok.setIdentifierInfo(nullptr);
977 } else if (FormatTok->Tok.is(tok::greatergreater)) {
978 FormatTok->Tok.setKind(tok::greater);
979 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1);
982 } else if (FormatTok->Tok.is(tok::lessless)) {
983 FormatTok->Tok.setKind(tok::less);
984 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1);
989 // Now FormatTok is the next non-whitespace token.
991 StringRef Text = FormatTok->TokenText;
996 FormatTok->ColumnWidth =
998 Column += FormatTok->ColumnWidth;
1000 FormatTok->IsMultiline = true;
1003 FormatTok->ColumnWidth = encoding::columnWidthWithTabs(
1008 FormatTok->LastLineColumnWidth = encoding::columnWidthWithTabs(
1010 Column = FormatTok->LastLineColumnWidth;
1014 auto it = Macros.find(FormatTok->Tok.getIdentifierInfo());
1019 FormatTok->setType(it->second);
1020 } else if (FormatTok->is(tok::identifier)) {
1022 FormatTok->setType(TT_MacroBlockBegin);
1024 FormatTok->setType(TT_MacroBlockEnd);
1029 return FormatTok;