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:
696 case tok::identifier: { // primary-expression: identifier
709 if (Next.is(tok::l_paren) &&
710 Tok.is(tok::identifier) &&
711 Tok.getIdentifierInfo()->hasRevertedTokenIDToIdentifier()) {
712 IdentifierInfo *II = Tok.getIdentifierInfo();
718 = RTT_JOIN(tok::kw_,Name)
743 llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind>::iterator Known
746 Tok.setKind(Known->second);
752 if (Next.is(tok::coloncolon) ||
753 (!ColonIsSacred && Next.is(tok::colon)) ||
754 Next.is(tok::less) ||
755 Next.is(tok::l_paren) ||
756 Next.is(tok::l_brace)) {
760 if (!Tok.is(tok::identifier))
767 IdentifierInfo &II = *Tok.getIdentifierInfo();
771 if (getLangOpts().ObjC1 && Tok.is(tok::period) &&
778 if (Tok.isNot(tok::identifier) &&
779 !(getLangOpts().CPlusPlus && Tok.is(tok::kw_class))) {
780 Diag(Tok, diag::err_expected_property_name);
783 IdentifierInfo &PropertyName = *Tok.getIdentifierInfo();
797 ((Tok.is(tok::identifier) &&
798 (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) ||
799 Tok.is(tok::code_completion))) {
811 ((Tok.is(tok::identifier) && !InMessageExpression) ||
812 Tok.is(tok::code_completion))) {
814 if (Tok.is(tok::code_completion) ||
815 Next.is(tok::colon) || Next.is(tok::r_square))
853 Name, Tok.is(tok::l_paren),
857 case tok::char_constant: // constant: character-constant
858 case tok::wide_char_constant:
859 case tok::utf16_char_constant:
860 case tok::utf32_char_constant:
861 Res = Actions.ActOnCharacterConstant(Tok, /*UDLScope*/getCurScope());
864 case tok::kw___func__: // primary-expression: __func__ [C99 6.4.2.2]
865 case tok::kw___FUNCTION__: // primary-expression: __FUNCTION__ [GNU]
866 case tok::kw_L__FUNCTION__: // primary-expression: L__FUNCTION__ [MS]
867 case tok::kw___PRETTY_FUNCTION__: // primary-expression: __P..Y_F..N__ [GNU]
868 Res = Actions.ActOnPredefinedExpr(Tok.getLocation(), SavedKind);
871 case tok::string_literal: // primary-expression: string-literal
872 case tok::wide_string_literal:
873 case tok::utf8_string_literal:
874 case tok::utf16_string_literal:
875 case tok::utf32_string_literal:
878 case tok::kw__Generic: // primary-expression: generic-selection [C11 6.5.1]
881 case tok::kw___builtin_va_arg:
882 case tok::kw___builtin_offsetof:
883 case tok::kw___builtin_choose_expr:
884 case tok::kw___builtin_astype: // primary-expression: [OCL] as_type()
886 case tok::kw___null:
889 case tok::plusplus: // unary-expression: '++' unary-expression [C99]
890 case tok::minusminus: { // unary-expression: '--' unary-expression [C99]
901 case tok::amp: { // unary-expression: '&' cast-expression
910 case tok::star: // unary-expression: '*' cast-expression
911 case tok::plus: // unary-expression: '+' cast-expression
912 case tok::minus: // unary-expression: '-' cast-expression
913 case tok::tilde: // unary-expression: '~' cast-expression
914 case tok::exclaim: // unary-expression: '!' cast-expression
915 case tok::kw___real: // unary-expression: '__real' cast-expression [GNU]
916 case tok::kw___imag: { // unary-expression: '__imag' cast-expression [GNU]
924 case tok::kw___extension__:{//unary-expression:'__extension__' cast-expr [GNU]
933 case tok::kw__Alignof: // unary-expression: '_Alignof' '(' type-name ')'
935 Diag(Tok, diag::ext_c11_alignment) << Tok.getName();
937 case tok::kw_alignof: // unary-expression: 'alignof' '(' type-id ')'
938 case tok::kw___alignof: // unary-expression: '__alignof' unary-expression
940 case tok::kw_sizeof: // unary-expression: 'sizeof' unary-expression
942 case tok::kw_vec_step: // unary-expression: OpenCL 'vec_step' expression
944 case tok::ampamp: { // unary-expression: '&&' identifier
946 if (Tok.isNot(tok::identifier))
947 return ExprError(Diag(Tok, diag::err_expected_ident));
950 return ExprError(Diag(Tok, diag::err_address_of_label_outside_fn));
953 LabelDecl *LD = Actions.LookupOrCreateLabel(Tok.getIdentifierInfo(),
954 Tok.getLocation());
955 Res = Actions.ActOnAddrLabel(AmpAmpLoc, Tok.getLocation(), LD);
959 case tok::kw_const_cast:
960 case tok::kw_dynamic_cast:
961 case tok::kw_reinterpret_cast:
962 case tok::kw_static_cast:
965 case tok::kw_typeid:
968 case tok::kw___uuidof:
971 case tok::kw_this:
975 case tok::annot_typename:
977 ParsedType Type = getTypeAnnotation(Tok);
981 DS.SetRangeStart(Tok.getLocation());
982 DS.SetRangeEnd(Tok.getLastLoc());
986 DS.SetTypeSpecType(TST_typename, Tok.getAnnotationEndLoc(),
1001 case tok::annot_decltype:
1002 case tok::kw_char:
1003 case tok::kw_wchar_t:
1004 case tok::kw_char16_t:
1005 case tok::kw_char32_t:
1006 case tok::kw_bool:
1007 case tok::kw_short:
1008 case tok::kw_int:
1009 case tok::kw_long:
1010 case tok::kw___int64:
1011 case tok::kw___int128:
1012 case tok::kw_signed:
1013 case tok::kw_unsigned:
1014 case tok::kw_half:
1015 case tok::kw_float:
1016 case tok::kw_double:
1017 case tok::kw_void:
1018 case tok::kw_typename:
1019 case tok::kw_typeof:
1020 case tok::kw___vector:
1021 case tok::kw_image1d_t:
1022 case tok::kw_image1d_array_t:
1023 case tok::kw_image1d_buffer_t:
1024 case tok::kw_image2d_t:
1025 case tok::kw_image2d_array_t:
1026 case tok::kw_image3d_t:
1027 case tok::kw_sampler_t:
1028 case tok::kw_event_t: {
1030 Diag(Tok, diag::err_expected_expression);
1034 if (SavedKind == tok::kw_typename) {
1046 if (Tok.isNot(tok::l_paren) &&
1047 (!getLangOpts().CPlusPlus11 || Tok.isNot(tok::l_brace)))
1048 return ExprError(Diag(Tok, diag::err_expected_lparen_after_type)
1051 if (Tok.is(tok::l_brace))
1052 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1058 case tok::annot_cxxscope: { // [C++] id-expression: qualified-id
1063 if (!Tok.is(tok::annot_cxxscope))
1068 if (Next.is(tok::annot_template_id)) {
1088 case tok::annot_template_id: { // [C++] template-id
1089 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
1102 case tok::kw_operator: // [C++] id-expression: operator/conversion-function-id
1106 case tok::coloncolon: {
1111 if (!Tok.is(tok::coloncolon))
1117 if (Tok.is(tok::kw_new))
1119 if (Tok.is(tok::kw_delete))
1127 case tok::kw_new: // [C++] new-expression
1128 return ParseCXXNewExpression(false, Tok.getLocation());
1130 case tok::kw_delete: // [C++] delete-expression
1131 return ParseCXXDeleteExpression(false, Tok.getLocation());
1133 case tok::kw_noexcept: { // [C++0x] 'noexcept' '(' expression ')'
1134 Diag(Tok, diag::warn_cxx98_compat_noexcept_expr);
1136 BalancedDelimiterTracker T(*this, tok::l_paren);
1154 case tok::kw___is_abstract: // [GNU] unary-type-trait
1155 case tok::kw___is_class:
1156 case tok::kw___is_empty:
1157 case tok::kw___is_enum:
1158 case tok::kw___is_interface_class:
1159 case tok::kw___is_literal:
1160 case tok::kw___is_arithmetic:
1161 case tok::kw___is_integral:
1162 case tok::kw___is_floating_point:
1163 case tok::kw___is_complete_type:
1164 case tok::kw___is_void:
1165 case tok::kw___is_array:
1166 case tok::kw___is_function:
1167 case tok::kw___is_reference:
1168 case tok::kw___is_lvalue_reference:
1169 case tok::kw___is_rvalue_reference:
1170 case tok::kw___is_fundamental:
1171 case tok::kw___is_object:
1172 case tok::kw___is_scalar:
1173 case tok::kw___is_compound:
1174 case tok::kw___is_pointer:
1175 case tok::kw___is_member_object_pointer:
1176 case tok::kw___is_member_function_pointer:
1177 case tok::kw___is_member_pointer:
1178 case tok::kw___is_const:
1179 case tok::kw___is_volatile:
1180 case tok::kw___is_standard_layout:
1181 case tok::kw___is_signed:
1182 case tok::kw___is_unsigned:
1183 case tok::kw___is_literal_type:
1184 case tok::kw___is_pod:
1185 case tok::kw___is_polymorphic:
1186 case tok::kw___is_trivial:
1187 case tok::kw___is_trivially_copyable:
1188 case tok::kw___is_union:
1189 case tok::kw___is_final:
1190 case tok::kw___has_trivial_constructor:
1191 case tok::kw___has_trivial_copy:
1192 case tok::kw___has_trivial_assign:
1193 case tok::kw___has_trivial_destructor:
1194 case tok::kw___has_nothrow_assign:
1195 case tok::kw___has_nothrow_copy:
1196 case tok::kw___has_nothrow_constructor:
1197 case tok::kw___has_virtual_destructor:
1200 case tok::kw___builtin_types_compatible_p:
1201 case tok::kw___is_base_of:
1202 case tok::kw___is_same:
1203 case tok::kw___is_convertible:
1204 case tok::kw___is_convertible_to:
1205 case tok::kw___is_trivially_assignable:
1208 case tok::kw___is_trivially_constructible:
1211 case tok::kw___array_rank:
1212 case tok::kw___array_extent:
1215 case tok::kw___is_lvalue_expr:
1216 case tok::kw___is_rvalue_expr:
1219 case tok::at: {
1223 case tok::caret:
1226 case tok::code_completion: {
1231 case tok::l_square:
1287 switch (Tok.getKind()) {
1288 case tok::code_completion:
1296 case tok::identifier:
1301 (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) {
1311 case tok::l_square: { // postfix-expression: p-e '[' expression ']'
1318 if (getLangOpts().ObjC1 && Tok.isAtStartOfLine() &&
1327 BalancedDelimiterTracker T(*this, tok::l_square);
1331 if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
1332 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1337 SourceLocation RLoc = Tok.getLocation();
1339 if (!LHS.isInvalid() && !Idx.isInvalid() && Tok.is(tok::r_square)) {
1350 case tok::l_paren: // p-e: p-e '(' argument-expression-list[opt] ')'
1351 case tok::lesslessless: { // p-e: p-e '<<<' argument-expression-list '>>>'
1353 tok::TokenKind OpKind = Tok.getKind();
1358 BalancedDelimiterTracker PT(*this, tok::l_paren);
1360 if (OpKind == tok::lesslessless) {
1369 SourceLocation CloseLoc = Tok.getLocation();
1370 if (Tok.is(tok::greatergreatergreater)) {
1373 SkipUntil(tok::greatergreatergreater);
1376 Diag(Tok, diag::err_expected_ggg);
1378 SkipUntil(tok::greatergreatergreater);
1383 if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen, ""))
1407 if (Tok.is(tok::code_completion)) {
1414 if (OpKind == tok::l_paren || !LHS.isInvalid()) {
1415 if (Tok.isNot(tok::r_paren)) {
1425 SkipUntil(tok::r_paren);
1426 } else if (Tok.isNot(tok::r_paren)) {
1434 ArgExprs, Tok.getLocation(),
1441 case tok::arrow:
1442 case tok::period: {
1445 tok::TokenKind OpKind = Tok.getKind();
1465 if (Tok.is(tok::code_completion)) {
1468 OpLoc, OpKind == tok::arrow);
1489 if (getLangOpts().ObjC2 && OpKind == tok::period && Tok.is(tok::kw_class)) {
1497 IdentifierInfo *Id = Tok.getIdentifierInfo();
1512 Tok.is(tok::l_paren));
1515 case tok::plusplus: // postfix-expression: postfix-expression '++'
1516 case tok::minusminus: // postfix-expression: postfix-expression '--'
1518 LHS = Actions.ActOnPostfixUnaryOp(getCurScope(), Tok.getLocation(),
1519 Tok.getKind(), LHS.take());
1556 assert((OpTok.is(tok::kw_typeof) || OpTok.is(tok::kw_sizeof) ||
1557 OpTok.is(tok::kw___alignof) || OpTok.is(tok::kw_alignof) ||
1558 OpTok.is(tok::kw__Alignof) || OpTok.is(tok::kw_vec_step)) &&
1564 if (Tok.isNot(tok::l_paren)) {
1566 if (OpTok.is(tok::kw_typeof) && !getLangOpts().CPlusPlus) {
1567 Diag(Tok,diag::err_expected_lparen_after_id) << OpTok.getIdentifierInfo();
1578 SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
1591 if (getLangOpts().CPlusPlus || OpTok.isNot(tok::kw_typeof)) {
1620 assert((Tok.is(tok::kw_sizeof) || Tok.is(tok::kw___alignof) ||
1621 Tok.is(tok::kw_alignof) || Tok.is(tok::kw__Alignof) ||
1622 Tok.is(tok::kw_vec_step)) &&
1624 Token OpTok = Tok;
1628 if (Tok.is(tok::ellipsis) && OpTok.is(tok::kw_sizeof)) {
1633 if (Tok.is(tok::l_paren)) {
1634 BalancedDelimiterTracker T(*this, tok::l_paren);
1637 if (Tok.is(tok::identifier)) {
1638 Name = Tok.getIdentifierInfo();
1645 Diag(Tok, diag::err_expected_parameter_pack);
1646 SkipUntil(tok::r_paren);
1648 } else if (Tok.is(tok::identifier)) {
1649 Name = Tok.getIdentifierInfo();
1658 Diag(Tok, diag::err_sizeof_parameter_pack);
1670 if (OpTok.is(tok::kw_alignof) || OpTok.is(tok::kw__Alignof))
1685 if (OpTok.is(tok::kw_alignof) || OpTok.is(tok::kw___alignof) ||
1686 OpTok.is(tok::kw__Alignof))
1688 else if (OpTok.is(tok::kw_vec_step))
1698 if (OpTok.is(tok::kw_alignof) || OpTok.is(tok::kw__Alignof))
1729 const IdentifierInfo *BuiltinII = Tok.getIdentifierInfo();
1731 tok::TokenKind T = Tok.getKind();
1735 if (Tok.isNot(tok::l_paren))
1736 return ExprError(Diag(Tok, diag::err_expected_lparen_after_id)
1739 BalancedDelimiterTracker PT(*this, tok::l_paren);
1746 case tok::kw___builtin_va_arg: {
1749 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
1754 if (Tok.isNot(tok::r_paren)) {
1755 Diag(Tok, diag::err_expected_rparen);
1765 case tok::kw___builtin_offsetof: {
1766 SourceLocation TypeLoc = Tok.getLocation();
1769 SkipUntil(tok::r_paren);
1773 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
1777 if (Tok.isNot(tok::identifier)) {
1778 Diag(Tok, diag::err_expected_ident);
1779 SkipUntil(tok::r_paren);
1788 Comps.back().U.IdentInfo = Tok.getIdentifierInfo();
1793 if (Tok.is(tok::period)) {
1799 if (Tok.isNot(tok::identifier)) {
1800 Diag(Tok, diag::err_expected_ident);
1801 SkipUntil(tok::r_paren);
1804 Comps.back().U.IdentInfo = Tok.getIdentifierInfo();
1807 } else if (Tok.is(tok::l_square)) {
1814 BalancedDelimiterTracker ST(*this, tok::l_square);
1819 SkipUntil(tok::r_paren);
1827 if (Tok.isNot(tok::r_paren)) {
1843 case tok::kw___builtin_choose_expr: {
1846 SkipUntil(tok::r_paren);
1849 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
1854 SkipUntil(tok::r_paren);
1857 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
1862 SkipUntil(tok::r_paren);
1865 if (Tok.isNot(tok::r_paren)) {
1866 Diag(Tok, diag::err_expected_rparen);
1873 case tok::kw___builtin_astype: {
1877 SkipUntil(tok::r_paren);
1881 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",
1882 tok::r_paren))
1891 if (Tok.isNot(tok::r_paren)) {
1892 Diag(Tok, diag::err_expected_rparen);
1893 SkipUntil(tok::r_paren);
1936 assert(Tok.is(tok::l_paren) && "Not a paren expr!");
1937 BalancedDelimiterTracker T(*this, tok::l_paren);
1946 if (Tok.is(tok::code_completion)) {
1956 (Tok.is(tok::kw___bridge) ||
1957 Tok.is(tok::kw___bridge_transfer) ||
1958 Tok.is(tok::kw___bridge_retained) ||
1959 Tok.is(tok::kw___bridge_retain)));
1961 StringRef BridgeCastName = Tok.getName();
1972 if (ExprType >= CompoundStmt && Tok.is(tok::l_brace)) {
1973 Diag(Tok, diag::ext_gnu_statement_expr);
1981 Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.take(), Tok.getLocation());
1986 tok::TokenKind tokenKind = Tok.getKind();
1991 if (tokenKind == tok::kw___bridge)
1993 else if (tokenKind == tok::kw___bridge_transfer)
1995 else if (tokenKind == tok::kw___bridge_retained)
2000 assert(tokenKind == tok::kw___bridge_retain);
2044 if (!DeclaratorInfo.isInvalidType() && Tok.is(tok::identifier) &&
2046 (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) {
2059 if (Tok.is(tok::l_brace)) {
2088 if (Tok.is(tok::identifier) && getLangOpts().ObjC1 &&
2089 Tok.getIdentifierInfo() == Ident_super &&
2091 GetLookAheadToken(1).isNot(tok::period)) {
2092 Diag(Tok.getLocation(), diag::err_illegal_super_cast)
2110 Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
2122 Result = Actions.ActOnParenListExpr(OpenLoc, Tok.getLocation(),
2132 if (!Result.isInvalid() && Tok.is(tok::r_paren))
2133 Result = Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), Result.take());
2138 SkipUntil(tok::r_paren);
2159 assert(Tok.is(tok::l_brace) && "Not a compound literal!");
2184 StringToks.push_back(Tok);
2207 assert(Tok.is(tok::kw__Generic) && "_Generic keyword expected");
2213 BalancedDelimiterTracker T(*this, tok::l_paren);
2224 SkipUntil(tok::r_paren);
2229 if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "")) {
2230 SkipUntil(tok::r_paren);
2239 if (Tok.is(tok::kw_default)) {
2243 Diag(Tok, diag::err_duplicate_default_assoc);
2245 SkipUntil(tok::r_paren);
2254 SkipUntil(tok::r_paren);
2261 if (ExpectAndConsume(tok::colon, diag::err_expected_colon, "")) {
2262 SkipUntil(tok::r_paren);
2270 SkipUntil(tok::r_paren);
2275 if (Tok.isNot(tok::comma))
2319 if (Tok.is(tok::code_completion)) {
2329 if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
2330 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
2335 if (Tok.is(tok::ellipsis))
2342 if (Tok.isNot(tok::comma))
2356 if (Tok.is(tok::code_completion)) {
2389 assert(Tok.is(tok::caret) && "block literal starts with ^");
2410 ParamInfo.SetSourceRange(SourceRange(Tok.getLocation(), Tok.getLocation()));
2414 if (Tok.is(tok::l_paren)) {
2434 } else if (!Tok.is(tok::l_brace)) {
2471 if (!Tok.is(tok::l_brace)) {
2473 Diag(Tok, diag::err_expected_expression);
2492 tok::TokenKind Kind = Tok.getKind();