Home | History | Annotate | Download | only in Lex

Lines Matching refs:Tok

82 /// the tok::eod token is found.
87 assert(Tmp.isNot(tok::eof) && "EOF seen while discarding directive tokens");
88 } while (Tmp.isNot(tok::eod));
142 if (MacroNameTok.is(tok::eod))
168 if ((isDefineUndef != MU_Other) && II->getPPKeywordID() == tok::pp_defined) {
224 if (MacroNameTok.is(tok::code_completion)) {
235 // token kind to tok::eod if necessary.
236 if (MacroNameTok.isNot(tok::eod)) {
237 MacroNameTok.setKind(tok::eod);
242 /// \brief Ensure that the next token is a tok::eod token.
258 while (Tmp.is(tok::comment)) // Skip comments in -C mode.
261 if (Tmp.isNot(tok::eod)) {
303 Token Tok;
305 CurLexer->Lex(Tok);
307 if (Tok.is(tok::code_completion)) {
315 if (Tok.is(tok::eof)) {
330 if (Tok.isNot(tok::hash) || !Tok.isAtStartOfLine())
341 LexUnexpandedToken(Tok);
345 if (Tok.isNot(tok::raw_identifier)) {
357 StringRef RI = Tok.getRawIdentifier();
369 // that we can't use Tok.getIdentifierInfo() because its lookup is disabled
373 if (!Tok.needsCleaning() && RI.size() < 20) {
376 std::string DirectiveStr = getSpelling(Tok);
396 CurPPLexer->pushConditionalLevel(Tok.getLocation(), /*wasskipping*/true,
417 Callbacks->Endif(Tok.getLocation(), CondInfo.IfLoc);
429 Tok, diag::pp_err_else_after_else);
444 Callbacks->Else(Tok.getLocation(), CondInfo.IfLoc);
453 if (CondInfo.FoundElse) Diag(Tok, diag::pp_err_elif_after_else);
470 Callbacks->Elif(Tok.getLocation(),
495 Callbacks->SourceRangeSkipped(SourceRange(BeginLoc, Tok.getLocation()));
518 Token Tok;
519 LexUnexpandedToken(Tok);
523 tok::PPKeywordKind K = Tok.getIdentifierInfo()->getPPKeywordID();
525 if (K == tok::pp_else) {
549 assert(K == tok::pp_elif);
554 Diag(Tok, diag::pp_err_elif_after_else);
793 case tok::pp_include:
794 case tok::pp_import:
795 case tok::pp_include_next:
796 case tok::pp___include_macros:
797 case tok::pp_pragma:
813 case tok::eod:
815 case tok::code_completion:
821 case tok::numeric_constant: // # 7 GNU line marker directive.
833 case tok::pp_if:
835 case tok::pp_ifdef:
837 case tok::pp_ifndef:
839 case tok::pp_elif:
841 case tok::pp_else:
843 case tok::pp_endif:
847 case tok::pp_include:
850 case tok::pp___include_macros:
855 case tok::pp_define:
857 tok::pp_undef:
861 case tok::pp_line:
865 case tok::pp_error:
869 case tok::pp_pragma:
873 case tok::pp_import:
875 case tok::pp_include_next:
878 case tok::pp_warning:
881 case tok::pp_ident:
883 case tok::pp_sccs:
885 case tok::pp_assert:
888 case tok::pp_unassert:
892 case tok::pp___public_macro:
897 case tok::pp___private_macro:
917 if (Result.is(tok::hashhash))
918 Toks[1].setKind(tok::unknown);
941 if (DigitTok.isNot(tok::numeric_constant)) {
944 if (DigitTok.isNot(tok::eod))
997 void Preprocessor::HandleLineDirective(Token &Tok) {
1027 if (StrTok.is(tok::eod))
1029 else if (StrTok.isNot(tok::string_literal)) {
1068 if (FlagTok.is(tok::eod)) return false;
1076 if (FlagTok.is(tok::eod)) return false;
1102 if (FlagTok.is(tok::eod)) return false;
1117 if (FlagTok.is(tok::eod)) return false;
1131 if (FlagTok.is(tok::eod)) return false;
1163 if (StrTok.is(tok::eod))
1165 else if (StrTok.isNot(tok::string_literal)) {
1216 void Preprocessor::HandleUserDiagnosticDirective(Token &Tok,
1235 Diag(Tok, diag::pp_hash_warning) << Msg;
1237 Diag(Tok, diag::err_pp_hash_error) << Msg;
1242 void Preprocessor::HandleIdentSCCSDirective(Token &Tok) {
1244 Diag(Tok, diag::ext_pp_ident_directive);
1251 if (StrTok.isNot(tok::string_literal) &&
1252 StrTok.isNot(tok::wide_string_literal)) {
1254 if (StrTok.isNot(tok::eod))
1271 Callbacks->Ident(Tok.getLocation(), Str);
1276 void Preprocessor::HandleMacroPublicDirective(Token &Tok) {
1281 if (MacroNameTok.is(tok::eod))
1303 void Preprocessor::HandleMacroPrivateDirective(Token &Tok) {
1308 if (MacroNameTok.is(tok::eod))
1396 while (CurTok.isNot(tok::eod)) {
1400 if (CurTok.is(tok::code_completion)) {
1427 if (CurTok.is(tok::greater))
1442 tok::TokenKind Kind, void *AnnotationVal) {
1445 Token *Tok = new Token[1];
1446 Tok[0].startToken();
1447 Tok[0].setKind(Kind);
1448 Tok[0].setLocation(Begin);
1449 Tok[0].setAnnotationEndLoc(End);
1450 Tok[0].setAnnotationValue(AnnotationVal);
1451 PP.EnterTokenStream(Tok, 1, true, true);
1471 case tok::pp_include:
1475 case tok::pp_import:
1479 case tok::pp_include_next:
1483 case tok::pp___include_macros:
1520 case tok::eod:
1524 case tok::angle_string_literal:
1525 case tok::string_literal:
1531 case tok::less:
1740 CurLexer->FormTokenWithChars(Result, CurLexer->BufferEnd, tok::eof);
1790 tok::pp___include_macros)
1791 EnterAnnotationToken(*this, HashLoc, End, tok::annot_module_include, M);
1822 EnterAnnotationToken(*this, HashLoc, End, tok::annot_module_begin, M);
1858 void Preprocessor::HandleMicrosoftImportDirective(Token &Tok) {
1864 Diag(Tok, diag::err_pp_import_directive_ms );
1906 assert(TmpTok.isNot(tok::eof) && "Didn't find end of -imacros!");
1907 } while (TmpTok.isNot(tok::hashhash));
1918 bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI, Token &Tok) {
1922 LexUnexpandedToken(Tok);
1923 switch (Tok.getKind()) {
1924 case tok::r_paren:
1929 Diag(Tok, diag::err_pp_expected_ident_in_arg_list);
1931 case tok::ellipsis: // #define X(... -> C99 varargs
1933 Diag(Tok, LangOpts.CPlusPlus11 ?
1939 Diag(Tok, diag::err_pp_opencl_variadic_macros);
1944 LexUnexpandedToken(Tok);
1945 if (Tok.isNot(tok::r_paren)) {
1946 Diag(Tok, diag::err_pp_missing_rparen_in_macro_def);
1954 case tok::eod: // #define X(
1955 Diag(Tok, diag::err_pp_missing_rparen_in_macro_def);
1960 IdentifierInfo *II = Tok.getIdentifierInfo();
1963 Diag(Tok, diag::err_pp_invalid_tok_in_arg_list);
1971 Diag(Tok, diag::err_pp_duplicate_name_in_arg_list) << II;
1979 LexUnexpandedToken(Tok);
1981 switch (Tok.getKind()) {
1983 Diag(Tok, diag::err_pp_expected_comma_in_arg_list);
1985 case tok::r_paren: // #define X(A)
1988 case tok::comma: // #define X(A,
1990 case tok::ellipsis: // #define X(A... -> GCC extension
1992 Diag(Tok, diag::ext_named_variadic_macro);
1995 LexUnexpandedToken(Tok);
1996 if (Tok.isNot(tok::r_paren)) {
1997 Diag(Tok, diag::err_pp_missing_rparen_in_macro_def);
2046 if (MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static,
2047 tok::kw_const) &&
2066 if (MacroNameTok.is(tok::eod))
2078 Token Tok;
2079 LexUnexpandedToken(Tok);
2084 if (Tok.is(tok::eod)) {
2091 } else if (Tok.hasLeadingSpace()) {
2094 Tok.clearFlag(Token::LeadingSpace);
2095 } else if (Tok.is(tok::l_paren)) {
2115 LexUnexpandedToken(Tok);
2119 Diag(Tok, diag::ext_c99_whitespace_required_after_macro_name);
2128 if (Tok.is(tok::at)) // @ is not in the list above.
2130 else if (Tok.is(tok::unknown)) {
2137 Diag(Tok, diag::ext_missing_whitespace_after_macro_name);
2139 Diag(Tok, diag::warn_missing_whitespace_after_macro_name);
2142 if (!Tok.is(tok::eod))
2143 LastTok = Tok;
2148 while (Tok.isNot(tok::eod)) {
2149 LastTok = Tok;
2150 MI->AddTokenToBody(Tok);
2152 LexUnexpandedToken(Tok);
2159 while (Tok.isNot(tok::eod)) {
2160 LastTok = Tok;
2162 if (Tok.isNot(tok::hash) && Tok.isNot(tok::hashhash)) {
2163 MI->AddTokenToBody(Tok);
2166 LexUnexpandedToken(Tok);
2174 Tok.setKind(tok::unknown);
2175 MI->AddTokenToBody(Tok);
2178 LexUnexpandedToken(Tok);
2182 if (Tok.is(tok::hashhash)) {
2189 LexUnexpandedToken(Tok);
2191 if (Tok.is(tok::eod)) {
2197 if (NumTokens && Tok.getIdentifierInfo() == Ident__VA_ARGS__ &&
2198 MI->getReplacementToken(NumTokens-1).is(tok::comma))
2207 LexUnexpandedToken(Tok);
2210 if (Tok.getIdentifierInfo() == nullptr ||
2211 MI->getArgumentNum(Tok.getIdentifierInfo()) == -1) {
2215 // the kind of the token to tok::unknown so that the preprocessor isn't
2217 if (getLangOpts().AsmPreprocessor && Tok.isNot(tok::eod)) {
2218 LastTok.setKind(tok::unknown);
2222 Diag(Tok, diag::err_pp_stringize_not_parameter);
2232 MI->AddTokenToBody(Tok);
2233 LastTok = Tok;
2236 LexUnexpandedToken(Tok);
2252 if (MI->getReplacementToken(0).is(tok::hashhash)) {
2256 if (MI->getReplacementToken(NumTokens-1).is(tok::hashhash)) {
2342 if (MacroNameTok.is(tok::eod))
2391 if (MacroNameTok.is(tok::eod)) {