Home | History | Annotate | Download | only in Parse

Lines Matching refs:Tok

149     LHS = Actions.ActOnUnaryOp(getCurScope(), ExtLoc, tok::kw___extension__,
157 if (Tok.is(tok::code_completion)) {
163 if (Tok.is(tok::kw_throw))
208 tok::TokenKind K = Tok.getKind();
209 if (K == tok::l_brace || K == tok::r_brace ||
210 K == tok::kw_for || K == tok::kw_while ||
211 K == tok::kw_if || K == tok::kw_else ||
212 K == tok::kw_goto || K == tok::kw_try)
222 prec::Level NextTokPrec = getBinOpPrecedence(Tok.getKind(),
235 Token OpToken = Tok;
243 if (OpToken.is(tok::comma) && isNotExpressionStart()) {
244 PP.EnterToken(Tok);
245 Tok = OpToken;
252 if (Tok.isNot(tok::colon)) {
269 Diag(Tok, diag::ext_gnu_conditional_expr);
272 if (Tok.is(tok::colon)) {
280 SourceLocation FILoc = Tok.getLocation();
298 Diag(Tok, diag::err_expected_colon)
301 ColonLoc = Tok.getLocation();
307 if (Tok.is(tok::code_completion) && NextTokPrec == prec::Assignment) {
325 if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
339 NextTokPrec = getBinOpPrecedence(Tok.getKind(), GreaterThanIsOperator,
351 Diag(Tok, diag::err_init_list_bin_op)
352 << /*LHS*/0 << PP.getSpelling(Tok) << Actions.getExprRange(RHS.get());
367 NextTokPrec = getBinOpPrecedence(Tok.getKind(), GreaterThanIsOperator,
390 if (!GreaterThanIsOperator && OpToken.is(tok::greatergreater))
421 Diag(Tok, diag::err_expected_expression);
620 tok::TokenKind SavedKind = Tok.getKind();
635 case tok::l_paren: {
669 case tok::numeric_constant:
673 Res = Actions.ActOnNumericConstant(Tok, /*UDLScope*/getCurScope());
677 case tok::kw_true:
678 case tok::kw_false:
681 case tok::kw___objc_yes:
682 case tok::kw___objc_no:
685 case tok::kw_nullptr:
686 Diag(Tok, diag::warn_cxx98_compat_nullptr);
689 case tok::annot_primary_expr:
691 Res = getExprAnnotation(Tok);
695 case tok::kw_decltype:
699 assert(Tok.isNot(tok::kw_decltype));
702 case tok::identifier: { // primary-expression: identifier
715 if (Next.is(tok::l_paren) &&
716 Tok.is(tok::identifier) &&
717 Tok.getIdentifierInfo()->hasRevertedTokenIDToIdentifier()) {
718 IdentifierInfo *II = Tok.getIdentifierInfo();
724 = RTT_JOIN(tok::kw_,Name)
749 llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind>::iterator Known
752 Tok.setKind(Known->second);
758 if (Next.is(tok::coloncolon) ||
759 (!ColonIsSacred && Next.is(tok::colon)) ||
760 Next.is(tok::less) ||
761 Next.is(tok::l_paren) ||
762 Next.is(tok::l_brace)) {
766 if (!Tok.is(tok::identifier))
773 IdentifierInfo &II = *Tok.getIdentifierInfo();
777 if (getLangOpts().ObjC1 && Tok.is(tok::period) &&
784 if (Tok.isNot(tok::identifier) &&
785 !(getLangOpts().CPlusPlus && Tok.is(tok::kw_class))) {
786 Diag(Tok, diag::err_expected_property_name);
789 IdentifierInfo &PropertyName = *Tok.getIdentifierInfo();
803 ((Tok.is(tok::identifier) &&
804 (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) ||
805 Tok.is(tok::code_completion))) {
817 ((Tok.is(tok::identifier) && !InMessageExpression) ||
818 Tok.is(tok::code_completion))) {
820 if (Tok.is(tok::code_completion) ||
821 Next.is(tok::colon) || Next.is(tok::r_square))
859 Name, Tok.is(tok::l_paren),
863 case tok::char_constant: // constant: character-constant
864 case tok::wide_char_constant:
865 case tok::utf16_char_constant:
866 case tok::utf32_char_constant:
867 Res = Actions.ActOnCharacterConstant(Tok, /*UDLScope*/getCurScope());
870 case tok::kw___func__: // primary-expression: __func__ [C99 6.4.2.2]
871 case tok::kw___FUNCTION__: // primary-expression: __FUNCTION__ [GNU]
872 case tok::kw_L__FUNCTION__: // primary-expression: L__FUNCTION__ [MS]
873 case tok::kw___PRETTY_FUNCTION__: // primary-expression: __P..Y_F..N__ [GNU]
874 Res = Actions.ActOnPredefinedExpr(Tok.getLocation(), SavedKind);
877 case tok::string_literal: // primary-expression: string-literal
878 case tok::wide_string_literal:
879 case tok::utf8_string_literal:
880 case tok::utf16_string_literal:
881 case tok::utf32_string_literal:
884 case tok::kw__Generic: // primary-expression: generic-selection [C11 6.5.1]
887 case tok::kw___builtin_va_arg:
888 case tok::kw___builtin_offsetof:
889 case tok::kw___builtin_choose_expr:
890 case tok::kw___builtin_astype: // primary-expression: [OCL] as_type()
892 case tok::kw___null:
895 case tok::plusplus: // unary-expression: '++' unary-expression [C99]
896 case tok::minusminus: { // unary-expression: '--' unary-expression [C99]
907 case tok::amp: { // unary-expression: '&' cast-expression
916 case tok::star: // unary-expression: '*' cast-expression
917 case tok::plus: // unary-expression: '+' cast-expression
918 case tok::minus: // unary-expression: '-' cast-expression
919 case tok::tilde: // unary-expression: '~' cast-expression
920 case tok::exclaim: // unary-expression: '!' cast-expression
921 case tok::kw___real: // unary-expression: '__real' cast-expression [GNU]
922 case tok::kw___imag: { // unary-expression: '__imag' cast-expression [GNU]
930 case tok::kw___extension__:{//unary-expression:'__extension__' cast-expr [GNU]
939 case tok::kw__Alignof: // unary-expression: '_Alignof' '(' type-name ')'
941 Diag(Tok, diag::ext_c11_alignment) << Tok.getName();
943 case tok::kw_alignof: // unary-expression: 'alignof' '(' type-id ')'
944 case tok::kw___alignof: // unary-expression: '__alignof' unary-expression
946 case tok::kw_sizeof: // unary-expression: 'sizeof' unary-expression
948 case tok::kw_vec_step: // unary-expression: OpenCL 'vec_step' expression
950 case tok::ampamp: { // unary-expression: '&&' identifier
952 if (Tok.isNot(tok::identifier))
953 return ExprError(Diag(Tok, diag::err_expected_ident));
956 return ExprError(Diag(Tok, diag::err_address_of_label_outside_fn));
959 LabelDecl *LD = Actions.LookupOrCreateLabel(Tok.getIdentifierInfo(),
960 Tok.getLocation());
961 Res = Actions.ActOnAddrLabel(AmpAmpLoc, Tok.getLocation(), LD);
965 case tok::kw_const_cast:
966 case tok::kw_dynamic_cast:
967 case tok::kw_reinterpret_cast:
968 case tok::kw_static_cast:
971 case tok::kw_typeid:
974 case tok::kw___uuidof:
977 case tok::kw_this:
981 case tok::annot_typename:
983 ParsedType Type = getTypeAnnotation(Tok);
987 DS.SetRangeStart(Tok.getLocation());
988 DS.SetRangeEnd(Tok.getLastLoc());
992 DS.SetTypeSpecType(TST_typename, Tok.getAnnotationEndLoc(),
1007 case tok::annot_decltype:
1008 case tok::kw_char:
1009 case tok::kw_wchar_t:
1010 case tok::kw_char16_t:
1011 case tok::kw_char32_t:
1012 case tok::kw_bool:
1013 case tok::kw_short:
1014 case tok::kw_int:
1015 case tok::kw_long:
1016 case tok::kw___int64:
1017 case tok::kw___int128:
1018 case tok::kw_signed:
1019 case tok::kw_unsigned:
1020 case tok::kw_half:
1021 case tok::kw_float:
1022 case tok::kw_double:
1023 case tok::kw_void:
1024 case tok::kw_typename:
1025 case tok::kw_typeof:
1026 case tok::kw___vector:
1027 case tok::kw_image1d_t:
1028 case tok::kw_image1d_array_t:
1029 case tok::kw_image1d_buffer_t:
1030 case tok::kw_image2d_t:
1031 case tok::kw_image2d_array_t:
1032 case tok::kw_image3d_t:
1033 case tok::kw_sampler_t:
1034 case tok::kw_event_t: {
1036 Diag(Tok, diag::err_expected_expression);
1040 if (SavedKind == tok::kw_typename) {
1052 if (Tok.isNot(tok::l_paren) &&
1053 (!getLangOpts().CPlusPlus11 || Tok.isNot(tok::l_brace)))
1054 return ExprError(Diag(Tok, diag::err_expected_lparen_after_type)
1057 if (Tok.is(tok::l_brace))
1058 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1064 case tok::annot_cxxscope: { // [C++] id-expression: qualified-id
1069 if (!Tok.is(tok::annot_cxxscope))
1074 if (Next.is(tok::annot_template_id)) {
1094 case tok::annot_template_id: { // [C++] template-id
1095 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
1108 case tok::kw_operator: // [C++] id-expression: operator/conversion-function-id
1112 case tok::coloncolon: {
1117 if (!Tok.is(tok::coloncolon))
1123 if (Tok.is(tok::kw_new))
1125 if (Tok.is(tok::kw_delete))
1133 case tok::kw_new: // [C++] new-expression
1134 return ParseCXXNewExpression(false, Tok.getLocation());
1136 case tok::kw_delete: // [C++] delete-expression
1137 return ParseCXXDeleteExpression(false, Tok.getLocation());
1139 case tok::kw_noexcept: { // [C++0x] 'noexcept' '(' expression ')'
1140 Diag(Tok, diag::warn_cxx98_compat_noexcept_expr);
1142 BalancedDelimiterTracker T(*this, tok::l_paren);
1160 case tok::kw___is_abstract: // [GNU] unary-type-trait
1161 case tok::kw___is_class:
1162 case tok::kw___is_empty:
1163 case tok::kw___is_enum:
1164 case tok::kw___is_interface_class:
1165 case tok::kw___is_literal:
1166 case tok::kw___is_arithmetic:
1167 case tok::kw___is_integral:
1168 case tok::kw___is_floating_point:
1169 case tok::kw___is_complete_type:
1170 case tok::kw___is_void:
1171 case tok::kw___is_array:
1172 case tok::kw___is_function:
1173 case tok::kw___is_reference:
1174 case tok::kw___is_lvalue_reference:
1175 case tok::kw___is_rvalue_reference:
1176 case tok::kw___is_fundamental:
1177 case tok::kw___is_object:
1178 case tok::kw___is_scalar:
1179 case tok::kw___is_compound:
1180 case tok::kw___is_pointer:
1181 case tok::kw___is_member_object_pointer:
1182 case tok::kw___is_member_function_pointer:
1183 case tok::kw___is_member_pointer:
1184 case tok::kw___is_const:
1185 case tok::kw___is_volatile:
1186 case tok::kw___is_standard_layout:
1187 case tok::kw___is_signed:
1188 case tok::kw___is_unsigned:
1189 case tok::kw___is_literal_type:
1190 case tok::kw___is_pod:
1191 case tok::kw___is_polymorphic:
1192 case tok::kw___is_trivial:
1193 case tok::kw___is_trivially_copyable:
1194 case tok::kw___is_union:
1195 case tok::kw___is_final:
1196 case tok::kw___has_trivial_constructor:
1197 case tok::kw___has_trivial_move_constructor:
1198 case tok::kw___has_trivial_copy:
1199 case tok::kw___has_trivial_assign:
1200 case tok::kw___has_trivial_move_assign:
1201 case tok::kw___has_trivial_destructor:
1202 case tok::kw___has_nothrow_assign:
1203 case tok::kw___has_nothrow_move_assign:
1204 case tok::kw___has_nothrow_copy:
1205 case tok::kw___has_nothrow_constructor:
1206 case tok::kw___has_virtual_destructor:
1209 case tok::kw___builtin_types_compatible_p:
1210 case tok::kw___is_base_of:
1211 case tok::kw___is_same:
1212 case tok::kw___is_convertible:
1213 case tok::kw___is_convertible_to:
1214 case tok::kw___is_trivially_assignable:
1217 case tok::kw___is_trivially_constructible:
1220 case tok::kw___array_rank:
1221 case tok::kw___array_extent:
1224 case tok::kw___is_lvalue_expr:
1225 case tok::kw___is_rvalue_expr:
1228 case tok::at: {
1232 case tok::caret:
1235 case tok::code_completion: {
1240 case tok::l_square:
1296 switch (Tok.getKind()) {
1297 case tok::code_completion:
1305 case tok::identifier:
1310 (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) {
1320 case tok::l_square: { // postfix-expression: p-e '[' expression ']'
1327 if (getLangOpts().ObjC1 && Tok.isAtStartOfLine() &&
1336 BalancedDelimiterTracker T(*this, tok::l_square);
1340 if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
1341 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1346 SourceLocation RLoc = Tok.getLocation();
1348 if (!LHS.isInvalid() && !Idx.isInvalid() && Tok.is(tok::r_square)) {
1359 case tok::l_paren: // p-e: p-e '(' argument-expression-list[opt] ')'
1360 case tok::lesslessless: { // p-e: p-e '<<<' argument-expression-list '>>>'
1362 tok::TokenKind OpKind = Tok.getKind();
1367 BalancedDelimiterTracker PT(*this, tok::l_paren);
1369 if (OpKind == tok::lesslessless) {
1378 SourceLocation CloseLoc = Tok.getLocation();
1379 if (Tok.is(tok::greatergreatergreater)) {
1382 SkipUntil(tok::greatergreatergreater);
1385 Diag(Tok, diag::err_expected_ggg);
1387 SkipUntil(tok::greatergreatergreater);
1392 if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen, ""))
1416 if (Tok.is(tok::code_completion)) {
1422 if (OpKind == tok::l_paren || !LHS.isInvalid()) {
1423 if (Tok.isNot(tok::r_paren)) {
1433 SkipUntil(tok::r_paren);
1434 } else if (Tok.isNot(tok::r_paren)) {
1442 ArgExprs, Tok.getLocation(),
1449 case tok::arrow:
1450 case tok::period: {
1453 tok::TokenKind OpKind = Tok.getKind();
1462 if (BaseType && Tok.is(tok::l_paren) &&
1467 << (OpKind == tok::arrow) << Base->getSourceRange()
1485 if (Tok.is(tok::code_completion)) {
1488 OpLoc, OpKind == tok::arrow);
1509 if (getLangOpts().ObjC2 && OpKind == tok::period && Tok.is(tok::kw_class)) {
1517 IdentifierInfo *Id = Tok.getIdentifierInfo();
1532 Tok.is(tok::l_paren));
1535 case tok::plusplus: // postfix-expression: postfix-expression '++'
1536 case tok::minusminus: // postfix-expression: postfix-expression '--'
1538 LHS = Actions.ActOnPostfixUnaryOp(getCurScope(), Tok.getLocation(),
1539 Tok.getKind(), LHS.take());
1576 assert((OpTok.is(tok::kw_typeof) || OpTok.is(tok::kw_sizeof) ||
1577 OpTok.is(tok::kw___alignof) || OpTok.is(tok::kw_alignof) ||
1578 OpTok.is(tok::kw__Alignof) || OpTok.is(tok::kw_vec_step)) &&
1584 if (Tok.isNot(tok::l_paren)) {
1586 if (OpTok.is(tok::kw_typeof) && !getLangOpts().CPlusPlus) {
1587 Diag(Tok,diag::err_expected_lparen_after_id) << OpTok.getIdentifierInfo();
1598 SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
1611 if (getLangOpts().CPlusPlus || OpTok.isNot(tok::kw_typeof)) {
1640 assert((Tok.is(tok::kw_sizeof) || Tok.is(tok::kw___alignof) ||
1641 Tok.is(tok::kw_alignof) || Tok.is(tok::kw__Alignof) ||
1642 Tok.is(tok::kw_vec_step)) &&
1644 Token OpTok = Tok;
1648 if (Tok.is(tok::ellipsis) && OpTok.is(tok::kw_sizeof)) {
1653 if (Tok.is(tok::l_paren)) {
1654 BalancedDelimiterTracker T(*this, tok::l_paren);
1657 if (Tok.is(tok::identifier)) {
1658 Name = Tok.getIdentifierInfo();
1665 Diag(Tok, diag::err_expected_parameter_pack);
1666 tok::r_paren);
1668 } else if (Tok.is(tok::identifier)) {
1669 Name = Tok.getIdentifierInfo();
1678 Diag(Tok, diag::err_sizeof_parameter_pack);
1690 if (OpTok.is(tok::kw_alignof) || OpTok.is(tok::kw__Alignof))
1705 if (OpTok.is(tok::kw_alignof) || OpTok.is(tok::kw___alignof) ||
1706 OpTok.is(tok::kw__Alignof))
1708 else if (OpTok.is(tok::kw_vec_step))
1718 if (OpTok.is(tok::kw_alignof) || OpTok.is(tok::kw__Alignof))
1749 const IdentifierInfo *BuiltinII = Tok.getIdentifierInfo();
1751 tok::TokenKind T = Tok.getKind();
1755 if (Tok.isNot(tok::l_paren))
1756 return ExprError(Diag(Tok, diag::err_expected_lparen_after_id)
1759 BalancedDelimiterTracker PT(*this, tok::l_paren);
1766 case tok::kw___builtin_va_arg: {
1769 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
1774 if (Tok.isNot(tok::r_paren)) {
1775 Diag(Tok, diag::err_expected_rparen);
1785 case tok::kw___builtin_offsetof: {
1786 SourceLocation TypeLoc = Tok.getLocation();
1789 SkipUntil(tok::r_paren);
1793 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
1797 if (Tok.isNot(tok::identifier)) {
1798 Diag(Tok, diag::err_expected_ident);
1799 SkipUntil(tok::r_paren);
1808 Comps.back().U.IdentInfo = Tok.getIdentifierInfo();
1813 if (Tok.is(tok::period)) {
1819 if (Tok.isNot(tok::identifier)) {
1820 Diag(Tok, diag::err_expected_ident);
1821 SkipUntil(tok::r_paren);
1824 Comps.back().U.IdentInfo = Tok.getIdentifierInfo();
1827 } else if (Tok.is(tok::l_square)) {
1834 BalancedDelimiterTracker ST(*this, tok::l_square);
1839 SkipUntil(tok::r_paren);
1847 if (Tok.isNot(tok::r_paren)) {
1863 case tok::kw___builtin_choose_expr: {
1866 SkipUntil(tok::r_paren);
1869 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
1874 SkipUntil(tok::r_paren);
1877 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
1882 SkipUntil(tok::r_paren);
1885 if (Tok.isNot(tok::r_paren)) {
1886 Diag(Tok, diag::err_expected_rparen);
1893 case tok::kw___builtin_astype: {
1897 SkipUntil(tok::r_paren);
1901 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",
1902 tok::r_paren))
1911 if (Tok.isNot(tok::r_paren)) {
1912 Diag(Tok, diag::err_expected_rparen);
1913 SkipUntil(tok::r_paren);
1956 assert(Tok.is(tok::l_paren) && "Not a paren expr!");
1957 BalancedDelimiterTracker T(*this, tok::l_paren);
1966 if (Tok.is(tok::code_completion)) {
1976 (Tok.is(tok::kw___bridge) ||
1977 Tok.is(tok::kw___bridge_transfer) ||
1978 Tok.is(tok::kw___bridge_retained) ||
1979 Tok.is(tok::kw___bridge_retain)));
1981 if (Tok.isNot(tok::kw___bridge)) {
1982 StringRef BridgeCastName = Tok.getName();
1996 if (ExprType >= CompoundStmt && Tok.is(tok::l_brace)) {
1997 Diag(Tok, diag::ext_gnu_statement_expr);
2005 Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.take(), Tok.getLocation());
2010 tok::TokenKind tokenKind = Tok.getKind();
2015 if (tokenKind == tok::kw___bridge)
2017 else if (tokenKind == tok::kw___bridge_transfer)
2019 else if (tokenKind == tok::kw___bridge_retained)
2024 assert(tokenKind == tok::kw___bridge_retain);
2068 if (!DeclaratorInfo.isInvalidType() && Tok.is(tok::identifier) &&
2070 (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) {
2083 if (Tok.is(tok::l_brace)) {
2112 if (Tok.is(tok::identifier) && getLangOpts().ObjC1 &&
2113 Tok.getIdentifierInfo() == Ident_super &&
2115 GetLookAheadToken(1).isNot(tok::period)) {
2116 Diag(Tok.getLocation(), diag::err_illegal_super_cast)
2134 Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
2146 Result = Actions.ActOnParenListExpr(OpenLoc, Tok.getLocation(),
2156 if (!Result.isInvalid() && Tok.is(tok::r_paren))
2157 Result = Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), Result.take());
2162 SkipUntil(tok::r_paren);
2183 assert(Tok.is(tok::l_brace) && "Not a compound literal!");
2208 StringToks.push_back(Tok);
2231 assert(Tok.is(tok::kw__Generic) && "_Generic keyword expected");
2237 BalancedDelimiterTracker T(*this, tok::l_paren);
2248 SkipUntil(tok::r_paren);
2253 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "")) {
2254 SkipUntil(tok::r_paren);
2263 if (Tok.is(tok::kw_default)) {
2267 Diag(Tok, diag::err_duplicate_default_assoc);
2269 SkipUntil(tok::r_paren);
2278 SkipUntil(tok::r_paren);
2285 if (ExpectAndConsume(tok::colon, diag::err_expected_colon, "")) {
2286 SkipUntil(tok::r_paren);
2294 SkipUntil(tok::r_paren);
2299 if (Tok.isNot(tok::comma))
2343 if (Tok.is(tok::code_completion)) {
2353 if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
2354 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
2359 if (Tok.is(tok::ellipsis))
2366 if (Tok.isNot(tok::comma))
2380 if (Tok.is(tok::code_completion)) {
2413 assert(Tok.is(tok::caret) && "block literal starts with ^");
2434 ParamInfo.SetSourceRange(SourceRange(Tok.getLocation(), Tok.getLocation()));
2438 if (Tok.is(tok::l_paren)) {
2458 } else if (!Tok.is(tok::l_brace)) {
2495 if (!Tok.is(tok::l_brace)) {
2497 Diag(Tok, diag::err_expected_expression);
2516 tok::TokenKind Kind = Tok.getKind();