Lines Matching refs:Tok
165 tok::TokenKind Kind = Tok.getKind(); in ParseStatementOrDeclarationAfterAttributes()
198 if (Tok.is(tok::semi)) in ParseStatementOrDeclarationAfterAttributes()
204 if (Tok.isNot(tok::identifier)) in ParseStatementOrDeclarationAfterAttributes()
214 SourceLocation DeclStart = Tok.getLocation(), DeclEnd; in ParseStatementOrDeclarationAfterAttributes()
220 if (Tok.is(tok::r_brace)) { in ParseStatementOrDeclarationAfterAttributes()
221 Diag(Tok, diag::err_expected_statement); in ParseStatementOrDeclarationAfterAttributes()
236 bool HasLeadingEmptyMacro = Tok.hasLeadingEmptyMacro(); in ParseStatementOrDeclarationAfterAttributes()
342 Diag(Tok, diag::err_pragma_fp_contract_scope); in ParseStatementOrDeclarationAfterAttributes()
399 Token OldToken = Tok; in ParseExprStatement()
408 if (Tok.is(tok::semi)) in ParseExprStatement()
413 if (Tok.is(tok::colon) && getCurScope()->isSwitchScope() && in ParseExprStatement()
439 assert(Tok.is(tok::kw___try) && "Expected '__try'"); in ParseSEHTryBlock()
442 if (Tok.isNot(tok::l_brace)) in ParseSEHTryBlock()
443 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace); in ParseSEHTryBlock()
451 if (Tok.is(tok::identifier) && in ParseSEHTryBlock()
452 Tok.getIdentifierInfo() == getSEHExceptKeyword()) { in ParseSEHTryBlock()
455 } else if (Tok.is(tok::kw___finally)) { in ParseSEHTryBlock()
459 return StmtError(Diag(Tok, diag::err_seh_expected_handler)); in ParseSEHTryBlock()
512 if (Tok.isNot(tok::l_brace)) in ParseSEHExceptBlock()
513 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace); in ParseSEHExceptBlock()
533 if (Tok.isNot(tok::l_brace)) in ParseSEHFinallyBlock()
534 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace); in ParseSEHFinallyBlock()
565 assert(Tok.is(tok::identifier) && Tok.getIdentifierInfo() && in ParseLabeledStatement()
568 Token IdentTok = Tok; // Save the whole token. in ParseLabeledStatement()
571 assert(Tok.is(tok::colon) && "Not a label!"); in ParseLabeledStatement()
578 if (Tok.is(tok::kw___attribute)) { in ParseLabeledStatement()
589 if (!getLangOpts().CPlusPlus || Tok.is(tok::semi)) in ParseLabeledStatement()
604 Diag(Tok, diag::err_expected_after) << "__attribute__" << tok::semi; in ParseLabeledStatement()
633 assert((MissingCase || Tok.is(tok::kw_case)) && "Not a case stmt!"); in ParseCaseStatement()
665 if (Tok.is(tok::code_completion)) { in ParseCaseStatement()
753 } while (Tok.is(tok::kw_case)); in ParseCaseStatement()
758 if (Tok.isNot(tok::r_brace)) { in ParseCaseStatement()
791 assert(Tok.is(tok::kw_default) && "Not a default stmt!"); in ParseDefaultStatement()
811 if (Tok.isNot(tok::r_brace)) { in ParseDefaultStatement()
859 assert(Tok.is(tok::l_brace) && "Not a compount stmt!"); in ParseCompoundStatement()
875 switch (Tok.getKind()) { in ParseCompoundStatementLeadingPragmas()
929 Tok.getLocation(), in ParseCompoundStatementBody()
950 while (Tok.is(tok::kw___label__)) { in ParseCompoundStatementBody()
955 if (Tok.isNot(tok::identifier)) { in ParseCompoundStatementBody()
956 Diag(Tok, diag::err_expected) << tok::identifier; in ParseCompoundStatementBody()
960 IdentifierInfo *II = Tok.getIdentifierInfo(); in ParseCompoundStatementBody()
971 StmtResult R = Actions.ActOnDeclStmt(Res, LabelLoc, Tok.getLocation()); in ParseCompoundStatementBody()
978 while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) && in ParseCompoundStatementBody()
979 Tok.isNot(tok::eof)) { in ParseCompoundStatementBody()
980 if (Tok.is(tok::annot_pragma_unused)) { in ParseCompoundStatementBody()
986 if (Tok.isNot(tok::kw___extension__)) { in ParseCompoundStatementBody()
994 while (Tok.is(tok::kw___extension__)) in ParseCompoundStatementBody()
1007 SourceLocation DeclStart = Tok.getLocation(), DeclEnd; in ParseCompoundStatementBody()
1032 SourceLocation CloseLoc = Tok.getLocation(); in ParseCompoundStatementBody()
1078 if (Cond.isInvalid() && Tok.isNot(tok::r_paren)) { in ParseParenExprOrCondition()
1082 if (Tok.isNot(tok::r_paren)) in ParseParenExprOrCondition()
1092 while (Tok.is(tok::r_paren)) { in ParseParenExprOrCondition()
1093 Diag(Tok, diag::err_extraneous_rparen_in_condition) in ParseParenExprOrCondition()
1094 << FixItHint::CreateRemoval(Tok.getLocation()); in ParseParenExprOrCondition()
1110 assert(Tok.is(tok::kw_if) && "Not an if stmt!"); in ParseIfStatement()
1114 if (Tok.is(tok::kw_constexpr)) { in ParseIfStatement()
1115 Diag(Tok, getLangOpts().CPlusPlus1z ? diag::warn_cxx14_compat_constexpr_if in ParseIfStatement()
1121 if (Tok.isNot(tok::l_paren)) { in ParseIfStatement()
1122 Diag(Tok, diag::err_expected_lparen_after) << "if"; in ParseIfStatement()
1173 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace)); in ParseIfStatement()
1176 SourceLocation ThenStmtLoc = Tok.getLocation(); in ParseIfStatement()
1195 if (Tok.is(tok::kw_else)) { in ParseIfStatement()
1197 *TrailingElseLoc = Tok.getLocation(); in ParseIfStatement()
1200 ElseStmtLoc = Tok.getLocation(); in ParseIfStatement()
1212 Tok.is(tok::l_brace)); in ParseIfStatement()
1221 } else if (Tok.is(tok::code_completion)) { in ParseIfStatement()
1256 assert(Tok.is(tok::kw_switch) && "Not a switch stmt!"); in ParseSwitchStatement()
1259 if (Tok.isNot(tok::l_paren)) { in ParseSwitchStatement()
1260 Diag(Tok, diag::err_expected_lparen_after) << "switch"; in ParseSwitchStatement()
1299 if (Tok.is(tok::l_brace)) { in ParseSwitchStatement()
1319 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace)); in ParseSwitchStatement()
1341 assert(Tok.is(tok::kw_while) && "Not a while stmt!"); in ParseWhileStatement()
1342 SourceLocation WhileLoc = Tok.getLocation(); in ParseWhileStatement()
1345 if (Tok.isNot(tok::l_paren)) { in ParseWhileStatement()
1346 Diag(Tok, diag::err_expected_lparen_after) << "while"; in ParseWhileStatement()
1390 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace)); in ParseWhileStatement()
1410 assert(Tok.is(tok::kw_do) && "Not a do stmt!"); in ParseDoStatement()
1432 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace)); in ParseDoStatement()
1440 if (Tok.isNot(tok::kw_while)) { in ParseDoStatement()
1442 Diag(Tok, diag::err_expected_while); in ParseDoStatement()
1450 if (Tok.isNot(tok::l_paren)) { in ParseDoStatement()
1451 Diag(Tok, diag::err_expected_lparen_after) << "do/while"; in ParseDoStatement()
1475 assert(Tok.is(tok::identifier)); in isForRangeIdentifier()
1485 bool Result = Tok.is(tok::colon); in isForRangeIdentifier()
1516 assert(Tok.is(tok::kw_for) && "Not a for stmt!"); in ParseForStatement()
1520 if (Tok.is(tok::kw_co_await)) in ParseForStatement()
1523 if (Tok.isNot(tok::l_paren)) { in ParseForStatement()
1524 Diag(Tok, diag::err_expected_lparen_after) << "for"; in ParseForStatement()
1565 if (Tok.is(tok::code_completion)) { in ParseForStatement()
1577 if (Tok.is(tok::semi)) { // for (; in ParseForStatement()
1581 } else if (getLangOpts().CPlusPlus && Tok.is(tok::identifier) && in ParseForStatement()
1584 IdentifierInfo *Name = Tok.getIdentifierInfo(); in ParseForStatement()
1589 if (Tok.is(tok::l_brace)) in ParseForStatement()
1605 Diag(Tok, diag::ext_c99_variable_decl_in_for_loop); in ParseForStatement()
1611 SourceLocation DeclStart = Tok.getLocation(), DeclEnd; in ParseForStatement()
1615 FirstPart = Actions.ActOnDeclStmt(DG, DeclStart, Tok.getLocation()); in ParseForStatement()
1621 } else if (Tok.is(tok::semi)) { // for (int x = 4; in ParseForStatement()
1628 if (Tok.is(tok::code_completion)) { in ParseForStatement()
1635 Diag(Tok, diag::err_expected_semi_for); in ParseForStatement()
1651 if (Tok.is(tok::semi)) { in ParseForStatement()
1656 if (Tok.is(tok::code_completion)) { in ParseForStatement()
1662 } else if (getLangOpts().CPlusPlus11 && Tok.is(tok::colon) && FirstPart.get()) { in ParseForStatement()
1665 Diag(Tok, diag::err_for_range_expected_decl) in ParseForStatement()
1671 Diag(Tok, diag::err_expected_semi_for); in ParseForStatement()
1675 if (Tok.is(tok::semi)) in ParseForStatement()
1685 if (Tok.is(tok::semi)) { // for (...;; in ParseForStatement()
1687 } else if (Tok.is(tok::r_paren)) { in ParseForStatement()
1704 if (Tok.isNot(tok::semi)) { in ParseForStatement()
1706 Diag(Tok, diag::err_expected_semi_for); in ParseForStatement()
1712 if (Tok.is(tok::semi)) { in ParseForStatement()
1717 if (Tok.isNot(tok::r_paren)) { // for (...;...;) in ParseForStatement()
1775 Tok.is(tok::l_brace)); in ParseForStatement()
1816 assert(Tok.is(tok::kw_goto) && "Not a goto stmt!"); in ParseGotoStatement()
1820 if (Tok.is(tok::identifier)) { in ParseGotoStatement()
1821 LabelDecl *LD = Actions.LookupOrCreateLabel(Tok.getIdentifierInfo(), in ParseGotoStatement()
1822 Tok.getLocation()); in ParseGotoStatement()
1823 Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(), LD); in ParseGotoStatement()
1825 } else if (Tok.is(tok::star)) { in ParseGotoStatement()
1827 Diag(Tok, diag::ext_gnu_indirect_goto); in ParseGotoStatement()
1836 Diag(Tok, diag::err_expected) << tok::identifier; in ParseGotoStatement()
1872 assert((Tok.is(tok::kw_return) || Tok.is(tok::kw_co_return)) && in ParseReturnStatement()
1874 bool IsCoreturn = Tok.is(tok::kw_co_return); in ParseReturnStatement()
1878 if (Tok.isNot(tok::semi)) { in ParseReturnStatement()
1880 if (Tok.is(tok::code_completion) && !IsCoreturn) { in ParseReturnStatement()
1886 if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus) { in ParseReturnStatement()
1913 while (Tok.is(tok::annot_pragma_loop_hint)) { in ParsePragmaLoopHint()
1936 assert(Tok.is(tok::l_brace)); in ParseFunctionStatementBody()
1937 SourceLocation LBraceLoc = Tok.getLocation(); in ParseFunctionStatementBody()
1969 assert(Tok.is(tok::kw_try) && "Expected 'try'"); in ParseFunctionTryBlock()
1976 if (Tok.is(tok::colon)) in ParseFunctionTryBlock()
1987 SourceLocation LBraceLoc = Tok.getLocation(); in ParseFunctionTryBlock()
2011 bool IsTryCatch = Tok.is(tok::kw_try); in trySkippingFunctionBody()
2014 if (llvm::any_of(Toks, [](const Token &Tok) { in trySkippingFunctionBody() argument
2015 return Tok.is(tok::code_completion); in trySkippingFunctionBody()
2029 while (IsTryCatch && Tok.is(tok::kw_catch)) { in trySkippingFunctionBody()
2046 assert(Tok.is(tok::kw_try) && "Expected 'try'"); in ParseCXXTryBlock()
2069 if (Tok.isNot(tok::l_brace)) in ParseCXXTryBlockCommon()
2070 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace); in ParseCXXTryBlockCommon()
2080 if ((Tok.is(tok::identifier) && in ParseCXXTryBlockCommon()
2081 Tok.getIdentifierInfo() == getSEHExceptKeyword()) || in ParseCXXTryBlockCommon()
2082 Tok.is(tok::kw___finally)) { in ParseCXXTryBlockCommon()
2085 if(Tok.getIdentifierInfo() == getSEHExceptKeyword()) { in ParseCXXTryBlockCommon()
2108 if (Tok.isNot(tok::kw_catch)) in ParseCXXTryBlockCommon()
2109 return StmtError(Diag(Tok, diag::err_expected_catch)); in ParseCXXTryBlockCommon()
2110 while (Tok.is(tok::kw_catch)) { in ParseCXXTryBlockCommon()
2135 assert(Tok.is(tok::kw_catch) && "Expected 'catch'"); in ParseCXXCatchBlock()
2152 if (Tok.isNot(tok::ellipsis)) { in ParseCXXCatchBlock()
2172 if (Tok.isNot(tok::l_brace)) in ParseCXXCatchBlock()
2173 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace); in ParseCXXCatchBlock()
2193 if (!Tok.is(tok::l_brace)) { in ParseMicrosoftIfExistsStatement()
2194 Diag(Tok, diag::err_expected) << tok::l_brace; in ParseMicrosoftIfExistsStatement()
2214 Diag(Tok, diag::err_expected) << tok::l_brace; in ParseMicrosoftIfExistsStatement()
2232 while (Tok.isNot(tok::r_brace)) { in ParseMicrosoftIfExistsStatement()
2249 if (!(Tok.is(tok::kw_for) || Tok.is(tok::kw_while) || Tok.is(tok::kw_do))) { in ParseOpenCLUnrollHintAttribute()
2250 Diag(Tok, diag::err_opencl_unroll_hint_on_non_loop); in ParseOpenCLUnrollHintAttribute()