Lines Matching refs:Tok
80 Token &Tok) {
83 PP.LexUnexpandedToken(Tok);
87 = FindHandler(Tok.getIdentifierInfo() ? Tok.getIdentifierInfo()->getName()
91 PP.Diag(Tok, diag::warn_pragma_ignored);
96 Handler->HandlePragma(PP, Introducer, Tok);
116 Token Tok;
117 PragmaHandlers->HandlePragma(*this, Introducer, Tok);
136 Token &Tok)
138 Failed(false), OutTok(Tok) {
164 /// been read into 'Tok'.
165 void Preprocessor::Handle_Pragma(Token &Tok) {
178 LexingFor_PragmaRAII _PragmaLexing(*this, InMacroArgPreExpansion, Tok);
181 SourceLocation PragmaLoc = Tok.getLocation();
184 Lex(Tok);
185 if (Tok.isNot(tok::l_paren)) {
191 Lex(Tok);
192 if (!tok::isStringLiteral(Tok.getKind())) {
195 if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::eof))
196 Lex(Tok);
197 while (Tok.isNot(tok::r_paren) &&
198 !Tok.isAtStartOfLine() &&
199 Tok.isNot(tok::eof))
200 Lex(Tok);
201 if (Tok.is(tok::r_paren))
202 Lex(Tok);
206 if (Tok.hasUDSuffix()) {
207 Diag(Tok, diag::err_invalid_string_udl);
209 Lex(Tok);
210 if (Tok.is(tok::r_paren))
211 Lex(Tok);
216 Token StrTok = Tok;
219 Lex(Tok);
220 if (Tok.isNot(tok::r_paren)) {
228 SourceLocation RParenLoc = Tok.getLocation();
302 return Lex(Tok);
307 void Preprocessor::HandleMicrosoft__pragma(Token &Tok) {
309 SourceLocation PragmaLoc = Tok.getLocation();
312 Lex(Tok);
313 if (Tok.isNot(tok::l_paren)) {
321 Lex(Tok);
322 while (Tok.isNot(tok::eof)) {
323 PragmaToks.push_back(Tok);
324 if (Tok.is(tok::l_paren))
326 else if (Tok.is(tok::r_paren) && NumParens-- == 0)
328 Lex(Tok);
331 if (Tok.is(tok::eof)) {
339 PragmaToks.back().setKind(tok::eod);
351 return Lex(Tok);
379 Token Tok;
388 LexUnexpandedToken(Tok);
392 if (Tok.is(tok::eod)) return;
395 if (Tok.isNot(tok::raw_identifier)) {
396 Diag(Tok, diag::err_pp_invalid_poison);
402 IdentifierInfo *II = LookUpIdentifierInfo(Tok);
409 Diag(Tok, diag::pp_poisoning_existing_macro);
459 if (FilenameTok.is(tok::eod))
494 while (DependencyTok.isNot(tok::eod)) {
508 IdentifierInfo *Preprocessor::ParsePragmaPushOrPopMacro(Token &Tok) {
510 Token PragmaTok = Tok;
513 Lex(Tok);
514 if (Tok.isNot(tok::l_paren)) {
521 Lex(Tok);
522 if (Tok.isNot(tok::string_literal)) {
528 if (Tok.hasUDSuffix()) {
529 Diag(Tok, diag::err_invalid_string_udl);
534 std::string StrVal = getSpelling(Tok);
537 Lex(Tok);
538 if (Tok.isNot(tok::r_paren)) {
550 MacroTok.setKind(tok::raw_identifier);
621 void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) {
628 Lex(Tok);
629 if (Tok.isNot(tok::l_paren)) {
630 Diag(Tok, diag::warn_pragma_include_alias_expected) << "(";
637 if (SourceFilenameTok.is(tok::eod)) {
644 if (SourceFilenameTok.is(tok::string_literal) ||
645 SourceFilenameTok.is(tok::angle_string_literal)) {
647 } else if (SourceFilenameTok.is(tok::less)) {
655 Diag(Tok, diag::warn_pragma_include_alias_expected_filename);
661 Lex(Tok);
662 if (Tok.isNot(tok::comma)) {
663 Diag(Tok, diag::warn_pragma_include_alias_expected) << ",";
669 if (ReplaceFilenameTok.is(tok::eod)) {
675 if (ReplaceFilenameTok.is(tok::string_literal) ||
676 ReplaceFilenameTok.is(tok::angle_string_literal)) {
678 } else if (ReplaceFilenameTok.is(tok::less)) {
686 Diag(Tok, diag::warn_pragma_include_alias_expected_filename);
691 Lex(Tok);
692 if (Tok.isNot(tok::r_paren)) {
693 Diag(Tok, diag::warn_pragma_include_alias_expected) << ")";
782 bool Preprocessor::LexOnOffSwitch(tok::OnOffSwitch &Result) {
783 Token Tok;
784 LexUnexpandedToken(Tok);
786 if (Tok.isNot(tok::identifier)) {
787 Diag(Tok, diag::ext_on_off_switch_syntax);
790 IdentifierInfo *II = Tok.getIdentifierInfo();
792 Result = tok::OOS_ON;
794 Result = tok::OOS_OFF;
796 Result = tok::OOS_DEFAULT;
798 Diag(Tok, diag::ext_on_off_switch_syntax);
803 LexUnexpandedToken(Tok);
804 if (Tok.isNot(tok::eod))
805 Diag(Tok, diag::ext_pragma_syntax_eod);
861 Token Tok;
862 PP.LexUnexpandedToken(Tok);
863 if (Tok.isNot(tok::identifier)) {
864 PP.Diag(Tok, diag::warn_pragma_diagnostic_invalid);
867 IdentifierInfo *II = Tok.getIdentifierInfo();
876 Crasher.setKind(tok::annot_pragma_parser_crash);
877 Crasher.setAnnotationRange(SourceRange(Tok.getLocation()));
900 PP.Diag(Tok, diag::warn_pragma_debug_unexpected_command)
906 Callbacks->PragmaDebug(Tok.getLocation(), II->getName());
914 Token Tok;
915 PP.LexUnexpandedToken(Tok);
917 if (Tok.isNot(tok::eod)) {
918 PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol)
923 SourceLocation NameLoc = Tok.getLocation();
926 Toks->setKind(tok::annot_pragma_captured);
957 Token Tok;
958 PP.LexUnexpandedToken(Tok);
959 if (Tok.isNot(tok::identifier)) {
960 PP.Diag(Tok, diag::warn_pragma_diagnostic_invalid);
963 IdentifierInfo *II = Tok.getIdentifierInfo();
968 PP.Diag(Tok, diag::warn_pragma_diagnostic_cannot_pop);
987 PP.Diag(Tok, diag::warn_pragma_diagnostic_invalid);
991 PP.LexUnexpandedToken(Tok);
992 SourceLocation StringLoc = Tok.getLocation();
995 if (!PP.FinishLexStringLiteral(Tok, WarningName, "pragma diagnostic",
999 if (Tok.isNot(tok::eod)) {
1000 PP.Diag(Tok.getLocation(), diag::warn_pragma_diagnostic_invalid_token);
1028 Token &Tok) override {
1033 SourceLocation DiagLoc = Tok.getLocation();
1036 PP.Lex(Tok);
1037 if (Tok.isNot(tok::l_paren)) {
1038 PP.Diag(Tok, diag::warn_pragma_warning_expected) << "(";
1042 PP.Lex(Tok);
1043 IdentifierInfo *II = Tok.getIdentifierInfo();
1048 PP.Lex(Tok);
1049 if (Tok.is(tok::comma)) {
1050 PP.Lex(Tok);
1052 if (Tok.is(tok::numeric_constant) &&
1053 PP.parseSimpleIntegerLiteral(Tok, Value))
1056 PP.Diag(Tok, diag::warn_pragma_warning_push_level);
1064 PP.Lex(Tok);
1071 II = Tok.getIdentifierInfo();
1072 if (!II && !Tok.is(tok::numeric_constant)) {
1073 PP.Diag(Tok, diag::warn_pragma_warning_spec_invalid);
1090 PP.Lex(Tok);
1094 Specifier = PP.getSpelling(Tok, SpecifierBuf);
1095 if (PP.parseSimpleIntegerLiteral(Tok, Value)) {
1103 PP.Diag(Tok, diag::warn_pragma_warning_spec_invalid);
1106 if (Tok.isNot(tok::colon)) {
1107 PP.Diag(Tok, diag::warn_pragma_warning_expected) << ":";
1113 PP.Lex(Tok);
1114 while (Tok.is(tok::numeric_constant)) {
1116 if (!PP.parseSimpleIntegerLiteral(Tok, Value) || Value == 0 ||
1118 PP.Diag(Tok, diag::warn_pragma_warning_expected_number);
1127 if (Tok.isNot(tok::semi))
1129 PP.Lex(Tok);
1133 if (Tok.isNot(tok::r_paren)) {
1134 PP.Diag(Tok, diag::warn_pragma_warning_expected) << ")";
1138 PP.Lex(Tok);
1139 if (Tok.isNot(tok::eod))
1140 PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma warning";
1190 Token &Tok) override {
1191 SourceLocation MessageLoc = Tok.getLocation();
1192 PP.Lex(Tok);
1194 switch (Tok.getKind()) {
1195 case tok::l_paren:
1199 PP.Lex(Tok);
1201 case tok::string_literal:
1210 if (!PP.FinishLexStringLiteral(Tok, MessageString, PragmaKind(Kind),
1215 if (Tok.isNot(tok::r_paren)) {
1216 PP.Diag(Tok.getLocation(), diag::err_pragma_message_malformed) << Kind;
1219 PP.Lex(Tok); // eat the r_paren.
1222 if (Tok.isNot(tok::eod)) {
1223 PP.Diag(Tok.getLocation(), diag::err_pragma_message_malformed) << Kind;
1265 Token &Tok) override {
1266 tok::OnOffSwitch OOS;
1269 if (OOS == tok::OOS_ON)
1270 PP.Diag(Tok, diag::warn_stdc_fenv_access_not_supported);
1279 Token &Tok) override {
1280 tok::OnOffSwitch OOS;
1304 Token Tok;
1307 PP.LexUnexpandedToken(Tok);
1308 const IdentifierInfo *BeginEnd = Tok.getIdentifierInfo();
1314 PP.Diag(Tok.getLocation(), diag::err_pp_arc_cf_code_audited_syntax);
1319 PP.LexUnexpandedToken(Tok);
1320 if (Tok.isNot(tok::eod))
1321 PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";
1358 Token Tok;
1361 PP.LexUnexpandedToken(Tok);
1362 const IdentifierInfo *BeginEnd = Tok.getIdentifierInfo();
1368 PP.Diag(Tok.getLocation(), diag::err_pp_assume_nonnull_syntax);
1373 PP.LexUnexpandedToken(Tok);
1374 if (Tok.isNot(tok::eod))
1375 PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";