Home | History | Annotate | Download | only in Parse

Lines Matching refs:Tok

61   assert(Tok.is(tok::kw_namespace) && "Not a namespace!");
65 if (Tok.is(tok::code_completion)) {
81 Diag(Tok.getLocation(), diag::warn_cxx14_compat_attribute)
83 attrLoc = Tok.getLocation();
87 if (Tok.is(tok::identifier)) {
88 Ident = Tok.getIdentifierInfo();
90 while (Tok.is(tok::coloncolon) && NextToken().is(tok::identifier)) {
92 ExtraIdent.push_back(Tok.getIdentifierInfo());
102 if (Tok.is(tok::kw___attribute)) {
103 attrLoc = Tok.getLocation();
107 if (Tok.is(tok::equal)) {
109 Diag(Tok, diag::err_expected) << tok::identifier;
111 SkipUntil(tok::semi);
123 BalancedDelimiterTracker T(*this, tok::l_brace);
126 Diag(Tok, diag::err_expected) << tok::l_brace;
128 Diag(Tok, diag::err_expected_either) << tok::identifier << tok::l_brace;
136 SkipUntil(tok::r_brace);
149 SkipUntil(tok::r_brace, StopBeforeMatch);
150 Token rBraceToken = Tok;
153 if (!rBraceToken.is(tok::r_brace)) {
216 while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
217 Tok.isNot(tok::eof)) {
258 assert(Tok.is(tok::equal) && "Not equal token");
262 if (Tok.is(tok::code_completion)) {
272 if (SS.isInvalid() || Tok.isNot(tok::identifier)) {
273 Diag(Tok, diag::err_expected_namespace_name);
275 SkipUntil(tok::semi);
280 IdentifierInfo *Ident = Tok.getIdentifierInfo();
284 DeclEnd = Tok.getLocation();
285 if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after_namespace_name))
286 SkipUntil(tok::semi);
309 Tok.is(tok::l_brace) ? Tok.getLocation() : SourceLocation());
315 if (Tok.isNot(tok::l_brace)) {
332 BalancedDelimiterTracker T(*this, tok::l_brace);
337 switch (Tok.getKind()) {
338 case tok::annot_module_begin:
343 case tok::annot_module_end:
350 case tok::annot_module_include:
354 case tok::eof:
357 case tok::r_brace:
385 assert(Tok.is(tok::kw_using) && "Not using token");
391 if (Tok.is(tok::code_completion)) {
398 if (Tok.is(tok::kw_namespace)) {
432 assert(Tok.is(tok::kw_namespace) && "Not 'namespace' token");
437 if (Tok.is(tok::code_completion)) {
451 if (SS.isInvalid() || Tok.isNot(tok::identifier)) {
452 Diag(Tok, diag::err_expected_namespace_name);
454 SkipUntil(tok::semi);
460 NamespcName = Tok.getIdentifierInfo();
465 if (Tok.is(tok::kw___attribute)) {
471 DeclEnd = Tok.getLocation();
472 if (ExpectAndConsume(tok::semi,
475 SkipUntil(tok::semi);
509 if (TryConsumeToken(tok::kw_typename, TypenameLoc))
512 if (Tok.is(tok::kw___super)) {
513 Diag(Tok.getLocation(), diag::err_super_in_using_declaration);
514 SkipUntil(tok::semi);
527 SkipUntil(tok::semi);
545 Tok.is(tok::identifier) && NextToken().is(tok::semi) &&
546 SS.isNotEmpty() && LastII == Tok.getIdentifierInfo() &&
555 /*AllowConstructorName=*/!(Tok.is(tok::identifier) &&
556 NextToken().is(tok::equal)),
558 SkipUntil(tok::semi);
568 bool IsAliasDecl = Tok.is(tok::equal);
576 Tok.getLocation(),
584 Diag(Tok.getLocation(), getLangOpts().CPlusPlus11 ?
606 SkipUntil(tok::semi);
614 SkipUntil(tok::semi);
641 DeclEnd = Tok.getLocation();
642 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
646 SkipUntil(tok::semi);
696 assert(Tok.isOneOf(tok::kw_static_assert, tok::kw__Static_assert) &&
699 if (Tok.is(tok::kw__Static_assert) && !getLangOpts().C11)
700 Diag(Tok, diag::ext_c11_static_assert);
701 if (Tok.is(tok::kw_static_assert))
702 Diag(Tok, diag::warn_cxx98_compat_static_assert);
706 BalancedDelimiterTracker T(*this, tok::l_paren);
708 Diag(Tok, diag::err_expected) << tok::l_paren;
720 if (Tok.is(tok::r_paren)) {
721 Diag(Tok, getLangOpts().CPlusPlus1z
726 : FixItHint::CreateInsertion(Tok.getLocation(), ", \"\""));
728 if (ExpectAndConsume(tok::comma)) {
729 SkipUntil(tok::semi);
734 Diag(Tok, diag::err_expected_string_literal)
749 DeclEnd = Tok.getLocation();
764 assert(Tok.isOneOf(tok::kw_decltype, tok::annot_decltype)
768 SourceLocation StartLoc = Tok.getLocation();
771 if (Tok.is(tok::annot_decltype)) {
772 Result = getExprAnnotation(Tok);
773 EndLoc = Tok.getAnnotationEndLoc();
780 if (Tok.getIdentifierInfo()->isStr("decltype"))
781 Diag(Tok, diag::warn_cxx98_compat_decltype);
785 BalancedDelimiterTracker T(*this, tok::l_paren);
787 "decltype", tok::r_paren)) {
789 return T.getOpenLocation() == Tok.getLocation() ?
794 if (Tok.is(tok::kw_auto)) {
798 Diag(Tok.getLocation(),
816 if (SkipUntil(tok::r_paren, StopAtSemi | StopBeforeMatch)) {
819 if (PP.isBacktrackEnabled() && Tok.is(tok::semi)) {
824 assert(Tok.is(tok::semi));
826 EndLoc = Tok.getLocation();
875 PP.EnterToken(Tok);
877 Tok.setKind(tok::annot_decltype);
878 setExprAnnotation(Tok,
882 Tok.setAnnotationEndLoc(EndLoc);
883 Tok.setLocation(StartLoc);
884 PP.AnnotateCachedTokens(Tok);
888 assert(Tok.is(tok::kw___underlying_type) &&
892 BalancedDelimiterTracker T(*this, tok::l_paren);
894 "__underlying_type", tok::r_paren)) {
900 SkipUntil(tok::r_paren, StopAtSemi);
939 if (Tok.is(tok::kw_typename)) {
940 Diag(Tok, diag::err_expected_class_name_not_template)
941 << FixItHint::CreateRemoval(Tok.getLocation());
949 BaseLoc = Tok.getLocation();
952 // tok == kw_decltype is just error recovery, it can only happen when SS
954 if (Tok.isOneOf(tok::kw_decltype, tok::annot_decltype)) {
968 if (Tok.is(tok::annot_template_id)) {
969 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
974 assert(Tok.is(tok::annot_typename) && "template-id -> type failed");
975 ParsedType Type = getTypeAnnotation(Tok);
976 EndLocation = Tok.getAnnotationEndLoc();
987 if (Tok.isNot(tok::identifier)) {
988 Diag(Tok, diag::err_expected_class_name);
992 IdentifierInfo *Id = Tok.getIdentifierInfo();
995 if (Tok.is(tok::less)) {
1027 if (Tok.isNot(tok::annot_typename))
1032 EndLocation = Tok.getAnnotationEndLoc();
1033 ParsedType Type = getTypeAnnotation(Tok);
1069 while (Tok.isOneOf(tok::kw___single_inheritance,
1070 tok::kw___multiple_inheritance,
1071 tok::kw___virtual_inheritance)) {
1072 IdentifierInfo *AttrName = Tok.getIdentifierInfo();
1084 switch (Tok.getKind()) {
1086 case tok::semi: // struct foo {...} ;
1087 case tok::star: // struct foo {...} * P;
1088 case tok::amp: // struct foo {...} & R = ...
1089 case tok::ampamp: // struct foo {...} && R = ...
1090 case tok::identifier: // struct foo {...} V ;
1091 case tok::r_paren: //(struct foo {...} ) {4}
1092 case tok::annot_cxxscope: // struct foo {...} a:: b;
1093 case tok::annot_typename: // struct foo {...} a ::b;
1094 case tok::annot_template_id: // struct foo {...} a<int> ::b;
1095 case tok::l_paren: // struct foo {...} ( x);
1096 case tok::comma: // __builtin_offsetof(struct foo{...} ,
1097 case tok::kw_operator: // struct foo operator ++() {...}
1098 case tok::kw___declspec: // struct foo {...} __declspec(...)
1099 case tok::l_square: // void f(struct f [ 3])
1100 case tok::ellipsis: // void f(struct f ... [Ns])
1103 case tok::kw___attribute: // struct foo __attribute__((used)) x;
1105 case tok::colon:
1108 case tok::kw_const: // struct foo {...} const x;
1109 case tok::kw_volatile: // struct foo {...} volatile x;
1110 case tok::kw_restrict: // struct foo {...} restrict x;
1111 case tok::kw__Atomic: // struct foo {...} _Atomic x;
1112 case tok::kw___unaligned: // struct foo {...} __unaligned *x;
1116 case tok::kw_inline: // struct foo inline f();
1117 case tok::kw_virtual: // struct foo virtual f();
1118 case tok::kw_friend: // struct foo friend f();
1120 case tok::kw_static: // struct foo {...} static x;
1121 case tok::kw_extern: // struct foo {...} extern x;
1122 case tok::kw_typedef: // struct foo {...} typedef x;
1123 case tok::kw_register: // struct foo {...} register x;
1124 case tok::kw_auto: // struct foo {...} auto x;
1125 case tok::kw_mutable: // struct foo {...} mutable x;
1126 case tok::kw_thread_local: // struct foo {...} thread_local x;
1127 case tok::kw_constexpr: // struct foo {...} constexpr x;
1146 case tok::r_brace: // struct bar { struct foo {...} }
1151 case tok::greater:
1198 void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
1205 if (TagTokKind == tok::kw_struct)
1207 else if (TagTokKind == tok::kw___interface)
1209 else if (TagTokKind == tok::kw_class)
1212 assert(TagTokKind == tok::kw_union && "Not a class specifier");
1216 if (Tok.is(tok::code_completion)) {
1243 if (Tok.isOneOf(tok::kw___single_inheritance,
1244 tok::kw___multiple_inheritance,
1245 tok::kw___virtual_inheritance))
1255 SourceLocation AttrFixitLoc = Tok.getLocation();
1258 Tok.isNot(tok::identifier) &&
1259 !Tok.isAnnotation() &&
1260 Tok.getIdentifierInfo() &&
1261 Tok.isOneOf(tok::kw___is_abstract,
1262 tok::kw___is_arithmetic,
1263 tok::kw___is_array,
1264 tok::kw___is_base_of,
1265 tok::kw___is_class,
1266 tok::kw___is_complete_type,
1267 tok::kw___is_compound,
1268 tok::kw___is_const,
1269 tok::kw___is_constructible,
1270 tok::kw___is_convertible,
1271 tok::kw___is_convertible_to,
1272 tok::kw___is_destructible,
1273 tok::kw___is_empty,
1274 tok::kw___is_enum,
1275 tok::kw___is_floating_point,
1276 tok::kw___is_final,
1277 tok::kw___is_function,
1278 tok::kw___is_fundamental,
1279 tok::kw___is_integral,
1280 tok::kw___is_interface_class,
1281 tok::kw___is_literal,
1282 tok::kw___is_lvalue_expr,
1283 tok::kw___is_lvalue_reference,
1284 tok::kw___is_member_function_pointer,
1285 tok::kw___is_member_object_pointer,
1286 tok::kw___is_member_pointer,
1287 tok::kw___is_nothrow_assignable,
1288 tok::kw___is_nothrow_constructible,
1289 tok::kw___is_nothrow_destructible,
1290 tok::kw___is_object,
1291 tok::kw___is_pod,
1292 tok::kw___is_pointer,
1293 tok::kw___is_polymorphic,
1294 tok::kw___is_reference,
1295 tok::kw___is_rvalue_expr,
1296 tok
1297 tok::kw___is_same,
1298 tok::kw___is_scalar,
1299 tok::kw___is_sealed,
1300 tok::kw___is_signed,
1301 tok::kw___is_standard_layout,
1302 tok::kw___is_trivial,
1303 tok::kw___is_trivially_assignable,
1304 tok::kw___is_trivially_constructible,
1305 tok::kw___is_trivially_copyable,
1306 tok::kw___is_union,
1307 tok::kw___is_unsigned,
1308 tok::kw___is_void,
1309 tok::kw___is_volatile))
1318 PreserveAtomicIdentifierInfoRAII(Token &Tok, bool Enabled)
1322 assert(Tok.is(tok::kw__Atomic));
1323 AtomicII = Tok.getIdentifierInfo();
1325 Tok.setKind(tok::identifier);
1330 AtomicII->revertIdentifierToTokenID(tok::kw__Atomic);
1341 Tok.is(tok::kw__Atomic) &&
1344 Tok, ShouldChangeAtomicToIdentifier);
1360 if (Tok.isNot(tok::identifier) && Tok.isNot(tok::annot_template_id)) {
1361 Diag(Tok, diag::err_expected) << tok::identifier;
1374 if (Tok.is(tok::identifier)) {
1375 Name = Tok.getIdentifierInfo();
1378 if (Tok.is(tok::less) && getLangOpts().CPlusPlus) {
1418 } else if (Tok.is(tok::annot_template_id)) {
1419 TemplateId = takeTemplateIdAnnotation(Tok);
1436 SkipUntil(tok::semi, StopBeforeMatch);
1473 else if (Tok.is(tok::l_brace) ||
1474 (getLangOpts().CPlusPlus && Tok.is(tok::colon)) ||
1476 (NextToken().is(tok::l_brace) || NextToken().is(tok::colon)))) {
1480 Diag(Tok.getLocation(), diag::err_friend_decl_defines_type)
1485 SkipUntil(tok::semi, StopBeforeMatch);
1491 } else if (isCXX11FinalKeyword() && (NextToken().is(tok::l_square) ||
1492 NextToken().is(tok::kw_alignas))) {
1502 if (Tok.is(tok::l_square) && NextToken().is(tok::l_square)) {
1504 if (!SkipUntil(tok::r_square, StopAtSemi))
1506 } else if (Tok.is(tok::kw_alignas) && NextToken().is(tok::l_paren)) {
1509 if (!SkipUntil(tok::r_paren, StopAtSemi))
1516 if (Tok.isOneOf(tok::l_brace, tok::colon))
1523 (Tok.is(tok::semi) ||
1524 (Tok.isAtStartOfLine() && !isValidAfterTypeSpecifier(false)))) {
1526 if (Tok.isNot(tok::semi)) {
1529 ExpectAndConsume(tok::semi, diag::err_expected_after,
1531 PP.EnterToken(Tok);
1532 Tok.setKind(tok::semi);
1578 if (TUK == Sema::TUK_Definition && Tok.is(tok::colon))
1579 SkipUntil(tok::semi, StopBeforeMatch);
1581 SkipUntil(tok::comma, StopAtSemi);
1715 Diag(Tok, diag::err_template_defn_explicit_instantiation)
1753 assert(Tok.is(tok::l_brace) ||
1754 (getLangOpts().CPlusPlus && Tok.is(tok::colon)) ||
1801 if (Tok.isNot(tok::semi)) {
1803 ExpectAndConsume(tok::semi, diag::err_expected_after,
1808 PP.EnterToken(Tok);
1809 Tok.setKind(tok::semi);
1822 assert(Tok.is(tok::colon) && "Not a base clause");
1834 SkipUntil(tok::comma, tok::l_brace, StopAtSemi | StopBeforeMatch);
1842 if (!TryConsumeToken(tok::comma))
1863 SourceLocation StartLoc = Tok.getLocation();
1869 if (TryConsumeToken(tok::kw_virtual))
1883 if (Tok.is(tok::kw_virtual)) {
1902 if (getLangOpts().MSVCCompat && Tok.is(tok::kw__Atomic) &&
1903 NextToken().is(tok::less))
1904 Tok.setKind(tok::identifier);
1916 TryConsumeToken(tok::ellipsis, EllipsisLoc);
1936 switch (Tok.getKind()) {
1938 case tok::kw_private: return AS_private;
1939 case tok::kw_protected: return AS_protected;
1940 case tok::kw_public: return AS_public;
1993 VirtSpecifiers::Specifier Parser::isCXX11VirtSpecifier(const Token &Tok) const {
1994 if (!getLangOpts().CPlusPlus || Tok.isNot(tok::identifier))
1997 IdentifierInfo *II = Tok.getIdentifierInfo();
2033 Diag(Tok.getLocation(), diag::err_friend_decl_spec)
2035 << FixItHint::CreateRemoval(Tok.getLocation())
2044 if (VS.SetSpecifier(Specifier, Tok.getLocation(), PrevSpec))
2045 Diag(Tok.getLocation(), diag::err_duplicate_virt_specifier)
2047 << FixItHint::CreateRemoval(Tok.getLocation());
2051 Diag(Tok.getLocation(), diag::err_override_control_interface)
2054 Diag(Tok.getLocation(), diag::ext_ms_sealed_keyword);
2056 Diag(Tok.getLocation(),
2083 if (Tok.isNot(tok::colon))
2086 DeclaratorInfo.SetIdentifier(nullptr, Tok.getLocation());
2088 if (!DeclaratorInfo.isFunctionDeclarator() && TryConsumeToken(tok::colon)) {
2093 SkipUntil(tok::comma, StopAtSemi | StopBeforeMatch);
2103 if (Tok.is(tok::kw_asm)) {
2107 SkipUntil(tok::comma, StopAtSemi | StopBeforeMatch);
2139 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
2248 if (Tok.is(tok::at)) {
2249 if (getLangOpts().ObjC1 && NextToken().isObjCAtKeyword(tok::objc_defs))
2250 Diag(Tok, diag::err_at_defs_cxx);
2252 Diag(Tok, diag::err_at_in_class);
2255 SkipUntil(tok::r_brace, StopAtSemi);
2270 Tok.isOneOf(tok::identifier, tok::coloncolon, tok::kw___super)) {
2275 if (Tok.isNot(tok::annot_cxxscope))
2277 else if (NextToken().is(tok::identifier))
2278 isAccessDecl = GetLookAheadToken(2).is(tok::semi);
2280 isAccessDecl = NextToken().is(tok::kw_operator);
2289 SkipUntil(tok::semi);
2298 SkipUntil(tok::semi);
2303 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
2305 SkipUntil(tok::semi);
2320 Tok.isOneOf(tok::kw_static_assert, tok::kw__Static_assert)) {
2326 if (Tok.is(tok::kw_template)) {
2336 if (Tok.is(tok::kw___extension__)) {
2355 if (Tok.is(tok::kw_using)) {
2361 if (Tok.is(tok::kw_namespace)) {
2363 SkipUntil(tok::semi, StopBeforeMatch);
2401 if (TryConsumeToken(tok::semi)) {
2421 if (Tok.isNot(tok::equal))
2426 if (Zero.isNot(tok::numeric_constant) || Zero.getLength() != 1 ||
2431 if (!After.isOneOf(tok::semi, tok::comma) &&
2433 After.isOneOf(tok::l_brace, tok::colon, tok::kw_try)))
2448 TryConsumeToken(tok::semi);
2465 if (Tok.is(tok::l_brace) && !getLangOpts().CPlusPlus11) {
2468 if (Tok.isOneOf(tok::l_brace, tok::colon, tok::kw_try)) {
2470 } else if (Tok.is(tok::equal)) {
2472 if (KW.is(tok::kw_default))
2474 else if (KW.is(tok::kw_delete))
2493 SkipUntil(tok::r_brace);
2496 TryConsumeToken(tok::semi);
2524 if (Tok.is(tok::semi))
2538 if (Tok.isOneOf(tok::equal, tok::l_brace) && PureSpecLoc.isInvalid()) {
2540 Diag(Tok, diag::err_bitfield_member_init);
2541 SkipUntil(tok::comma, StopAtSemi | StopBeforeMatch);
2553 HasInClassInit = Tok.is(tok::equal) ? ICIS_CopyInit : ICIS_ListInit;
2610 Diag(Tok, getLangOpts().CPlusPlus11
2620 Diag(Tok, diag::err_incomplete_array_member_init);
2621 SkipUntil(tok::comma, StopAtSemi | StopBeforeMatch);
2634 SkipUntil(tok::comma, StopAtSemi | StopBeforeMatch);
2666 if (!TryConsumeToken(tok::comma, CommaLoc))
2669 if (Tok.isAtStartOfLine() &&
2696 ExpectAndConsume(tok::semi, diag::err_expected_semi_decl_list)) {
2698 SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
2700 TryConsumeToken(tok::semi);
2729 assert(Tok.isOneOf(tok::equal, tok::l_brace)
2735 if (TryConsumeToken(tok::equal, EqualLoc)) {
2736 if (Tok.is(tok::kw_delete)) {
2743 if (IsFunction || Next.isOneOf(tok::semi, tok::comma, tok::eof)) {
2751 } else if (Tok.is(tok::kw_default)) {
2753 Diag(Tok, diag::err_default_delete_in_multiple_declaration)
2761 Diag(Tok, diag::err_ms_property_initializer) << PD;
2771 if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) {
2783 if (Tok.isNot(tok::colon) && Tok.isNot(tok::l_brace))
2790 if (Tok.is(tok::colon)) {
2803 if (!Tok.is(tok::l_brace)) {
2811 assert(Tok.is(tok::l_brace));
2812 BalancedDelimiterTracker T(*this, tok::l_brace);
2818 if (Tok.is(tok::kw___attribute))
2826 Tok.isOneOf(tok::kw___if_exists, tok::kw___if_not_exists)) {
2832 if (Tok.is(tok::semi)) {
2837 if (Tok.is(tok::annot_pragma_vis)) {
2842 if (Tok.is(tok::annot_pragma_pack)) {
2847 if (Tok.is(tok::annot_pragma_align)) {
2852 if (Tok.is(tok::annot_pragma_ms_pointers_to_members)) {
2857 if (Tok.is(tok::annot_pragma_ms_pragma)) {
2862 if (Tok.is(tok::annot_pragma_ms_vtordisp)) {
2868 if (Tok.is(tok::kw_namespace)) {
2877 SourceLocation ASLoc = Tok.getLocation();
2878 unsigned TokLength = Tok.getLength();
2884 if (TryConsumeToken(tok::colon, EndLoc)) {
2885 } else if (TryConsumeToken(tok::semi, EndLoc)) {
2887 << tok::colon << FixItHint::CreateReplacement(EndLoc, ":");
2891 << tok::colon << FixItHint::CreateInsertion(EndLoc, ":");
2909 if (Tok.is(tok::annot_pragma_openmp))
2975 if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) {
2976 VirtSpecifiers::Specifier Specifier = isCXX11VirtSpecifier(Tok);
3007 if (!Tok.is(tok::colon) && !Tok.is(tok::l_brace)) {
3014 if (Tok.is(tok::colon)) {
3016 if (!Tok.is(tok::l_brace)) {
3019 if (Tok.isAtStartOfLine()) {
3020 switch (Tok.getKind()) {
3021 case tok::kw_private:
3022 case tok::kw_protected:
3023 case tok::kw_public:
3024 SuggestFixIt = NextToken().getKind() == tok::colon;
3026 case tok::kw_static_assert:
3027 case tok::r_brace:
3028 case tok::kw_using:
3030 case tok::kw_template:
3033 case tok::identifier:
3046 PP.EnterToken(Tok);
3047 Tok.setKind(tok::l_brace);
3056 assert(Tok.is(tok::l_brace));
3057 BalancedDelimiterTracker T(*this, tok::l_brace);
3077 while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) &&
3078 Tok.isNot(tok::eof)) {
3085 SkipUntil(tok::r_brace);
3134 assert(Tok.is(tok::kw_namespace));
3140 Diag(Tok.getLocation(),
3144 PP.EnterToken(Tok);
3146 Tok.startToken();
3147 Tok.setLocation(PP.getLocForEndOfToken(PrevTokLocation));
3148 Tok.setKind(tok::semi);
3149 PP.EnterToken(Tok);
3151 Tok.setKind(tok::r_brace);
3176 assert(Tok.is(tok::colon) &&
3188 if (Tok.is(tok::code_completion)) {
3200 if (Tok.is(tok::comma))
3202 else if (Tok.is(tok::l_brace))
3206 else if (Tok.isOneOf(tok::identifier, tok::coloncolon)) {
3212 Diag(Tok.getLocation(), diag::err_expected_either) << tok::l_brace
3213 << tok::comma;
3214 SkipUntil(tok::l_brace, StopAtSemi | StopBeforeMatch);
3240 if (Tok.is(tok::annot_template_id)) {
3241 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
3245 assert(Tok.is(tok::annot_typename) && "template-id -> type failed");
3246 TemplateTypeTy = getTypeAnnotation(Tok);
3251 if (!TemplateTypeTy && Tok.isNot(tok::identifier)
3252 && Tok.isNot(tok::annot_decltype)) {
3253 Diag(Tok, diag::err_expected_member_or_base_name);
3259 SourceLocation IdLoc = Tok.getLocation();
3260 if (Tok.is(tok::annot_decltype)) {
3264 if (Tok.is(tok::identifier))
3267 II = Tok.getIdentifierInfo();
3273 if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
3274 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3281 TryConsumeToken(tok::ellipsis, EllipsisLoc);
3286 } else if(Tok.is(tok::l_paren)) {
3287 BalancedDelimiterTracker T(*this, tok::l_paren);
3293 if (Tok.isNot(tok::r_paren) && ParseExpressionList(ArgExprs, CommaLocs)) {
3294 SkipUntil(tok::r_paren, StopAtSemi);
3301 TryConsumeToken(tok::ellipsis, EllipsisLoc);
3310 return Diag(Tok, diag::err_expected_either) << tok::l_paren << tok::l_brace;
3312 return Diag(Tok, diag::err_expected) << tok::l_paren;
3336 if (Tok.isNot(tok::kw_throw) && Tok.isNot(tok::kw_noexcept))
3340 bool IsNoexcept = Tok.is(tok::kw_noexcept);
3341 Token StartTok = Tok;
3345 if (!Tok.is(tok::l_paren)) {
3348 Diag(Tok, diag::warn_cxx98_compat_noexcept_decl);
3353 Diag(Tok, diag::err_expected_lparen_after) << "throw";
3360 ExceptionSpecTokens->push_back(Tok); // '('
3363 ConsumeAndStoreUntil(tok::r_paren, *ExceptionSpecTokens,
3366 SpecificationRange.setEnd(Tok.getLocation());
3371 if (Tok.is(tok::kw_throw)) {
3380 if (Tok.isNot(tok::kw_noexcept))
3383 Diag(Tok, diag::warn_cxx98_compat_noexcept_decl);
3391 if (Tok.is(tok::l_paren)) {
3393 BalancedDelimiterTracker T(*this, tok::l_paren);
3419 if (Tok.is(tok::kw_throw)) {
3420 Diag(Tok.getLocation(), diag::err_dynamic_and_noexcept_specification);
3425 Diag(Tok.getLocation(), diag::err_dynamic_and_noexcept_specification);
3456 assert(Tok.is(tok::kw_throw) && "expected throw");
3459 BalancedDelimiterTracker T(*this, tok::l_paren);
3461 Diag(Tok, diag::err_expected_lparen_after) << "throw";
3468 if (Tok.is(tok::ellipsis)) {
3480 while (Tok.isNot(tok::r_paren)) {
3483 if (Tok.is(tok::ellipsis)) {
3498 if (!TryConsumeToken(tok::comma))
3512 assert(Tok.is(tok::arrow) && "expected arrow");
3587 switch (Tok.getKind()) {
3590 if (!Tok.isAnnotation()) {
3591 if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
3598 case tok::ampamp: // 'and'
3599 case tok::pipe: // 'bitor'
3600 case tok::pipepipe: // 'or'
3601 case tok::caret: // 'xor'
3602 case tok::tilde: // 'compl'
3603 case tok::amp: // 'bitand'
3604 case tok::ampequal: // 'and_eq'
3605 case tok::pipeequal: // 'or_eq'
3606 case tok::caretequal: // 'xor_eq'
3607 case tok::exclaim: // 'not'
3608 case tok::exclaimequal: // 'not_eq'
3613 PP.getSourceManager().getSpellingLoc(Tok.getLocation());
3658 assert(Tok.is(tok::l_paren) && "Not a C++11 attribute argument list");
3659 SourceLocation LParenLoc = Tok.getLocation();
3667 SkipUntil(tok::r_paren);
3730 if (Tok.is(tok::kw_alignas)) {
3731 Diag(Tok.getLocation(), diag::warn_cxx98_compat_alignas);
3736 assert(Tok.is(tok::l_square) && NextToken().is(tok::l_square)
3739 Diag(Tok.getLocation(), diag::warn_cxx98_compat_attribute);
3746 while (Tok.isNot(tok::r_square)) {
3748 if (TryConsumeToken(tok::comma))
3760 if (TryConsumeToken(tok::coloncolon)) {
3766 Diag(Tok.getLocation(), diag::err_expected) << tok::identifier;
3767 SkipUntil(tok::r_square, tok::comma, StopAtSemi | StopBeforeMatch);
3781 if (Tok.is(tok::l_paren))
3791 if (TryConsumeToken(tok::ellipsis))
3792 Diag(Tok, diag::err_cxx11_attribute_forbids_ellipsis)
3796 if (ExpectAndConsume(tok::r_square))
3797 SkipUntil(tok::r_square);
3799 *endLoc = Tok.getLocation();
3800 if (ExpectAndConsume(tok::r_square))
3801 SkipUntil(tok::r_square);
3812 SourceLocation StartLoc = Tok.getLocation(), Loc;
3825 SourceLocation StartLoc = Tok.getLocation();
3842 if (Tok.is(tok::l_square)) {
3843 BalancedDelimiterTracker T(*this, tok::l_square);
3848 assert(Tok.is(tok::kw_alignas) && "not an attribute specifier");
3850 BalancedDelimiterTracker T(*this, tok::l_paren);
3870 assert(Tok.is(tok::l_square) && "Not a Microsoft attribute list");
3874 BalancedDelimiterTracker T(*this, tok::l_square);
3876 SkipUntil(tok::r_square, StopAtSemi | StopBeforeMatch);
3880 } while (Tok.is(tok::l_square));
3889 BalancedDelimiterTracker Braces(*this, tok::l_brace);
3891 Diag(Toktok::l_brace;
3910 while (Tok.isNot(tok::r_brace) && !isEofOrEom()) {
3912 if (Tok.isOneOf(tok::kw___if_exists, tok::kw___if_not_exists)) {
3918 if (Tok.is(tok::semi)) {
3927 SourceLocation ASLoc = Tok.getLocation();
3929 if (Tok.is(tok::colon))
3930 Actions.ActOnAccessSpecifier(AS, ASLoc, Tok.getLocation());
3932 Diag(Tok, diag::err_expected) << tok::colon;