Home | History | Annotate | Download | only in Parse

Lines Matching refs:Tok

122     WantTypeSpecifiers = nextTok.isOneOf(tok::l_paren, tok::less, tok::l_square,
123 tok::identifier, tok::star, tok::amp);
125 nextTok.isOneOf(tok::l_paren, tok::identifier, tok::arrow, tok::period);
127 nextTok.isOneOf(tok::l_paren, tok::semi, tok::identifier, tok::l_brace);
134 if (NextToken.is(tok::equal))
136 if (NextToken.is(tok::period) &&
158 tok::TokenKind Kind = Tok.getKind();
161 case tok::at: // May be a @try or @throw statement
168 case tok::code_completion:
173 case tok::identifier: {
175 if (Next.is(tok::colon)) { // C99 6.8.1: labeled-statement
182 if (Next.isNot(tok::coloncolon)) {
190 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
191 if (Tok.is(tok::semi))
197 if (Tok.isNot(tok::identifier))
206 SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
212 if (Tok.is(tok::r_brace)) {
213 Diag(Tok, diag::err_expected_statement);
220 case tok::kw_case: // C99 6.8.1: labeled-statement
222 case tok::kw_default: // C99 6.8.1: labeled-statement
225 case tok::l_brace: // C99 6.8.2: compound-statement
227 case tok::semi: { // C99 6.8.3p3: expression[opt] ';'
228 bool HasLeadingEmptyMacro = Tok.hasLeadingEmptyMacro();
232 case tok::kw_if: // C99 6.8.4.1: if-statement
234 case tok::kw_switch: // C99 6.8.4.2: switch-statement
237 case tok::kw_while: // C99 6.8.5.1: while-statement
239 case tok::kw_do: // C99 6.8.5.2: do-statement
243 case tok::kw_for: // C99 6.8.5.3: for-statement
246 case tok::kw_goto: // C99 6.8.6.1: goto-statement
250 case tok::kw_continue: // C99 6.8.6.2: continue-statement
254 case tok::kw_break: // C99 6.8.6.3: break-statement
258 case tok::kw_return: // C99 6.8.6.4: return-statement
262 case tok::kw_co_return: // C++ Coroutines: co_return statement
267 case tok::kw_asm: {
277 case tok::kw___if_exists:
278 case tok::kw___if_not_exists:
285 case tok::kw_try: // C++ 15: try-block
288 case tok::kw___try:
292 case tok::kw___leave:
297 case tok::annot_pragma_vis:
302 case tok::annot_pragma_pack:
307 case tok::annot_pragma_msstruct:
312 case tok::annot_pragma_align:
317 case tok::annot_pragma_weak:
322 case tok::annot_pragma_weakalias:
327 case tok::annot_pragma_redefine_extname:
332 case tok::annot_pragma_fp_contract:
334 Diag(Tok, diag::err_pragma_fp_contract_scope);
338 case tok::annot_pragma_opencl_extension:
343 case tok::annot_pragma_captured:
347 case tok::annot_pragma_openmp:
351 case tok::annot_pragma_ms_pointers_to_members:
356 case tok::annot_pragma_ms_pragma:
361 case tok::annot_pragma_ms_vtordisp:
366 case tok::annot_pragma_loop_hint:
372 if (!TryConsumeToken(tok::semi) && !Res.isInvalid()) {
376 ExpectAndConsume(tok::semi, diag::err_expected_semi_after_stmt, SemiError);
378 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
387 Token OldToken = Tok;
395 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
396 if (Tok.is(tok::semi))
401 if (Tok.is(tok::colon) && getCurScope()->isSwitchScope() &&
427 assert(Tok.is(tok::kw___try) && "Expected '__try'");
430 if (Tok.isNot(tok::l_brace))
431 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace);
439 if (Tok.is(tok::identifier) &&
440 Tok.getIdentifierInfo() == getSEHExceptKeyword()) {
443 } else if (Tok.is(tok::kw___finally)) {
447 return StmtError(Diag(Tok, diag::err_seh_expected_handler));
469 if (ExpectAndConsume(tok::l_paren))
497 if (ExpectAndConsume(tok::r_paren))
500 if (Tok.isNot(tok::l_brace))
501 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace);
521 if (Tok.isNot(tok::l_brace))
522 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace);
553 assert(Tok.is(tok::identifier) && Tok.getIdentifierInfo() &&
556 Token IdentTok = Tok; // Save the whole token.
559 assert(Tok.is(tok::colon) && "Not a label!");
566 if (Tok.is(tok::kw___attribute)) {
577 if (!getLangOpts().CPlusPlus || Tok.is(tok::semi))
591 Diag(Tok, diag::err_expected_after) << "__attribute__" << tok::semi;
620 assert((MissingCase || Tok.is(tok::kw_case)) && "Not a case stmt!");
652 if (Tok.is(tok::code_completion)) {
674 if (SkipUntil(tok::colon, tok::r_brace, StopAtSemi | StopBeforeMatch)) {
675 TryConsumeToken(tok::colon, ColonLoc);
688 if (TryConsumeToken(tok::ellipsis, DotDotDotLoc)) {
692 if (SkipUntil(tok::colon, tok::r_brace, StopAtSemi | StopBeforeMatch)) {
693 TryConsumeToken(tok::colon, ColonLoc);
702 if (TryConsumeToken(tok::colon, ColonLoc)) {
703 } else if (TryConsumeToken(tok::semi, ColonLoc) ||
704 TryConsumeToken(tok::coloncolon, ColonLoc)) {
707 << "'case'" << tok::colon
712 << "'case'" << tok::colon
739 } while (Tok.is(tok::kw_case));
744 if (Tok.isNot(tok::r_brace)) {
776 assert(Tok.is(tok::kw_default) && "Not a default stmt!");
780 if (TryConsumeToken(tok::colon, ColonLoc)) {
781 } else if (TryConsumeToken(tok::semi, ColonLoc)) {
784 << "'default'" << tok::colon
789 << "'default'" << tok::colon
796 if (Tok.isNot(tok::r_brace)) {
843 assert(Tok.is(tok::l_brace) && "Not a compount stmt!");
859 switch (Tok.getKind()) {
860 case tok::annot_pragma_vis:
863 case tok::annot_pragma_pack:
866 case tok::annot_pragma_msstruct:
869 case tok::annot_pragma_align:
872 case tok::annot_pragma_weak:
875 case tok::annot_pragma_weakalias:
878 case tok::annot_pragma_redefine_extname:
881 case tok::annot_pragma_opencl_extension:
884 case tok::annot_pragma_fp_contract:
887 case tok::annot_pragma_ms_pointers_to_members:
890 case tok::annot_pragma_ms_pragma:
893 case tok::annot_pragma_ms_vtordisp:
910 Tok.getLocation(),
918 BalancedDelimiterTracker T(*this, tok::l_brace);
931 while (Tok.is(tok::kw___label__)) {
936 if (Tok.isNot(tok::identifier)) {
937 Diag(Tok, diag::err_expected) << tok::identifier;
941 IdentifierInfo *II = Tok.getIdentifierInfo();
945 if (!TryConsumeToken(tok::comma))
952 StmtResult R = Actions.ActOnDeclStmt(Res, LabelLoc, Tok.getLocation());
959 while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
960 Tok.isNot(tok::eof)) {
961 if (Tok.is(tok::annot_pragma_unused)) {
967 if (Tok.isNot(tok::kw___extension__)) {
975 while (Tok.is(tok::kw___extension__))
988 SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
997 SkipUntil(tok::semi);
1013 SourceLocation CloseLoc = Tok.getLocation();
1040 BalancedDelimiterTracker T(*this, tok::l_paren);
1058 if (ExprResult.isInvalid() && !DeclResult && Tok.isNot(tok::r_paren)) {
1059 SkipUntil(tok::semi);
1062 if (Tok.isNot(tok::r_paren))
1072 while (Tok.is(tok::r_paren)) {
1073 Diag(Tok, diag::err_extraneous_rparen_in_condition)
1074 << FixItHint::CreateRemoval(Tok.getLocation());
1090 assert(Tok.is(tok::kw_if) && "Not an if stmt!");
1093 if (Tok.isNot(tok::l_paren)) {
1094 Diag(Tok, diag::err_expected_lparen_after) << "if";
1095 SkipUntil(tok::semi);
1141 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace));
1144 SourceLocation ThenStmtLoc = Tok.getLocation();
1157 if (Tok.is(tok::kw_else)) {
1159 *TrailingElseLoc = Tok.getLocation();
1162 ElseStmtLoc = Tok.getLocation();
1173 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace));
1179 } else if (Tok.is(tok::code_completion)) {
1214 assert(Tok.is(tok::kw_switch) && "Not a switch stmt!");
1217 if (Tok.isNot(tok::l_paren)) {
1218 Diag(Tok, diag::err_expected_lparen_after) << "switch";
1219 SkipUntil(tok::semi);
1256 if (Tok.is(tok::l_brace)) {
1258 SkipUntil(tok::r_brace);
1260 SkipUntil(tok::semi);
1276 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace));
1298 assert(Tok.is(tok::kw_while) && "Not a while stmt!");
1299 SourceLocation WhileLoc = Tok.getLocation();
1302 if (Tok.isNot(tok::l_paren)) {
1303 Diag(Tok, diag::err_expected_lparen_after) << "while";
1304 SkipUntil(tok::semi);
1349 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace));
1369 assert(Tok.is(tok::kw_do) && "Not a do stmt!");
1391 ParseScope InnerScope(this, Scope::DeclScope, C99orCXX, Tok.is(tok::l_brace));
1399 if (Tok.isNot(tok::kw_while)) {
1401 Diag(Tok, diag::err_expected_while);
1403 SkipUntil(tok::semi, StopBeforeMatch);
1409 if (Tok.isNot(tok::l_paren)) {
1410 Diag(Tok, diag::err_expected_lparen_after) << "do/while";
1411 SkipUntil(tok::semi, StopBeforeMatch);
1416 BalancedDelimiterTracker T(*this, tok::l_paren);
1434 assert(Tok.is(tok::identifier));
1437 if (Next.is(tok::colon))
1440 if (Next.isOneOf(tok::l_square, tok::kw_alignas)) {
1444 bool Result = Tok.is(tok::colon);
1475 assert(Tok.is(tok::kw_for) && "Not a for stmt!");
1479 if (Tok.is(tok::kw_co_await))
1482 if (Tok.isNot(tok::l_paren)) {
1483 Diag(Tok, diag::err_expected_lparen_after) << "for";
1484 SkipUntil(tok::semi);
1512 BalancedDelimiterTracker T(*this, tok::l_paren);
1526 if (Tok.is(tok::code_completion)) {
1538 if (Tok.is(tok::semi)) { // for (;
1542 } else if (getLangOpts().CPlusPlus && Tok.is(tok::identifier) &&
1545 IdentifierInfo *Name = Tok.getIdentifierInfo();
1550 if (Tok.is(tok::l_brace))
1566 Diag(Tok, diag::ext_c99_variable_decl_in_for_loop);
1572 SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
1576 FirstPart = Actions.ActOnDeclStmt(DG, DeclStart, Tok.getLocation());
1582 } else if (Tok.is(tok::semi)) { // for (int x = 4;
1589 if (Tok.is(tok::code_completion)) {
1596 Diag(Tok, diag::err_expected_semi_for);
1612 if (Tok.is(tok::semi)) {
1617 if (Tok.is(tok::code_completion)) {
1623 } else if (getLangOpts().CPlusPlus11 && Tok.is(tok::colon) && FirstPart.get()) {
1626 Diag(Tok, diag::err_for_range_expected_decl)
1628 SkipUntil(tok::r_paren, StopBeforeMatch);
1632 Diag(Tok, diag::err_expected_semi_for);
1635 SkipUntil(tok::r_paren, StopAtSemi | StopBeforeMatch);
1636 if (Tok.is(tok::semi))
1647 if (Tok.is(tok::semi)) { // for (...;;
1649 } else if (Tok.is(tok::r_paren)) {
1665 if (Tok.isNot(tok::semi)) {
1667 Diag(Tok, diag::err_expected_semi_for);
1670 SkipUntil(tok::r_paren, StopAtSemi | StopBeforeMatch);
1673 if (Tok.is(tok::semi)) {
1678 if (Tok.isNot(tok::r_paren)) { // for (...;...;)
1734 Tok.is(tok::l_brace));
1775 assert(Tok.is(tok::kw_goto) && "Not a goto stmt!");
1779 if (Tok.is(tok::identifier)) {
1780 LabelDecl *LD = Actions.LookupOrCreateLabel(Tok.getIdentifierInfo(),
1781 Tok.getLocation());
1782 Res = Actions.ActOnGotoStmt(GotoLoc, Tok.getLocation(), LD);
1784 } else if (Tok.is(tok::star)) {
1786 Diag(Tok, diag::ext_gnu_indirect_goto);
1790 SkipUntil(tok::semi, StopBeforeMatch);
1795 Diag(Tok, diag::err_expected) << tok::identifier;
1831 assert((Tok.is(tok::kw_return) || Tok.is(tok::kw_co_return)) &&
1833 bool IsCoreturn = Tok.is(tok::kw_co_return);
1837 if (Tok.isNot(tok::semi)) {
1839 if (Tok.is(tok::code_completion) && !IsCoreturn) {
1845 if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus) {
1855 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
1871 while (Tok.is(tok::annot_pragma_loop_hint)) {
1894 assert(Tok.is(tok::l_brace));
1895 Tok.getLocation();
1932 assert(Tok.is(tok::kw_try) && "Expected 'try'");
1939 if (Tok.is(tok::colon))
1955 SourceLocation LBraceLoc = Tok.getLocation();
1969 assert(Tok.is(tok::l_brace));
1975 SkipUntil(tok::r_brace);
1983 if (SkipUntil(tok::r_brace, StopAtCodeCompletion)) {
1998 assert(Tok.is(tok::kw_try) && "Expected 'try'");
2021 if (Tok.isNot(tok::l_brace))
2022 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace);
2032 if ((Tok.is(tok::identifier) &&
2033 Tok.getIdentifierInfo() == getSEHExceptKeyword()) ||
2034 Tok.is(tok::kw___finally)) {
2037 if(Tok.getIdentifierInfo() == getSEHExceptKeyword()) {
2060 if (Tok.isNot(tok::kw_catch))
2061 return StmtError(Diag(Tok, diag::err_expected_catch));
2062 while (Tok.is(tok::kw_catch)) {
2087 assert(Tok.is(tok::kw_catch) && "Expected 'catch'");
2091 BalancedDelimiterTracker T(*this, tok::l_paren);
2104 if (Tok.isNot(tok::ellipsis)) {
2124 if (Tok.isNot(tok::l_brace))
2125 return StmtError(Diag(Tok, diag::err_expected) << tok::l_brace);
2145 if (!Tok.is(tok::l_brace)) {
2146 Diag(Tok, diag::err_expected) << tok::l_brace;
2164 BalancedDelimiterTracker Braces(*this, tok::l_brace);
2166 Diag(Tok, diag::err_expected) << tok::l_brace;
2184 while (Tok.isNot(tok::r_brace)) {