Home | History | Annotate | Download | only in Parse

Lines Matching refs:Tok

33   if (Tok.is(tok::kw_template) && NextToken().isNot(tok::less)) {
64 assert((Tok.is(tok::kw_export) || Tok.is(tok::kw_template)) &&
104 if (Tok.is(tok::kw_export)) {
110 if (Tok.is(tok::kw_template)) {
113 Diag(Tok.getLocation(), diag::err_expected_template);
123 SkipUntil(tok::r_brace, true, true);
124 if (Tok.is(tok::semi))
142 } while (Tok.is(tok::kw_export) || Tok.is(tok::kw_template));
184 if (Tok.is(tok::kw_using))
195 if (Tok.is(tok::semi)) {
219 SkipUntil(tok::r_brace, true, true);
220 if (Tok.is(tok::semi))
244 Diag(Tok, diag::err_template_defn_explicit_instantiation) << 0;
276 if (Tok.is(tok::comma)) {
277 Diag(Tok, diag::err_multiple_template_declarators)
279 SkipUntil(tok::semi, true, false);
305 if (!Tok.is(tok::less)) {
306 Diag(Tok.getLocation(), diag::err_expected_less_after) << "template";
313 if (!Tok.is(tok::greater) && !Tok.is(tok::greatergreater))
316 if (Tok.is(tok::greatergreater)) {
322 Tok.setKind(tok::greater);
323 RAngleLoc = Tok.getLocation();
324 Tok.setLocation(Tok.getLocation().getLocWithOffset(1));
325 } else if (Tok.is(tok::greater))
328 Diag(Tok.getLocation(), diag::err_expected_greater);
352 SkipUntil(tok::comma, tok::greater, tok::greatergreater, true, true);
356 if (Tok.is(tok::comma)) {
358 } else if (Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
365 Diag(Tok.getLocation(), diag::err_expected_comma_greater);
366 SkipUntil(tok::comma, tok::greater, tok::greatergreater, true, true);
376 if (Tok.is(tok::kw_class)) {
380 case tok::equal:
381 case tok::comma:
382 case tok::greater:
383 case tok::greatergreater:
384 case tok::ellipsis:
387 case tok::identifier:
397 case tok::equal:
398 case tok::comma:
399 case tok::greater:
400 case tok::greatergreater:
408 if (Tok.isNot(tok::kw_typename))
420 if (Next.getKind() == tok::identifier)
424 case tok::equal:
425 case tok::comma:
426 case tok::greater:
427 case tok::greatergreater:
428 case tok::ellipsis:
455 if (Tok.is(tok::kw_template))
474 assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) &&
478 bool TypenameKeyword = Tok.is(tok::kw_typename);
484 if (Tok.is(tok::ellipsis)) {
497 if (Tok.is(tok::identifier)) {
498 ParamName = Tok.getIdentifierInfo();
500 } else if (Tok.is(tok::equal) || Tok.is(tok::comma) ||
501 Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
505 Diag(Tok.getLocation(), diag::err_expected_ident);
514 if (Tok.is(tok::equal)) {
535 assert(Tok.is(tok::kw_template) && "Expected 'template' keyword");
553 if (!Tok.is(tok::kw_class)) {
554 bool Replace = Tok.is(tok::kw_typename) || Tok.is(tok::kw_struct);
555 const Token& Next = Replace ? NextToken() : Tok;
556 if (Next.is(tok::identifier) || Next.is(tok::comma) ||
557 Next.is(tok::greater) || Next.is(tok::greatergreater) ||
558 Next.is(tok::ellipsis))
559 Diag(Tok.getLocation(), diag::err_class_on_template_template_param)
560 << (Replace ? FixItHint::CreateReplacement(Tok.getLocation(), "class")
561 : FixItHint::CreateInsertion(Tok.getLocation(), "class "));
563 Diag(Tok.getLocation(), diag::err_class_on_template_template_param);
572 if (Tok.is(tok::ellipsis)) {
584 if (Tok.is(tok::identifier)) {
585 ParamName = Tok.getIdentifierInfo();
587 } else if (Tok.is(tok::equal) || Tok.is(tok::comma) ||
588 Tok.is(tok::greater) || Tok.is(tok::greatergreater)) {
592 Diag(Tok.getLocation(), diag::err_expected_ident);
608 if (Tok.is(tok::equal)) {
612 Diag(Tok.getLocation(),
614 SkipUntil(tok::comma, tok::greater, tok::greatergreater, true, true);
642 Diag(Tok.getLocation(), diag::err_expected_template_parameter);
651 if (Tok.is(tok::equal)) {
664 SkipUntil(tok::comma, tok::greater, true, true);
685 tok::TokenKind RemainingToken;
688 switch (Tok.getKind()) {
690 Diag(Tok.getLocation(), diag::err_expected_greater);
693 case tok::greater:
696 RAngleLoc = Tok.getLocation();
701 case tok::greatergreater:
702 RemainingToken = tok::greater;
705 case tok::greatergreatergreater:
706 RemainingToken = tok::greatergreater;
709 case tok::greaterequal:
710 RemainingToken = tok::equal;
714 case tok::greatergreaterequal:
715 RemainingToken = tok::greaterequal;
723 RAngleLoc = Tok.getLocation();
741 if ((RemainingToken == tok::greater ||
742 RemainingToken == tok::greatergreater) &&
743 (Next.is(tok::greater) || Next.is(tok::greatergreater) ||
744 Next.is(tok::greatergreatergreater) || Next.is(tok::equal) ||
745 Next.is(tok::greaterequal) || Next.is(tok::greatergreaterequal) ||
746 Next.is(tok::equalequal)) &&
747 areTokensAdjacent(Tok, Next))
751 if (getLangOpts().CPlusPlus11 && Tok.is(tok::greatergreater))
753 else if (Tok.is(tok::greaterequal))
755 Diag(Tok.getLocation(), DiagId) << Hint1 << Hint2;
758 if (RemainingToken == tok::equal && Next.is(tok::equal) &&
759 areTokensAdjacent(Tok, Next)) {
764 Tok.setKind(tok::equalequal);
765 Tok.setLength(Tok.getLength() + 1);
767 Tok.setKind(RemainingToken);
768 Tok.setLength(Tok.getLength() - 1);
770 Tok.setLocation(Lexer::AdvanceToTokenCharacter(RAngleLoc, 1,
777 PP.EnterToken(Tok);
778 Tok.setKind(tok::greater);
779 Tok.setLength(1);
780 Tok.setLocation(RAngleLoc);
812 assert(Tok.is(tok::less) && "Must have already parsed the template-name");
821 if (Tok.isNot(tok::greater) && Tok.isNot(tok::greatergreater))
826 SkipUntil(tok::greater, true, !ConsumeLastToken);
878 assert(Template && Tok.is(tok::less) &&
896 if (Tok.is(tok::greater))
912 if (Tok.is(tok::greater))
917 Tok.setKind(tok::annot_typename);
918 setTypeAnnotation(Tok, Type.get());
920 Tok.setLocation(SS.getBeginLoc());
922 Tok.setLocation(TemplateKWLoc);
924 Tok.setLocation(TemplateNameLoc);
928 Tok.setKind(tok::annot_template_id);
948 Tok.setAnnotationValue(TemplateId);
950 Tok.setLocation(TemplateKWLoc);
952 Tok.setLocation(TemplateNameLoc);
956 Tok.setAnnotationEndLoc(RAngleLoc);
960 PP.AnnotateCachedTokens(Tok);
971 assert(Tok.is(tok::annot_template_id) && "Requires template-id tokens");
973 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
990 Tok.setKind(tok::annot_typename);
991 setTypeAnnotation(Tok, Type.isInvalid() ? ParsedType() : Type.get());
993 Tok.setLocation(TemplateId->SS.getBeginLoc());
998 PP.AnnotateCachedTokens(Tok);
1002 static bool isEndOfTemplateArgument(Token Tok) {
1003 return Tok.is(tok::comma) || Tok.is(tok::greater) ||
1004 Tok.is(tok::greatergreater);
1009 if (!Tok.is(tok::identifier) && !Tok.is(tok::coloncolon) &&
1010 !Tok.is(tok::annot_cxxscope))
1030 if (SS.isSet() && Tok.is(tok::kw_template)) {
1035 if (Tok.is(tok::identifier)) {
1038 Name.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
1042 if (Tok.is(tok::ellipsis))
1049 if (isEndOfTemplateArgument(Tok) &&
1057 } else if (Tok.is(tok::identifier)) {
1061 Name.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
1065 if (Tok.is(tok::ellipsis))
1068 if (isEndOfTemplateArgument(Tok)) {
1106 SourceLocation Loc = Tok.getLocation();
1133 SourceLocation Loc = Tok.getLocation();
1157 if (!Tok.is(tok::less))
1162 if (Tok.is(tok::greater))
1170 return Tok.is(tok::greater) || Tok.is(tok::comma);
1186 if (Tok.is(tok::ellipsis)) {
1192 SkipUntil(tok::comma, tok::greater, true, true);
1201 if (Tok.isNot(tok::comma)) break;
1322 LMT.Toks.push_back(Tok);
1327 assert((Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try))
1339 if (Tok.is(tok::kw_try)) {
1342 if (Tok.is(tok::colon))
1347 if (Tok.is(tok::l_brace)) {
1372 tok::TokenKind kind = Tok.getKind();
1375 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);
1379 if (kind == tok::kw_try) {
1380 while (Tok.is(tok::kw_catch)) {
1381 ConsumeAndStoreUntil(tok::l_brace, Toks, /*StopAtSemi=*/false);
1382 ConsumeAndStoreUntil(tok::r_brace, Toks, /*StopAtSemi=*/false);