Lines Matching refs:tok
33 if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less)) {
85 assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) &&
124 if (Tok.is(tok::kw_export)) {
130 if (Tok.is(tok::kw_template)) {
133 Diag(Tok.getLocation(), diag::err_expected_template);
143 SkipUntil(tok::r_brace, true, true);
144 if (Tok.is(tok::semi))
161 } while (Tok.is(tok::kw_export) || Tok.is(tok::kw_template));
203 if (Tok.is(tok::kw_using))
214 if (Tok.is(tok::semi)) {
238 SkipUntil(tok::r_brace, true, true);
239 if (Tok.is(tok::semi))
266 if (Tok.is(tok::comma)) {
267 Diag(Tok, diag::err_multiple_template_declarators)
269 SkipUntil(tok::semi, true, false);
295 if (!Tok.is(tok::less)) {
296 Diag(Tok.getLocation(), diag::err_expected_less_after) << "template";
303 if (!Tok.is(tok::greater) && !Tok.is(tok::greatergreater))
306 if (Tok.is(tok::greatergreater)) {
312 Tok.setKind(tok::greater);
313 RAngleLoc = Tok.getLocation();
314 Tok.setLocation(Tok.getLocation().getLocWithOffset(1));
315 } else if (Tok.is(tok::greater))
318 Diag(Tok.getLocation(), diag::err_expected_greater);
342 SkipUntil(tok::comma, tok::greater, tok::greatergreater, true, true);
346 if (Tok.is(tok::comma)) {
348 } else if (Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
355 Diag(Tok.getLocation(), diag::err_expected_comma_greater);
356 SkipUntil(tok::comma, tok::greater, tok::greatergreater, true, true);
366 if (Tok.is(tok::kw_class)) {
370 case tok::equal:
371 case tok::comma:
372 case tok::greater:
373 case tok::greatergreater:
374 case tok::ellipsis:
377 case tok::identifier:
387 case tok::equal:
388 case tok::comma:
389 case tok::greater:
390 case tok::greatergreater:
398 if (Tok.isNot(tok::kw_typename))
410 if (Next.getKind() == tok::identifier)
414 case tok::equal:
415 case tok::comma:
416 case tok::greater:
417 case tok::greatergreater:
418 case tok::ellipsis:
445 if (Tok.is(tok::kw_template))
464 assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) &&
468 bool TypenameKeyword = Tok.is(tok::kw_typename);
474 if (Tok.is(tok::ellipsis)) {
487 if (Tok.is(tok::identifier)) {
488 ParamName = Tok.getIdentifierInfo();
490 } else if (Tok.is(tok::equal) || Tok.is(tok::comma) ||
491 Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
495 Diag(Tok.getLocation(), diag::err_expected_ident);
504 if (Tok.is(tok::equal)) {
525 assert(Tok.is(tok::kw_template) && "Expected 'template' keyword");
543 if (!Tok.is(tok::kw_class)) {
544 bool Replace = Tok.is(tok::kw_typename) || Tok.is(tok::kw_struct);
545 const Token& Next = Replace ? NextToken() : Tok;
546 if (Next.is(tok::identifier) || Next.is(tok::comma) ||
547 Next.is(tok::greater) || Next.is(tok::greatergreater) ||
548 Next.is(tok::ellipsis))
549 Diag(Tok.getLocation(), diag::err_class_on_template_template_param)
550 << (Replace ? FixItHint::CreateReplacement(Tok.getLocation(), "class")
551 : FixItHint::CreateInsertion(Tok.getLocation(), "class "));
553 Diag(Tok.getLocation(), diag::err_class_on_template_template_param);
562 if (Tok.is(tok::ellipsis)) {
574 if (Tok.is(tok::identifier)) {
575 ParamName = Tok.getIdentifierInfo();
577 } else if (Tok.is(tok::equal) || Tok.is(tok::comma) ||
578 Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
582 Diag(Tok.getLocation(), diag::err_expected_ident);
598 if (Tok.is(tok::equal)) {
602 Diag(Tok.getLocation(),
604 SkipUntil(tok::comma, tok::greater, tok::greatergreater, true, true);
632 Diag(Tok.getLocation(), diag::err_expected_template_parameter);
641 if (Tok.is(tok::equal)) {
654 SkipUntil(tok::comma, tok::greater, true, true);
675 tok::TokenKind RemainingToken;
678 switch (Tok.getKind()) {
680 Diag(Tok.getLocation(), diag::err_expected_greater);
683 case tok::greater:
686 RAngleLoc = Tok.getLocation();
691 case tok::greatergreater:
692 RemainingToken = tok::greater;
695 case tok::greatergreatergreater:
696 RemainingToken = tok::greatergreater;
699 case tok::greaterequal:
700 RemainingToken = tok::equal;
704 case tok::greatergreaterequal:
705 RemainingToken = tok::greaterequal;
713 RAngleLoc = Tok.getLocation();
731 if ((RemainingToken == tok::greater ||
732 RemainingToken == tok::greatergreater) &&
733 (Next.is(tok::greater) || Next.is(tok::greatergreater) ||
734 Next.is(tok::greatergreatergreater) || Next.is(tok::equal) ||
735 Next.is(tok::greaterequal) || Next.is(tok::greatergreaterequal) ||
736 Next.is(tok::equalequal)) &&
737 areTokensAdjacent(Tok, Next))
741 if (getLangOpts().CPlusPlus11 && Tok.is(tok::greatergreater))
743 else if (Tok.is(tok::greaterequal))
745 Diag(Tok.getLocation(), DiagId) << Hint1 << Hint2;
748 if (RemainingToken == tok::equal && Next.is(tok::equal) &&
749 areTokensAdjacent(Tok, Next)) {
754 Tok.setKind(tok::equalequal);
755 Tok.setLength(Tok.getLength() + 1);
757 Tok.setKind(RemainingToken);
758 Tok.setLength(Tok.getLength() - 1);
760 Tok.setLocation(Lexer::AdvanceToTokenCharacter(RAngleLoc, 1,
767 PP.EnterToken(Tok);
768 Tok.setKind(tok::greater);
769 Tok.setLength(1);
770 Tok.setLocation(RAngleLoc);
802 assert(Tok.is(tok::less) && "Must have already parsed the template-name");
811 if (Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater))
816 SkipUntil(tok::greater, true, !ConsumeLastToken);
868 assert(Template && Tok.is(tok::less) &&
886 if (Tok.is(tok::greater))
902 if (Tok.is(tok::greater))
907 Tok.setKind(tok::annot_typename);
908 setTypeAnnotation(Tok, Type.get());
910 Tok.setLocation(SS.getBeginLoc());
912 Tok.setLocation(TemplateKWLoc);
914 Tok.setLocation(TemplateNameLoc);
918 Tok.setKind(tok::annot_template_id);
938 Tok.setAnnotationValue(TemplateId);
940 Tok.setLocation(TemplateKWLoc);
942 Tok.setLocation(TemplateNameLoc);
946 Tok.setAnnotationEndLoc(RAngleLoc);
950 PP.AnnotateCachedTokens(Tok);
961 assert(Tok.is(tok::annot_template_id) && "Requires template-id tokens");
963 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
980 Tok.setKind(tok::annot_typename);
981 setTypeAnnotation(Tok, Type.isInvalid() ? ParsedType() : Type.get());
983 Tok.setLocation(TemplateId->SS.getBeginLoc());
988 PP.AnnotateCachedTokens(Tok);
992 static bool isEndOfTemplateArgument(Token Tok) {
993 return Tok.is(tok::comma) || Tok.is(tok::greater) ||
994 Tok.is(tok::greatergreater);
999 if (!Tok.is(tok::identifier) && !Tok.is(tok::coloncolon) &&
1000 !Tok.is(tok::annot_cxxscope))
1020 if (SS.isSet() && Tok.is(tok::kw_template)) {
1025 if (Tok.is(tok::identifier)) {
1028 Name.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
1032 if (Tok.is(tok::ellipsis))
1039 if (isEndOfTemplateArgument(Tok) &&
1047 } else if (Tok.is(tok::identifier)) {
1051 Name.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
1055 if (Tok.is(tok::ellipsis))
1058 if (isEndOfTemplateArgument(Tok)) {
1096 SourceLocation Loc = Tok.getLocation();
1123 SourceLocation Loc = Tok.getLocation();
1147 if (!Tok.is(tok::less))
1152 if (Tok.is(tok::greater))
1160 return Tok.is(tok::greater) || Tok.is(tok::comma);
1173 if (Tok.is(tok::ellipsis)) {
1179 SkipUntil(tok::comma, tok::greater, true, true);
1188 if (Tok.isNot(tok::comma)) break;
1304 LMT.Toks.push_back(Tok);
1309 assert((Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try))
1327 if (Tok.is(tok::kw_try)) {
1330 if (Tok.is(tok::colon))
1335 if (Tok.is(tok::l_brace)) {
1356 tok::TokenKind kind = Tok.getKind();
1359 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
1363 if (kind == tok::kw_try) {
1364 while (Tok.is(tok::kw_catch)) {
1365 ConsumeAndStoreUntil(tok::l_brace, Toks, /*StopAtSemi=*/false);
1366 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);