Home | History | Annotate | Download | only in Parse

Lines Matching refs:Tok

24 static int SelectDigraphErrorMessage(tok::TokenKind Kind) {
26 case tok::kw_template: return 0;
27 case tok::kw_const_cast: return 1;
28 case tok::kw_dynamic_cast: return 2;
29 case tok::kw_reinterpret_cast: return 3;
30 case tok::kw_static_cast: return 4;
46 Token &ColonToken, tok::TokenKind Kind, bool AtDigraph) {
60 ColonToken.setKind(tok::coloncolon);
63 DigraphToken.setKind(tok::less);
77 if (!Next.is(tok::l_square) || Next.getLength() != 2)
81 if (!SecondToken.is(tok::colon) || !AreTokensAdjacent(PP, Next, SecondToken))
86 TemplateName.setIdentifier(&II, Tok.getLocation());
93 FixDigraph(*this, PP, Next, SecondToken, tok::kw_template,
142 if (Tok.is(tok::annot_cxxscope)) {
143 Actions.RestoreNestedNameSpecifierAnnotation(Tok.getAnnotationValue(),
144 Tok.getAnnotationRange(),
152 if (Tok.is(tok::coloncolon)) {
154 tok::TokenKind NextKind = NextToken().getKind();
155 if (NextKind == tok::kw_new || NextKind == tok::kw_delete)
185 if (Tok.is(tok::code_completion)) {
193 SS.setEndLoc(Tok.getLocation());
204 if (Tok.is(tok::kw_template)) {
215 if (Tok.is(tok::identifier)) {
217 TemplateName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
219 } else if (Tok.is(tok::kw_operator)) {
242 if (Tok.isNot(tok::less)) {
266 if (Tok.is(tok::annot_template_id) && NextToken().is(tok::coloncolon)) {
274 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
275 if (CheckForDestructor && GetLookAheadToken(2).is(tok::tilde)) {
283 assert(Tok.is(tok::coloncolon) && "NextToken() not working properly!");
314 // tok::identifier.
315 if (Tok.isNot(tok::identifier))
318 IdentifierInfo &II = *Tok.getIdentifierInfo();
328 if (Next.is(tok::colon) && !ColonIsSacred) {
330 Tok.getLocation(),
336 PP.LookAhead(1).is(tok::identifier)) {
341 Next.setKind(tok::coloncolon);
345 if (Next.is(tok::coloncolon)) {
346 if (CheckForDestructor && GetLookAheadToken(2).is(tok::tilde) &&
347 !Actions.isNonTypeNestedNameSpecifier(getCurScope(), SS, Tok.getLocation(),
356 assert((Tok.is(tok::coloncolon) || Tok.is(tok::colon)) &&
372 if (Next.is(tok::less)) {
375 TemplateName.setIdentifier(&II, Tok.getLocation());
407 Diag(Tok.getLocation(), DiagID)
409 << FixItHint::CreateInsertion(Tok
413 Tok.getLocation(), SS,
437 if (CheckForDestructor && Tok.is(tok::tilde))
507 return Actions.ActOnIdExpression(getCurScope(), SS, Name, Tok.is(tok::l_paren),
549 Diag(Tok, DiagID.getValue());
550 SkipUntil(tok::r_square);
563 && Tok.is(tok::l_square)
569 if (Next.is(tok::r_square) || // []
570 Next.is(tok::equal) || // [=
571 (Next.is(tok::amp) && // [&] or [&,
572 (After.is(tok::r_square) ||
573 After.is(tok::comma))) ||
574 (Next.is(tok::identifier) && // [identifier]
575 After.is(tok::r_square))) {
580 if (Next.is(tok::identifier) && After.is(tok::identifier)) {
596 assert(Tok.is(tok::l_square) && "Lambda expressions begin with '['.");
597 BalancedDelimiterTracker T(*this, tok::l_square);
605 if (Tok.is(tok::amp) &&
606 (NextToken().is(tok::comma) || NextToken().is(tok::r_square))) {
610 } else if (Tok.is(tok::equal)) {
616 while (Tok.isNot(tok::r_square)) {
618 if (Tok.isNot(tok::comma))
630 if (Tok.is(tok::kw_this)) {
634 if (Tok.is(tok::amp)) {
639 if (Tok.is(tok::identifier)) {
640 Id = Tok.getIdentifierInfo();
642 } else if (Tok.is(tok::kw_this)) {
688 if (Tok.is(tok::l_paren)) {
694 BalancedDelimiterTracker T(*this, tok::l_paren);
703 if (Tok.isNot(tok::r_paren))
711 if (Tok.is(tok::kw_mutable)) {
735 if (Tok.is(tok::arrow)) {
766 if (Tok.is(tok::l_brace)) {
777 Diag(Tok, diag::err_expected_lambda_body);
793 tok::TokenKind Kind = Tok.getKind();
798 case tok::kw_const_cast: CastName = "const_cast"; break;
799 case tok::kw_dynamic_cast: CastName = "dynamic_cast"; break;
800 case tok::kw_reinterpret_cast: CastName = "reinterpret_cast"; break;
801 case tok::kw_static_cast: CastName = "static_cast"; break;
805 SourceLocation LAngleBracketLoc = Tok.getLocation();
810 if (Tok.is(tok::l_square) && Tok.getLength() == 2 && Next.is(tok::colon) &&
811 AreTokensAdjacent(PP, Tok, Next))
812 FixDigraph(*this, PP, Tok, Next, Kind, /*AtDigraph*/true);
814 if (ExpectAndConsume(tok::less, diag::err_expected_less_after, CastName))
825 SourceLocation RAngleBracketLoc = Tok.getLocation();
827 if (ExpectAndConsume(tok::greater, diag::err_expected_greater))
831 BalancedDelimiterTracker T(*this, tok::l_paren);
858 assert(Tok.is(tok::kw_typeid) && "Not 'typeid'!");
862 BalancedDelimiterTracker T(*this, tok::l_paren);
897 SkipUntil(tok::r_paren);
918 assert(Tok.is(tok::kw___uuidof) && "Not '__uuidof'!");
921 BalancedDelimiterTracker T(*this, tok::l_paren);
947 SkipUntil(tok::r_paren);
976 tok::TokenKind OpKind,
989 if (Tok.is(tok::identifier)) {
990 FirstTypeName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
992 assert(Tok.is(tok::coloncolon) &&"ParseOptionalCXXScopeSpecifier fail");
994 } else if (Tok.is(tok::annot_template_id)) {
996 (TemplateIdAnnotation *)Tok.getAnnotationValue());
998 assert(Tok.is(tok::coloncolon) &&"ParseOptionalCXXScopeSpecifier fail");
1005 assert(Tok.is(tok::tilde) && "ParseOptionalCXXScopeSpecifier fail");
1007 if (!Tok.is(tok::identifier)) {
1008 Diag(Tok, diag::err_destructor_tilde_identifier);
1014 IdentifierInfo *Name = Tok.getIdentifierInfo();
1020 if (Tok.is(tok::less) &&
1030 Tok.is(tok::l_paren));
1039 tok::TokenKind Kind = Tok.getKind();
1048 assert(Tok.is(tok::kw_throw) && "Not throw!");
1054 switch (Tok.getKind()) { // FIXME: move this predicate somewhere common.
1055 case tok::semi:
1056 case tok::r_paren:
1057 case tok::r_square:
1058 case tok::r_brace:
1059 case tok::colon:
1060 case tok::comma:
1076 assert(Tok.is(tok::kw_this) && "Not 'this'!");
1098 assert((Tok.is(tok::l_paren) ||
1099 (getLang().CPlusPlus0x && Tok.is(tok::l_brace)))
1102 if (Tok.is(tok::l_brace)) {
1110 BalancedDelimiterTracker T(*this, tok::l_paren);
1116 if (Tok.isNot(tok::r_paren)) {
1118 SkipUntil(tok::r_paren);
1163 if (Tok.is(tok::code_completion)) {
1192 if (Tok.is(tok::kw_asm)) {
1196 SkipUntil(tok::semi);
1222 Diag(Tok, diag::err_expected_equal_after_declarator);
1236 switch (Tok.getKind()) {
1237 case tok::annot_typename:
1238 case tok::kw_short:
1239 case tok::kw_long:
1240 case tok::kw___int64:
1241 case tok::kw_signed:
1242 case tok::kw_unsigned:
1243 case tok::kw_void:
1244 case tok::kw_char:
1245 case tok::kw_int:
1246 case tok::kw_half:
1247 case tok::kw_float:
1248 case tok::kw_double:
1249 case tok::kw_wchar_t:
1250 case tok::kw_char16_t:
1251 case tok::kw_char32_t:
1252 case tok::kw_bool:
1253 case tok::kw_decltype:
1254 case tok::kw_typeof:
1255 case tok::kw___underlying_type:
1292 DS.SetRangeStart(Tok.getLocation());
1295 SourceLocation Loc = Tok.getLocation();
1297 switch (Tok.getKind()) {
1298 case tok::identifier: // foo::bar
1299 case tok::coloncolon: // ::foo::bar
1305 case tok::annot_typename: {
1306 if (getTypeAnnotation(Tok))
1308 getTypeAnnotation(Tok));
1312 DS.SetRangeEnd(Tok.getAnnotationEndLoc());
1319 if (Tok.is(tok::less) && getLang().ObjC1)
1327 case tok::kw_short:
1330 case tok::kw_long:
1333 case tok::kw___int64:
1336 case tok::kw_signed:
1339 case tok::kw_unsigned:
1342 case tok::kw_void:
1345 case tok::kw_char:
1348 case tok::kw_int:
1351 case tok::kw_half:
1354 case tok::kw_float:
1357 case tok::kw_double:
1360 case tok::kw_wchar_t:
1363 case tok::kw_char16_t:
1366 case tok::kw_char32_t:
1369 case tok::kw_bool:
1375 case tok::kw_typeof:
1380 if (Tok.is(tok::annot_typename))
1381 DS.SetRangeEnd(Tok.getAnnotationEndLoc());
1383 DS.SetRangeEnd(Tok.getLocation());
1400 DS.SetRangeStart(Tok.getLocation());
1408 Diag(Tok, diag::err_expected_type);
1460 assert((AssumeTemplateId || Tok.is(tok::less)) &&
1556 if (Tok.is(tok::less) &&
1658 assert(Tok.is(tok::kw_operator) && "Expected 'operator' keyword");
1667 switch (Tok.getKind()) {
1668 case tok::kw_new:
1669 case tok::kw_delete: {
1670 bool isNew = Tok.getKind() == tok::kw_new;
1673 if (Tok.is(tok::l_square)) {
1675 BalancedDelimiterTracker T(*this, tok::l_square);
1691 case tok::Token: \
1698 case tok::l_paren: {
1700 BalancedDelimiterTracker T(*this, tok::l_paren);
1712 case tok::l_square: {
1714 BalancedDelimiterTracker T(*this, tok::l_square);
1726 case tok::code_completion: {
1749 if (getLang().CPlusPlus0x && Tok.is(tok::string_literal)) {
1750 Diag(Tok.getLocation(), diag::warn_cxx98_compat_literal_operator);
1751 if (Tok.getLength() != 2)
1752 Diag(Tok.getLocation(), diag::err_operator_string_not_empty);
1755 if (Tok.isNot(tok::identifier)) {
1756 Diag(Tok.getLocation(), diag::err_expected_ident);
1760 IdentifierInfo *II = Tok.getIdentifierInfo();
1837 if (getLang().CPlusPlus && Tok.is(tok::kw_template) &&
1846 if (Tok.is(tok::identifier)) {
1848 IdentifierInfo *Id = Tok.getIdentifierInfo();
1872 if (TemplateSpecified || Tok.is(tok::less))
1882 if (Tok.is(tok::annot_template_id)) {
1883 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
1925 if (Tok.is(tok::kw_operator)) {
1936 (TemplateSpecified || Tok.is(tok::less)))
1946 (AllowDestructorName || SS.isSet()) && Tok.is(tok::tilde)) {
1956 if (Tok.isNot(tok::identifier)) {
1957 Diag(Tok, diag::err_destructor_tilde_identifier);
1962 IdentifierInfo *ClassName = Tok.getIdentifierInfo();
1965 if (TemplateSpecified || Tok.is(tok::less)) {
1984 Diag(Tok, diag::err_expected_unqualified_id)
2019 assert(Tok.is(tok::kw_new) && "expected 'new' token");
2031 if (Tok.is(tok::l_paren)) {
2033 BalancedDelimiterTracker T(*this, tok::l_paren);
2037 SkipUntil(tok::semi, /*StopAtSemi=*/true, /*DontConsume=*/true);
2044 SkipUntil(tok::semi, /*StopAtSemi=*/true, /*DontConsume=*/true);
2054 if (Tok.is(tok::l_paren)) {
2055 BalancedDelimiterTracker T(*this, tok::l_paren);
2087 SkipUntil(tok::semi, /*StopAtSemi=*/true, /*DontConsume=*/true);
2094 if (Tok.is(tok::l_paren)) {
2095 BalancedDelimiterTracker T(*this, tok::l_paren);
2098 if (Tok.isNot(tok::r_paren)) {
2101 SkipUntil(tok::semi, /*StopAtSemi=*/true, /*DontConsume=*/true);
2108 SkipUntil(tok::semi, /*StopAtSemi=*/true, /*DontConsume=*/true);
2111 } else if (Tok.is(tok::l_brace) && getLang().CPlusPlus0x) {
2112 Diag(Tok.getLocation(),
2134 while (Tok.is(tok::l_square)) {
2135 BalancedDelimiterTracker T(*this, tok::l_square);
2142 SkipUntil(tok::r_square);
2202 assert(Tok.is(tok::kw_delete) && "Expected 'delete' keyword");
2207 if (Tok.is(tok::l_square)) {
2209 BalancedDelimiterTracker T(*this, tok::l_square);
2224 static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) {
2227 case tok::kw___has_nothrow_assign: return UTT_HasNothrowAssign;
2228 case tok::kw___has_nothrow_constructor: return UTT_HasNothrowConstructor;
2229 case tok::kw___has_nothrow_copy: return UTT_HasNothrowCopy;
2230 case tok::kw___has_trivial_assign: return UTT_HasTrivialAssign;
2231 case tok::kw___has_trivial_constructor:
2233 case tok::kw___has_trivial_copy: return UTT_HasTrivialCopy;
2234 case tok::kw___has_trivial_destructor: return UTT_HasTrivialDestructor;
2235 case tok::kw___has_virtual_destructor: return UTT_HasVirtualDestructor;
2236 case tok::kw___is_abstract: return UTT_IsAbstract;
2237 case tok::kw___is_arithmetic: return UTT_IsArithmetic;
2238 case tok::kw___is_array: return UTT_IsArray;
2239 case tok::kw___is_class: return UTT_IsClass;
2240 case tok::kw___is_complete_type: return UTT_IsCompleteType;
2241 case tok::kw___is_compound: return UTT_IsCompound;
2242 case tok::kw___is_const: return UTT_IsConst;
2243 case tok::kw___is_empty: return UTT_IsEmpty;
2244 case tok::kw___is_enum: return UTT_IsEnum;
2245 case tok::kw___is_floating_point: return UTT_IsFloatingPoint;
2246 case tok::kw___is_function: return UTT_IsFunction;
2247 case tok::kw___is_fundamental: return UTT_IsFundamental;
2248 case tok::kw___is_integral: return UTT_IsIntegral;
2249 case tok::kw___is_lvalue_reference: return UTT_IsLvalueReference;
2250 case tok::kw___is_member_function_pointer: return UTT_IsMemberFunctionPointer;
2251 case tok::kw___is_member_object_pointer: return UTT_IsMemberObjectPointer;
2252 case tok::kw___is_member_pointer: return UTT_IsMemberPointer;
2253 case tok::kw___is_object: return UTT_IsObject;
2254 case tok::kw___is_literal: return UTT_IsLiteral;
2255 case tok::kw___is_literal_type: return UTT_IsLiteral;
2256 case tok::kw___is_pod: return UTT_IsPOD;
2257 case tok::kw___is_pointer: return UTT_IsPointer;
2258 case tok::kw___is_polymorphic: return UTT_IsPolymorphic;
2259 case tok::kw___is_reference: return UTT_IsReference;
2260 case tok
2261 case tok::kw___is_scalar: return UTT_IsScalar;
2262 case tok::kw___is_signed: return UTT_IsSigned;
2263 case tok::kw___is_standard_layout: return UTT_IsStandardLayout;
2264 case tok::kw___is_trivial: return UTT_IsTrivial;
2265 case tok::kw___is_trivially_copyable: return UTT_IsTriviallyCopyable;
2266 case tok::kw___is_union: return UTT_IsUnion;
2267 case tok::kw___is_unsigned: return UTT_IsUnsigned;
2268 case tok::kw___is_void: return UTT_IsVoid;
2269 case tok::kw___is_volatile: return UTT_IsVolatile;
2273 static BinaryTypeTrait BinaryTypeTraitFromTokKind(tok::TokenKind kind) {
2276 case tok::kw___is_base_of: return BTT_IsBaseOf;
2277 case tok::kw___is_convertible: return BTT_IsConvertible;
2278 case tok::kw___is_same: return BTT_IsSame;
2279 case tok::kw___builtin_types_compatible_p: return BTT_TypeCompatible;
2280 case tok::kw___is_convertible_to: return BTT_IsConvertibleTo;
2284 static ArrayTypeTrait ArrayTypeTraitFromTokKind(tok::TokenKind kind) {
2287 case tok::kw___array_rank: return ATT_ArrayRank;
2288 case tok::kw___array_extent: return ATT_ArrayExtent;
2292 static ExpressionTrait ExpressionTraitFromTokKind(tok::TokenKind kind) {
2295 case tok::kw___is_lvalue_expr: return ET_IsLValueExpr;
2296 case tok::kw___is_rvalue_expr: return ET_IsRValueExpr;
2308 UnaryTypeTrait UTT = UnaryTypeTraitFromTokKind(Tok.getKind());
2311 BalancedDelimiterTracker T(*this, tok::l_paren);
2336 BinaryTypeTrait BTT = BinaryTypeTraitFromTokKind(Tok.getKind());
2339 BalancedDelimiterTracker T(*this, tok::l_paren);
2345 SkipUntil(tok::r_paren);
2349 if (ExpectAndConsume(tok::comma, diag::err_expected_comma)) {
2350 SkipUntil(tok::r_paren);
2356 SkipUntil(tok::r_paren);
2374 ArrayTypeTrait ATT = ArrayTypeTraitFromTokKind(Tok.getKind());
2377 BalancedDelimiterTracker T(*this, tok::l_paren);
2383 SkipUntil(tok::comma);
2384 SkipUntil(tok::r_paren);
2395 if (ExpectAndConsume(tok::comma, diag::err_expected_comma)) {
2396 SkipUntil(tok::r_paren);
2419 ExpressionTrait ET = ExpressionTraitFromTokKind(Tok.getKind());
2422 BalancedDelimiterTracker T(*this, tok::l_paren);
2473 if (!ConsumeAndStoreUntil(tok::r_paren, Toks)) {
2479 if (Tok.is(tok::l_brace)) {
2484 if (Tok.is(tok::l_paren) && NextToken().is(tok::r_paren)) {
2503 Toks.push_back(Tok);
2549 if (!Result.isInvalid() && Tok.is(tok::r_paren))
2551 Tok.getLocation(), Result.take());
2555 SkipUntil(tok::r_paren);