Lines Matching refs:Tok

57   Tok.startToken();
58 Tok.setKind(tok::eof);
77 DiagnosticBuilder Parser::Diag(const Token &Tok, unsigned DiagID) {
78 return Diag(Tok.getLocation(), DiagID);
102 static bool IsCommonTypo(tok::TokenKind ExpectedTok, const Token &Tok) {
105 return Tok.is(tok::colon) || Tok.is(tok::comma); // : or , for ;
112 if (Tok.is(ExpectedTok) || Tok.is(tok::code_completion)) {
118 if (IsCommonTypo(ExpectedTok, Tok)) {
119 SourceLocation Loc = Tok.getLocation();
145 : Diag(Tok, DiagID);
160 if (Tok.is(tok::code_completion)) {
165 if ((Tok.is(tok::r_paren) || Tok.is(tok::r_square)) &&
167 Diag(Tok, diag::err_extraneous_token_before_semi)
168 << PP.getSpelling(Tok)
169 << FixItHint::CreateRemoval(Tok.getLocation());
179 if (!Tok.is(tok::semi)) return;
182 SourceLocation StartLoc = Tok.getLocation();
183 SourceLocation EndLoc = Tok.getLocation();
186 while ((Tok.is(tok::semi) && !Tok.isAtStartOfLine())) {
188 EndLoc = Tok.getLocation();
216 if (Tok.is(tok::identifier))
218 if (const auto *II = Tok.getIdentifierInfo()) {
220 Diag(Tok, diag::err_expected_token_instead_of_objcxx_keyword)
221 << tok::identifier << Tok.getIdentifierInfo();
226 Diag(Tok, diag::err_expected) << tok::identifier;
234 SourceLocation SecondTokLoc = Tok.getLocation();
242 << (FirstTokKind == Tok.getKind()) << FirstTokKind << Tok.getKind()
245 << (FirstTokKind == Tok.getKind()) << Tok.getKind()
251 if (Tok.hasLeadingSpace() || Tok.isAtStartOfLine()) {
256 << (FirstTokKind == Tok.getKind()) << FirstTokKind << Tok.getKind()
285 if (Tok.is(Toks[i])) {
301 while (Tok.isNot(tok::eof))
306 switch (Tok.getKind()) {
419 Actions.ActOnPopScope(Tok.getLocation(), getCurScope());
609 if (PP.isIncrementalProcessingEnabled() && Tok.is(tok::eof))
613 switch (Tok.getKind()) {
660 Actions.ActOnModuleInclude(Tok.getLocation(),
662 Tok.getAnnotationValue()));
667 Actions.ActOnModuleBegin(Tok.getLocation(), reinterpret_cast<Module *>(
668 Tok.getAnnotationValue()));
673 Actions.ActOnModuleEnd(Tok.getLocation(), reinterpret_cast<Module *>(
674 Tok.getAnnotationValue()));
681 PP.Diag(Tok.getLocation(), diag::warn_max_tokens_total)
701 if ((Tok.getIdentifierInfo() == Ident_module ||
702 Tok.getIdentifierInfo() == Ident_import) &&
704 if (Tok.getIdentifierInfo() == Ident_module)
760 switch (Tok.getKind()) {
822 Actions.ActOnEmptyDeclaration(getCurScope(), attrs, Tok.getLocation());
826 Diag(Tok, diag::err_extraneous_closing_brace);
830 Diag(Tok, diag::err_expected_external_declaration);
841 SourceLocation StartLoc = Tok.getLocation();
868 Diag(Tok, diag::err_expected_external_declaration);
961 Diag(Tok, diag::err_unexpected_module_decl);
967 if (Tok.isEditorPlaceholder()) {
984 if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) {
990 return Tok.is(tok::equal) || // int X()= -> not a function def
991 Tok.is(tok::comma) || // int X(), -> not a function def
992 Tok.is(tok::semi) || // int X(); -> not a function def
993 Tok.is(tok::kw_asm) || // int X() __asm__ -> not a function def
994 Tok.is(tok::kw___attribute) || // int X() __attr__ -> not a function def
996 Tok.is(tok::l_paren)); // int X(0) -> not a function def [C++]
1003 if (Tok.is(tok::l_brace)) // int X() {}
1011 if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) {
1016 return Tok.is(tok::colon) || // X() : Base() {} (used for ctors)
1017 Tok.is(tok::kw_try); // X() try { ... }
1053 if (Tok.is(tok::semi)) {
1096 if (getLangOpts().ObjC && Tok.is(tok::at)) {
1098 if (!Tok.isObjCAtKeyword(tok::objc_interface) &&
1099 !Tok.isObjCAtKeyword(tok::objc_protocol) &&
1100 !Tok.isObjCAtKeyword(tok::objc_implementation)) {
1101 Diag(Tok, diag::err_objc_unexpected_attr);
1114 if (Tok.isObjCAtKeyword(tok::objc_protocol))
1117 if (Tok.isObjCAtKeyword(tok::objc_implementation))
1198 if (Tok.isNot(tok::l_brace) &&
1200 (Tok.isNot(tok::colon) && Tok.isNot(tok::kw_try) &&
1201 Tok.isNot(tok::equal)))) {
1202 Diag(Tok, diag::err_expected_fn_body);
1208 if (Tok.isNot(tok::l_brace))
1214 if (Tok.isNot(tok::equal)) {
1222 if (getLangOpts().DelayedTemplateParsing && Tok.isNot(tok::equal) &&
1255 (Tok.is(tok::l_brace) || Tok.is(tok::kw_try) ||
1256 Tok.is(tok::colon)) &&
1332 if (Tok.is(tok::comma)) {
1353 if (Tok.is(tok::kw_try))
1358 if (Tok.is(tok::colon)) {
1362 if (!Tok.is(tok::l_brace)) {
1378 if (Tok.is(tok::equal)) {
1383 bool IsFunctionTryBlock = Tok.is(tok::kw_try);
1392 while (IsFunctionTryBlock && Tok.is(tok::kw_catch)) {
1412 SourceLocation DSStart = Tok.getLocation();
1486 if (Tok.isNot(tok::comma))
1509 Actions.ActOnFinishKNRParamDeclarations(getCurScope(), D, Tok.getLocation());
1524 Diag(Tok, diag::err_expected_string_literal)
1533 Diag(Tok, diag::err_asm_operand_wide_string_literal)
1539 Diag(Tok, diag::err_asm_operand_wide_string_literal)
1553 assert(Tok.is(tok::kw_asm) && "Not an asm!");
1556 if (isGNUAsmQualifier(Tok)) {
1559 PP.getLocForEndOfToken(Tok.getLocation()));
1560 Diag(Tok, diag::err_global_asm_qualifier_ignored)
1561 << GNUAsmQualifiers::getQualifierName(getGNUAsmQualifier(Tok))
1568 Diag(Tok, diag::err_expected_lparen_after) << "asm";
1581 *EndLoc = Tok.getLocation();
1604 PP.EnterToken(Tok, /*IsReinject=*/true);
1605 Tok.setKind(tok::annot_cxxscope);
1606 Tok.setAnnotationValue(Actions.SaveNestedNameSpecifierAnnotation(SS));
1607 Tok.setAnnotationRange(SS.getRange());
1613 PP.AnnotateCachedTokens(Tok);
1625 assert(Tok.is(tok::identifier) || Tok.is(tok::annot_cxxscope));
1628 const bool WasScopeAnnotation = Tok.is(tok::annot_cxxscope);
1637 if (Tok.isNot(tok::identifier) || SS.isInvalid()) {
1643 IdentifierInfo *Name = Tok.getIdentifierInfo();
1644 SourceLocation NameLoc = Tok.getLocation();
1653 return Tok.is(tok::annot_typename) ? ANK_Success : ANK_TentativeDecl;
1685 Tok.setIdentifierInfo(Name);
1686 Tok.setKind(Name->getTokenID());
1687 PP.TypoCorrectToken(Tok);
1722 else if (Tok.is(tok::eof)) // Nothing to do here, bail out...
1726 Tok.setKind(tok::annot_typename);
1727 setTypeAnnotation(Tok, Ty);
1728 Tok.setAnnotationEndLoc(Tok.getLocation());
1729 Tok.setLocation(BeginLoc);
1730 PP.AnnotateCachedTokens(Tok);
1735 Tok.setKind(tok::annot_overload_set);
1736 setExprAnnotation(Tok, Classification.getExpression());
1737 Tok.setAnnotationEndLoc(NameLoc);
1739 Tok.setLocation(SS.getBeginLoc());
1740 PP.AnnotateCachedTokens(Tok);
1749 Tok.setKind(tok::annot_non_type);
1750 setNonTypeAnnotation(Tok, Classification.getNonTypeDecl());
1751 Tok.setLocation(NameLoc);
1752 Tok.setAnnotationEndLoc(NameLoc);
1753 PP.AnnotateCachedTokens(Tok);
1760 Tok.setKind(Classification.getKind() == Sema::NC_UndeclaredNonType
1763 setIdentifierAnnotation(Tok, Name);
1764 Tok.setLocation(NameLoc);
1765 Tok.setAnnotationEndLoc(NameLoc);
1766 PP.AnnotateCachedTokens(Tok);
1815 assert(Tok.isNot(tok::identifier));
1816 Diag(Tok, diag::ext_keyword_as_ident)
1817 << PP.getSpelling(Tok)
1820 Tok.getIdentifierInfo()->revertTokenIDToIdentifier();
1821 Tok.setKind(tok::identifier);
1848 assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon) ||
1849 Tok.is(tok::kw_typename) || Tok.is(tok::annot_cxxscope) ||
1850 Tok.is(tok::kw_decltype) || Tok.is(tok::annot_template_id) ||
1851 Tok.is(tok::kw___super)) &&
1854 if (Tok.is(tok::kw_typename)) {
1865 PP.EnterToken(Tok, /*IsReinject=*/true);
1866 Tok = TypedefToken;
1868 Diag(Tok.getLocation(), diag::warn_expected_qualified_after_typename);
1886 if (Tok.is(tok::identifier) || Tok.is(tok::annot_template_id) ||
1887 Tok.is(tok::annot_decltype)) {
1889 if (Tok.is(tok::annot_decltype) ||
1890 (!TryAnnotateTypeOrScopeToken() && Tok.isAnnotation())) {
1896 Diag(Tok.getLocation(), DiagID);
1900 if (Tok.isEditorPlaceholder())
1903 Diag(Tok.getLocation(), diag::err_expected_qualified_after_typename);
1908 if (Tok.is(tok::identifier)) {
1911 *Tok.getIdentifierInfo(),
1912 Tok.getLocation());
1913 } else if (Tok.is(tok::annot_template_id)) {
1914 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
1916 Diag(Tok, diag::err_typename_refers_to_non_type_template)
1917 << Tok.getAnnotationRange();
1932 Diag(Tok, diag::err_expected_type_name_after_typename)
1937 SourceLocation EndLoc = Tok.getLastLoc();
1938 Tok.setKind(tok::annot_typename);
1939 setTypeAnnotation(Tok, Ty);
1940 Tok.setAnnotationEndLoc(EndLoc);
1941 Tok.setLocation(TypenameLoc);
1942 PP.AnnotateCachedTokens(Tok);
1947 bool WasScopeAnnotation = Tok.is(tok::annot_cxxscope);
1964 if (Tok.is(tok::identifier)) {
1967 *Tok.getIdentifierInfo(), Tok.getLocation(), getCurScope(), &SS,
1972 SourceLocation BeginLoc = Tok.getLocation();
1990 else if (Tok.is(tok::eof)) // Nothing to do here, bail out...
1996 Tok.setKind(tok::annot_typename);
1997 setTypeAnnotation(Tok, Ty);
1998 Tok.setAnnotationEndLoc(Tok.getLocation());
1999 Tok.setLocation(BeginLoc);
2003 PP.AnnotateCachedTokens(Tok);
2020 TemplateName.setIdentifier(Tok.getIdentifierInfo(), Tok.getLocation());
2050 if (Tok.is(tok::annot_template_id)) {
2051 TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
2094 tok::TokenKind Kind = Tok.getKind();
2112 Diag(Tok, diag::err_invalid_token_after_declarator_suggest_equal)
2114 << FixItHint::CreateReplacement(SourceRange(Tok.getLocation()), "=");
2122 assert(Tok.is(tok::code_completion));
2123 PrevTokLocation = Tok.getLocation();
2179 assert((Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists)) &&
2181 Result.IsIfExists = Tok.is(tok::kw___if_exists);
2186 Diag(Tok, diag::err_expected_lparen_after)
2248 Diag(Tok, diag::err_expected) << tok::l_brace;
2267 while (Tok.isNot(tok::r_brace) && !isEofOrEom()) {
2291 SourceLocation StartLoc = Tok.getLocation();
2298 (Tok.is(tok::kw_module) ||
2299 (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_module)) &&
2308 if (getLangOpts().CPlusPlusModules && Tok.is(tok::semi)) {
2323 if (getLangOpts().CPlusPlusModules && Tok.is(tok::colon) &&
2341 if (Tok.is(tok::colon)) {
2379 SourceLocation StartLoc = AtLoc.isInvalid() ? Tok.getLocation() : AtLoc;
2384 assert((AtLoc.isInvalid() ? Tok.isOneOf(tok::kw_import, tok::identifier)
2385 : Tok.isObjCAtKeyword(tok::objc_import)) &&
2387 bool IsObjCAtImport = Tok.isObjCAtKeyword(tok::objc_import);
2393 if (Tok.is(tok::header_name)) {
2398 } else if (Tok.is(tok::annot_header_unit)) {
2400 HeaderUnit = reinterpret_cast<Module *>(Tok.getAnnotationValue());
2402 } else if (getLangOpts().CPlusPlusModules && Tok.is(tok::colon)) {
2463 if (!Tok.is(tok::identifier)) {
2464 if (Tok.is(tok::code_completion)) {
2470 Diag(Tok, diag::err_module_expected_ident) << IsImport;
2476 Path.push_back(std::make_pair(Tok.getIdentifierInfo(), Tok.getLocation()));
2479 if (Tok.isNot(tok::period))
2492 switch (Tok.getKind()) {
2499 Actions.ActOnModuleEnd(Tok.getLocation(),
2501 Tok.getAnnotationValue()));
2511 Actions.ActOnModuleBegin(Tok.getLocation(),
2513 Tok.getAnnotationValue()));
2520 Actions.ActOnModuleInclude(Tok.getLocation(),
2522 Tok.getAnnotationValue()));
2534 P.Diag(P.Tok, diag::err_bracket_depth_exceeded)
2536 P.Diag(P.Tok, diag::note_bracket_depth);
2544 LOpen = P.Tok.getLocation();
2558 assert(!P.Tok.is(Close) && "Should have consumed closing delimiter");
2560 if (P.Tok.is(tok::annot_module_end))
2561 P.Diag(P.Tok, diag::err_missing_before_module_end) << Close;
2563 P.Diag(P.Tok, diag::err_expected) << Close;
2568 if (P.Tok.isNot(tok::r_paren) && P.Tok.isNot(tok::r_brace) &&
2569 P.Tok.isNot(tok::r_square) &&
2572 P.Tok.is(Close))