Lines Matching defs:Tok

49   Token Tok;
51 Lex.LexFromRawLexer(Tok);
52 return GetOffsetAfterSequence(SM, Lex, Tok);
56 // \p Tok will be the token after this directive; otherwise, it can be any token
57 // after the given \p Tok (including \p Tok). If \p RawIDName is provided, the
60 Lexer &Lex, StringRef Name, Token &Tok,
62 bool Matched = Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&
63 Tok.is(tok::raw_identifier) &&
64 Tok.getRawIdentifier() == Name && !Lex.LexFromRawLexer(Tok) &&
65 Tok.is(tok::raw_identifier) &&
66 (!RawIDName || Tok.getRawIdentifier() == *RawIDName);
68 Lex.LexFromRawLexer(Tok);
72 void skipComments(Lexer &Lex, Token &Tok) {
73 while (Tok.is(tok::comment))
74 if (Lex.LexFromRawLexer(Tok))
89 Token Tok)>
93 [&Consume](const SourceManager &SM, Lexer &Lex, Token Tok) {
94 skipComments(Lex, Tok);
95 unsigned InitialOffset = SM.getFileOffset(Tok.getLocation());
96 return std::max(InitialOffset, Consume(SM, Lex, Tok));
102 [](const SourceManager &SM, Lexer &Lex, Token Tok) -> unsigned {
103 if (checkAndConsumeDirectiveWithName(Lex, "ifndef", Tok)) {
104 skipComments(Lex, Tok);
105 if (checkAndConsumeDirectiveWithName(Lex, "define", Tok) &&
106 Tok.isAtStartOfLine())
107 return SM.getFileOffset(Tok.getLocation());
113 [](const SourceManager &SM, Lexer &Lex, Token Tok) -> unsigned {
114 if (checkAndConsumeDirectiveWithName(Lex, "pragma", Tok,
116 return SM.getFileOffset(Tok.getLocation());
123 // If it is, \p Tok will be the token after this directive; otherwise, it can be
124 // any token after the given \p Tok (including \p Tok).
125 bool checkAndConsumeInclusiveDirective(Lexer &Lex, Token &Tok) {
127 Lex.LexFromRawLexer(Tok);
130 if (Tok.is(tok::hash) && !Lex.LexFromRawLexer(Tok) &&
131 Tok.is(tok::raw_identifier) && Tok.getRawIdentifier() == "include") {
132 if (Lex.LexFromRawLexer(Tok))
134 if (Tok.is(tok::string_literal))
136 if (Tok.is(tok::less)) {
137 while (!Lex.LexFromRawLexer(Tok) && Tok.isNot(tok::greater)) {
139 if (Tok.is(tok::greater))
163 [](const SourceManager &SM, Lexer &Lex, Token Tok) {
164 skipComments(Lex, Tok);
165 unsigned MaxOffset = SM.getFileOffset(Tok.getLocation());
166 while (checkAndConsumeInclusiveDirective(Lex, Tok))
167 MaxOffset = SM.getFileOffset(Tok.getLocation());