Lines Matching defs:Tok
189 /// @param Tok Next token to be emitted.
194 void HandleWhitespaceBeforeTok(const Token &Tok, bool RequireSpace,
204 /// @param Tok Token where to move to.
209 bool MoveToLine(const Token &Tok, bool RequireStartOfLine) {
210 PresumedLoc PLoc = SM.getPresumedLoc(Tok.getLocation());
213 Tok.isAtStartOfLine() && PLoc.isValid() && PLoc.getLine() == 1;
227 const Token &Tok) {
228 return ConcatInfo.AvoidConcat(PrevPrevTok, PrevTok, Tok);
755 void PrintPPOutputPPCallbacks::HandleWhitespaceBeforeTok(const Token &Tok,
760 if (Tok.is(tok::eof) ||
761 (Tok.isAnnotation() && !Tok.is(tok::annot_header_unit) &&
762 !Tok.is(tok::annot_module_begin) && !Tok.is(tok::annot_module_end) &&
763 !Tok.is(tok::annot_repl_input_end) && !Tok.is(tok::annot_embed)))
768 MoveToLine(Tok, /*RequireStartOfLine=*/EmittedDirectiveOnThisLine)) {
771 if (Tok.is(tok::hash))
776 unsigned ColNo = SM.getExpansionColumnNumber(Tok.getLocation());
782 if (ColNo == 1 && Tok.hasLeadingSpace())
791 if (ColNo <= 1 && Tok.is(tok::hash))
805 if (RequireSpace || (!MinimizeWhitespace && Tok.hasLeadingSpace()) ||
807 AvoidConcat(PrevPrevTok, PrevTok, Tok)))
812 PrevTok = Tok;
892 static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
901 // line) must be emitted as one line even though Tok.getLine() returns two
902 // different values. In this situation Tok.isAtStartOfLine() is false even
907 IsStartOfLine = IsStartOfLine || Tok.isAtStartOfLine();
909 Callbacks->HandleWhitespaceBeforeTok(Tok, /*RequireSpace=*/false,
912 if (DropComments && Tok.is(tok::comment)) {
916 PP.Lex(Tok);
918 } else if (Tok.is(tok::annot_repl_input_end)) {
919 PP.Lex(Tok);
921 } else if (Tok.is(tok::eod)) {
925 PP.Lex(Tok);
927 // Tok.isAtStartOfLine() set.
930 } else if (Tok.is(tok::annot_module_include)) {
933 PP.Lex(Tok);
936 } else if (Tok.is(tok::annot_module_begin)) {
944 reinterpret_cast<Module *>(Tok.getAnnotationValue()));
945 PP.Lex(Tok);
948 } else if (Tok.is(tok::annot_module_end)) {
950 reinterpret_cast<Module *>(Tok.getAnnotationValue()));
951 PP.Lex(Tok);
954 } else if (Tok.is(tok::annot_header_unit)) {
959 Module *M = reinterpret_cast<Module *>(Tok.getAnnotationValue());
963 } else if (Tok.is(tok::annot_embed)) {
971 reinterpret_cast<EmbedAnnotationData *>(Tok.getAnnotationValue());
984 } else if (Tok.isAnnotation()) {
987 PP.Lex(Tok);
989 } else if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
991 } else if (Tok.isLiteral() && !Tok.needsCleaning() &&
992 Tok.getLiteralData()) {
993 Callbacks->OS->write(Tok.getLiteralData(), Tok.getLength());
994 } else if (Tok.getLength() < std::size(Buffer)) {
996 unsigned Len = PP.getSpelling(Tok, TokPtr);
1004 if (Tok.getKind() == tok::comment || Tok.getKind() == tok::unknown)
1006 if (Tok.is(tok::comment) && Len >= 2 && TokPtr[0] == '/' &&
1013 std::string S = PP.getSpelling(Tok);
1018 if (Tok.getKind() == tok::comment || Tok.getKind() == tok::unknown)
1020 if (Tok.is(tok::comment) && S.size() >= 2 && S[0] == '/' && S[1] == '/') {
1029 if (Tok.is(tok::eof)) break;
1031 PP.Lex(Tok);
1034 PP.Lex(Tok);
1052 Token Tok;
1053 do PP.Lex(Tok);
1054 while (Tok.isNot(tok::eof));
1137 Token Tok;
1139 PP.Lex(Tok);
1140 if (Tok.is(tok::eof) || !Tok.getLocation().isFileID())
1143 PresumedLoc PLoc = SourceMgr.getPresumedLoc(Tok.getLocation());
1152 PrintPreprocessedTokens(PP, Tok, Callbacks);