;
37 casetok::unknown:
return0;
39 casetok::kw_addrspace_cast:
return1;
40 casetok::kw_const_cast:
return2;
41 casetok::kw_dynamic_cast:
return3;
42 casetok::kw_reinterpret_cast:
return4;
43 casetok::kw_static_cast:
return5;
45llvm_unreachable(
"Unknown type for digraph error message.");
50boolParser::areTokensAdjacent(
const Token&
First,
const Token&Second) {
54 returnFirstEnd ==
SM.getSpellingLoc(Second.
getLocation());
62PP.
Lex(DigraphToken);
68 P.Diag(DigraphToken.
getLocation(), diag::err_missing_whitespace_digraph)
73ColonToken.
setKind(tok::coloncolon);
76DigraphToken.
setKind(tok::less);
87voidParser::CheckForTemplateAndDigraph(
Token&Next,
ParsedTypeObjectType,
90 if(!Next.is(tok::l_square) || Next.getLength() != 2)
93 TokenSecondToken = GetLookAheadToken(2);
94 if(!SecondToken.
is(tok::colon) || !areTokensAdjacent(Next, SecondToken))
100 boolMemberOfUnknownSpecialization;
103Template, MemberOfUnknownSpecialization))
106 FixDigraph(*
this, PP, Next, SecondToken, tok::unknown,
159boolParser::ParseOptionalCXXScopeSpecifier(
161 boolEnteringContext,
bool*MayBePseudoDestructor,
boolIsTypename,
162 const IdentifierInfo**LastII,
boolOnlyNamespace,
boolInUsingDeclaration,
163 boolDisambiguation) {
165 "Call sites of this function should be guarded by checking for C++");
167 if(Tok.
is(tok::annot_cxxscope)) {
168assert(!LastII &&
"want last identifier but have already annotated scope");
169assert(!MayBePseudoDestructor &&
"unexpected annot_cxxscope");
173ConsumeAnnotationToken();
178 boolCheckForDestructor =
false;
179 if(MayBePseudoDestructor && *MayBePseudoDestructor) {
180CheckForDestructor =
true;
181*MayBePseudoDestructor =
false;
187 boolHasScopeSpecifier =
false;
189 if(Tok.
is(tok::coloncolon)) {
192 if(NextKind == tok::kw_new || NextKind == tok::kw_delete)
195 if(NextKind == tok::l_brace) {
204HasScopeSpecifier =
true;
208 if(Tok.
is(tok::kw___super)) {
210 if(!Tok.
is(tok::coloncolon)) {
218 if(!HasScopeSpecifier &&
219Tok.
isOneOf(tok::kw_decltype, tok::annot_decltype)) {
229AnnotateExistingDecltypeSpecifier(DS, DeclLoc, EndLoc);
236HasScopeSpecifier =
true;
239 else if(!HasScopeSpecifier && Tok.
is(tok::identifier) &&
240GetLookAheadToken(1).is(tok::ellipsis) &&
241GetLookAheadToken(2).is(tok::l_square) &&
242!GetLookAheadToken(3).is(tok::r_square)) {
251DS.getRepAsType().get(), DS.getPackIndexingExpr(), DS.getBeginLoc(),
252DS.getEllipsisLoc());
268 Diag(Start, diag::warn_pre_cxx26_ambiguous_pack_indexing_type) <<
Type;
278HasScopeSpecifier =
true;
282 autoSavedType = PreferredType;
284 if(HasScopeSpecifier) {
285 if(Tok.
is(tok::code_completion)) {
290 getCurScope(), SS, EnteringContext, InUsingDeclaration,
310ObjectType =
nullptr;
318 if(Tok.
is(tok::kw_template)) {
322 if(!HasScopeSpecifier && !ObjectType)
325TentativeParsingAction TPA(*
this);
329 if(Tok.
is(tok::identifier)) {
333}
else if(Tok.
is(tok::kw_operator)) {
338 if(ParseUnqualifiedIdOperator(SS, EnteringContext, ObjectType,
347diag::err_id_after_template_in_nested_name_spec)
360 if(Tok.
isNot(tok::less)) {
370EnteringContext, Template,
true);
371 if(AnnotateTemplateIdToken(Template, TNK, SS, TemplateKWLoc,
378 if(Tok.
is(tok::annot_template_id) &&
NextToken().is(tok::coloncolon)) {
387 if(CheckForDestructor && GetLookAheadToken(2).is(tok::tilde)) {
388*MayBePseudoDestructor =
true;
393*LastII = TemplateId->
Name;
396ConsumeAnnotationToken();
398assert(Tok.
is(tok::coloncolon) &&
"NextToken() not working properly!");
401HasScopeSpecifier =
true;
427#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait: 428#include "clang/Basic/TransformTypeTraits.def" 430Tok.
setKind(tok::identifier);
431 Diag(Tok, diag::ext_keyword_as_ident)
442 if(Tok.
isNot(tok::identifier))
457 if(Next.is(tok::colon) && !ColonIsSacred) {
464 Diag(Next, diag::err_unexpected_colon_in_nested_name_spec)
467Next.setKind(tok::coloncolon);
471 if(Next.is(tok::coloncolon) && GetLookAheadToken(2).is(tok::l_brace)) {
482 if(Next.is(tok::coloncolon)) {
483 if(CheckForDestructor && GetLookAheadToken(2).is(tok::tilde)) {
484*MayBePseudoDestructor =
true;
489 const Token&Next2 = GetLookAheadToken(2);
490 if(Next2.
is(tok::kw_private) || Next2.
is(tok::kw_protected) ||
491Next2.
is(tok::kw_public) || Next2.
is(tok::kw_virtual)) {
492 Diag(Next2, diag::err_unexpected_token_in_nested_name_spec)
496PP.
Lex(ColonColon);
497ColonColon.
setKind(tok::colon);
510assert(Tok.
isOneOf(tok::coloncolon, tok::colon) &&
511 "NextToken() not working properly!");
512 TokenColonColon = Tok;
515 boolIsCorrectedToColon =
false;
516 bool*CorrectionFlagPtr = ColonIsSacred ? &IsCorrectedToColon :
nullptr;
518 getCurScope(), IdInfo, EnteringContext, SS, CorrectionFlagPtr,
522 if(CorrectionFlagPtr && IsCorrectedToColon) {
523ColonColon.
setKind(tok::colon);
531HasScopeSpecifier =
true;
535CheckForTemplateAndDigraph(Next, ObjectType, EnteringContext, II, SS);
539 if(Next.is(tok::less)) {
544 boolMemberOfUnknownSpecialization;
548EnteringContext, Template, MemberOfUnknownSpecialization,
555isTemplateArgumentList(1) == TPResult::False)
572 if(MemberOfUnknownSpecialization && !Disambiguation &&
573(ObjectType || SS.
isSet()) &&
574(IsTypename || isTemplateArgumentList(1) == TPResult::True)) {
577 if(!ObjectHadErrors) {
582 unsignedDiagID = diag::err_missing_dependent_template_keyword;
584DiagID = diag::warn_missing_dependent_template_keyword;
595EnteringContext, Template,
true);
612 if(CheckForDestructor && !HasScopeSpecifier && Tok.
is(tok::tilde))
613*MayBePseudoDestructor =
true;
619 boolisAddressOfOperand,
620 Token&Replacement) {
625 casetok::annot_non_type: {
626 NamedDecl*ND = getNonTypeAnnotation(Tok);
632 casetok::annot_non_type_dependent: {
638 if(isAddressOfOperand && isPostfixExpressionSuffixStart())
639isAddressOfOperand =
false;
646 casetok::annot_non_type_undeclared: {
648 "undeclared non-type annotation should be unqualified");
663 false, &TemplateKWLoc, Name))
668 if(isAddressOfOperand && isPostfixExpressionSuffixStart())
669isAddressOfOperand =
false;
672 getCurScope(), SS, TemplateKWLoc, Name, Tok.
is(tok::l_paren),
673isAddressOfOperand,
nullptr,
false,
679 E= tryParseCXXPackIndexingExpression(
E);
681 if(!
E.isInvalid() && !
E.isUnset() && Tok.
is(tok::less))
682checkPotentialAngleBracket(
E);
687assert(Tok.
is(tok::ellipsis) &&
NextToken().is(tok::l_square) &&
693 if(
T.consumeClose() || IndexExpr.
isInvalid())
696EllipsisLoc,
T.getOpenLocation(),
697IndexExpr.
get(),
T.getCloseLocation());
701Parser::tryParseCXXPackIndexingExpression(
ExprResultPackIdExpression) {
704Tok.
is(tok::ellipsis) &&
NextToken().is(tok::l_square)) {
705 E= ParseCXXPackIndexingExpression(
E);
752ExprResultParser::ParseCXXIdExpression(
boolisAddressOfOperand) {
758ParseOptionalCXXScopeSpecifier(SS,
nullptr,
764tryParseCXXIdExpression(SS, isAddressOfOperand, Replacement);
768UnconsumeToken(Replacement);
769 Result= tryParseCXXIdExpression(SS, isAddressOfOperand, Replacement);
771assert(!
Result.isUnset() &&
"Typo correction suggested a keyword replacement " 772 "for a previous keyword suggestion");
824 if(ParseLambdaIntroducer(Intro)) {
831 returnParseLambdaExpressionAfterIntroducer(Intro);
838ExprResultParser::TryParseLambdaExpression() {
840 "Not at the start of a possible lambda expression.");
843 if(Next.is(tok::eof))
848 if(Next.is(tok::r_square) ||
849Next.is(tok::equal) ||
850(Next.is(tok::amp) &&
851 After.isOneOf(tok::r_square, tok::comma)) ||
852(Next.is(tok::identifier) &&
853 After.is(tok::r_square)) ||
854Next.is(tok::ellipsis)) {
855 returnParseLambdaExpression();
860 if(Next.is(tok::identifier) &&
After.is(tok::identifier))
870TentativeParsingAction TPA(*
this);
871LambdaIntroducerTentativeParse Tentative;
872 if(ParseLambdaIntroducer(Intro, &Tentative)) {
878 caseLambdaIntroducerTentativeParse::Success:
882 caseLambdaIntroducerTentativeParse::Incomplete:
887 if(ParseLambdaIntroducer(Intro))
891 caseLambdaIntroducerTentativeParse::MessageSend:
892 caseLambdaIntroducerTentativeParse::Invalid:
899 returnParseLambdaExpressionAfterIntroducer(Intro);
912LambdaIntroducerTentativeParse *Tentative) {
914*Tentative = LambdaIntroducerTentativeParse::Success;
916assert(Tok.
is(tok::l_square) &&
"Lambda expressions begin with '['.");
926 auto Invalid= [&](llvm::function_ref<void()> Action) {
928*Tentative = LambdaIntroducerTentativeParse::Invalid;
937 autoNonTentativeAction = [&](llvm::function_ref<void()> Action) {
939*Tentative = LambdaIntroducerTentativeParse::Incomplete;
945 if(Tok.
is(tok::amp) &&
953Tentative =
nullptr;
955}
else if(Tok.
is(tok::equal)) {
959Tentative =
nullptr;
962 while(Tok.
isNot(tok::r_square)) {
964 if(Tok.
isNot(tok::comma)) {
969 if(Tok.
is(tok::code_completion) &&
985 if(Tok.
is(tok::code_completion)) {
1009 if(Tok.
is(tok::star)) {
1011 if(Tok.
is(tok::kw_this)) {
1019}
else if(Tok.
is(tok::kw_this)) {
1022}
else if(Tok.
isOneOf(tok::amp, tok::equal) &&
1030[&] {
Diag(Tok.
getLocation(), diag::err_capture_default_first); });
1034 if(Tok.
is(tok::amp)) {
1038 if(Tok.
is(tok::code_completion)) {
1049 if(Tok.
is(tok::identifier)) {
1052}
else if(Tok.
is(tok::kw_this)) {
1065 if(Tok.
is(tok::l_paren)) {
1074*Tentative = LambdaIntroducerTentativeParse::Incomplete;
1075}
else if(ParseExpressionList(Exprs)) {
1081 Parens.getCloseLocation(),
1084}
else if(Tok.
isOneOf(tok::l_brace, tok::equal)) {
1097 Init= ParseInitializer();
1098}
else if(Tok.
is(tok::l_brace)) {
1102*Tentative = LambdaIntroducerTentativeParse::Incomplete;
1126 Init= ParseInitializer();
1127 if(!
Init.isInvalid())
1136Tok.
setKind(tok::annot_primary_expr);
1137setExprAnnotation(Tok,
Init);
1142ConsumeAnnotationToken();
1151 if(Tentative && Tok.
is(tok::identifier) &&
1154*Tentative = LambdaIntroducerTentativeParse::MessageSend;
1160 if(llvm::any_of(EllipsisLocs,
1166!InitCapture ? &EllipsisLocs[2] :
1169EllipsisLoc = *ExpectedEllipsisLoc;
1171 unsignedDiagID = 0;
1173DiagID = diag::err_lambda_capture_misplaced_ellipsis;
1179 unsignedNumEllipses = std::accumulate(
1180std::begin(EllipsisLocs), std::end(EllipsisLocs), 0,
1182 if(NumEllipses > 1)
1183DiagID = diag::err_lambda_capture_multiple_ellipses;
1186NonTentativeAction([&] {
1195assert(DiagLoc.
isValid() &&
"no location for diagnostic");
1199 auto&&
D=
Diag(DiagLoc, DiagID);
1200 if(DiagID == diag::err_lambda_capture_misplaced_ellipsis) {
1220 if(
Init.isUsable())
1222 if(
Init.isUsable()) {
1223NonTentativeAction([&] {
1260 autoConsumeLocation = [&
P, &DeclEndLoc](
SourceLocation&SpecifierLoc,
1262 if(SpecifierLoc.isValid()) {
1263 P.Diag(
P.getCurToken().getLocation(),
1264diag::err_lambda_decl_specifier_repeated)
1268SpecifierLoc =
P.ConsumeToken();
1269DeclEndLoc = SpecifierLoc;
1273 switch(
P.getCurToken().getKind()) {
1274 casetok::kw_mutable:
1275ConsumeLocation(MutableLoc, 0);
1277 casetok::kw_static:
1278ConsumeLocation(StaticLoc, 1);
1280 casetok::kw_constexpr:
1281ConsumeLocation(ConstexprLoc, 2);
1283 casetok::kw_consteval:
1284ConsumeLocation(ConstevalLoc, 3);
1295 P.Diag(StaticLoc, !
P.getLangOpts().CPlusPlus23
1296? diag::err_static_lambda
1297: diag::warn_cxx20_compat_static_lambda);
1298 const char*PrevSpec =
nullptr;
1299 unsignedDiagID = 0;
1302 P.getActions().getASTContext().getPrintingPolicy());
1303assert(PrevSpec ==
nullptr&& DiagID == 0 &&
1304 "Static cannot have been set previously!");
1311 if(ConstexprLoc.
isValid()) {
1312 P.Diag(ConstexprLoc, !
P.getLangOpts().CPlusPlus17
1313? diag::ext_constexpr_on_lambda_cxx17
1314: diag::warn_cxx14_compat_constexpr_on_lambda);
1315 const char*PrevSpec =
nullptr;
1316 unsignedDiagID = 0;
1319assert(PrevSpec ==
nullptr&& DiagID == 0 &&
1320 "Constexpr cannot have been set previously!");
1327 if(ConstevalLoc.
isValid()) {
1328 P.Diag(ConstevalLoc, diag::warn_cxx20_compat_consteval);
1329 const char*PrevSpec =
nullptr;
1330 unsignedDiagID = 0;
1334 P.Diag(ConstevalLoc, DiagID) << PrevSpec;
1350 P.Diag(StaticLoc, diag::err_static_mutable_lambda);
1352 P.Diag(StaticLoc, diag::err_static_lambda_captures);
1358ExprResultParser::ParseLambdaExpressionAfterIntroducer(
1362 Diag(LambdaBeginLoc, diag::ext_hlsl_lambda) <<
1;
1365? diag::warn_cxx98_compat_lambda
1370 "lambda expression parsing");
1375TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
1392 if(Tok.
is(tok::kw___noinline__)) {
1395Attributes.addNew(AttrName, AttrNameLoc,
nullptr,
1396AttrNameLoc,
nullptr,
13970, tok::kw___noinline__);
1398}
else if(Tok.
is(tok::kw___attribute))
1399ParseGNUAttributes(Attributes,
nullptr, &
D);
1404 D.takeAttributes(Attributes);
1407MultiParseScope TemplateParamScope(*
this);
1408 if(Tok.
is(tok::less)) {
1410? diag::warn_cxx17_compat_lambda_template_parameter_list
1411: diag::ext_lambda_template_parameter_list);
1415 if(ParseTemplateParameters(TemplateParamScope,
1416CurTemplateDepthTracker.getDepth(),
1417TemplateParams, LAngleLoc, RAngleLoc)) {
1422 if(TemplateParams.empty()) {
1424diag::err_lambda_template_parameter_list_empty);
1435++CurTemplateDepthTracker;
1446Intro, LAngleLoc, TemplateParams, RAngleLoc, RequiresClause);
1454 if(isCXX11AttributeSpecifier()) {
1456? diag::warn_cxx20_compat_decl_attrs_on_lambda
1457: diag::ext_decl_attrs_on_lambda)
1459MaybeParseCXX11Attributes(
D);
1466 boolHasParentheses =
false;
1467 boolHasSpecifiers =
false;
1478 if(Tok.
is(tok::l_paren)) {
1481LParenLoc =
T.getOpenLocation();
1483 if(Tok.
isNot(tok::r_paren)) {
1485CurTemplateDepthTracker.getOriginalDepth());
1487ParseParameterDeclarationClause(
D, Attributes, ParamInfo, EllipsisLoc);
1494CurTemplateDepthTracker.setAddedDepth(1);
1498DeclEndLoc = RParenLoc =
T.getCloseLocation();
1499HasParentheses =
true;
1503Tok.
isOneOf(tok::kw_mutable, tok::arrow, tok::kw___attribute,
1504tok::kw_constexpr, tok::kw_consteval, tok::kw_static,
1505tok::kw___private, tok::kw___global, tok::kw___local,
1506tok::kw___constant, tok::kw___generic, tok::kw_groupshared,
1507tok::kw_requires, tok::kw_noexcept) ||
1509(Tok.
is(tok::l_square) &&
NextToken().
is(tok::l_square));
1511 if(HasSpecifiers && !HasParentheses && !
getLangOpts().CPlusPlus23) {
1515 Diag(Tok, diag::ext_lambda_missing_parens)
1519 if(HasParentheses || HasSpecifiers) {
1523MaybeParseAttributes(PAKM_GNU | PAKM_Declspec, Attributes);
1531ConstevalLoc, DeclEndLoc);
1542 if(!HasParentheses)
1545 if(HasSpecifiers || HasParentheses) {
1554ESpecType = tryParseExceptionSpecification(
1555 false, ESpecRange, DynamicExceptions,
1556DynamicExceptionRanges, NoexceptExpr, ExceptionSpecTokens);
1559DeclEndLoc = ESpecRange.
getEnd();
1562 if(MaybeParseCXX11Attributes(Attributes))
1563DeclEndLoc = Attributes.Range.getEnd();
1566 if(Tok.
isOneOf(tok::kw___private, tok::kw___global, tok::kw___local,
1567tok::kw___constant, tok::kw___generic)) {
1568ParseOpenCLQualifiers(DS.getAttributes());
1575 if(Tok.
is(tok::arrow)) {
1578TrailingReturnType =
1579ParseTrailingReturnType(
Range,
false);
1588 false, LParenLoc, ParamInfo.data(),
1589ParamInfo.size(), EllipsisLoc, RParenLoc,
1591NoLoc, MutableLoc, ESpecType,
1592ESpecRange, DynamicExceptions.data(),
1593DynamicExceptionRanges.data(), DynamicExceptions.size(),
1594NoexceptExpr.
isUsable() ? NoexceptExpr.
get() :
nullptr,
1596{}, LParenLoc, FunLocalRangeEnd,
D,
1597TrailingReturnType, TrailingReturnTypeLoc, &DS),
1598std::move(Attributes), DeclEndLoc);
1605 if(HasParentheses && Tok.
is(tok::kw_requires))
1606ParseTrailingRequiresClause(
D);
1613 if(A.getKind() == ParsedAttr::AT_CUDADevice ||
1614A.getKind() == ParsedAttr::AT_CUDAHost ||
1615A.getKind() == ParsedAttr::AT_CUDAGlobal)
1616 Diag(A.getLoc(), diag::warn_cuda_attr_lambda_position)
1617<< A.getAttrName()->getName();
1626ParseScope BodyScope(
this, ScopeFlags);
1631 if(!Tok.
is(tok::l_brace)) {
1632 Diag(Tok, diag::err_expected_lambda_body);
1639TemplateParamScope.Exit();
1642 if(!
Stmt.isInvalid() && !TrailingReturnType.
isInvalid() &&
1643!
D.isInvalidType())
1663 const char*CastName =
nullptr;
1666 default: llvm_unreachable(
"Unknown C++ cast!");
1667 casetok::kw_addrspace_cast: CastName =
"addrspace_cast";
break;
1668 casetok::kw_const_cast: CastName =
"const_cast";
break;
1669 casetok::kw_dynamic_cast: CastName =
"dynamic_cast";
break;
1670 casetok::kw_reinterpret_cast: CastName =
"reinterpret_cast";
break;
1671 casetok::kw_static_cast: CastName =
"static_cast";
break;
1679 if(Tok.
is(tok::l_square) && Tok.
getLength() == 2) {
1681 if(Next.is(tok::colon) && areTokensAdjacent(Tok, Next))
1682 FixDigraph(*
this, PP, Tok, Next, Kind,
true);
1685 if(ExpectAndConsume(tok::less, diag::err_expected_less_after, CastName))
1690ParseSpecifierQualifierList(DS,
AS_none,
1691DeclSpecContext::DSC_type_specifier);
1696ParseDeclarator(DeclaratorInfo);
1700 if(ExpectAndConsume(tok::greater))
1701 return ExprError(
Diag(LAngleBracketLoc, diag::note_matching) << tok::less);
1705 if(
T.expectAndConsume(diag::err_expected_lparen_after, CastName))
1713 if(!
Result.isInvalid() && !DeclaratorInfo.isInvalidType())
1715LAngleBracketLoc, DeclaratorInfo,
1717 T.getOpenLocation(),
Result.get(),
1718 T.getCloseLocation());
1730assert(Tok.
is(tok::kw_typeid) &&
"Not 'typeid'!");
1737 if(
T.expectAndConsume(diag::err_expected_lparen_after,
"typeid"))
1739LParenLoc =
T.getOpenLocation();
1760 if(isTypeIdInParens()) {
1765RParenLoc =
T.getCloseLocation();
1770Ty.
get().getAsOpaquePtr(), RParenLoc);
1775 if(
Result.isInvalid())
1779RParenLoc =
T.getCloseLocation();
1784 Result.get(), RParenLoc);
1797assert(Tok.
is(tok::kw___uuidof) &&
"Not '__uuidof'!");
1803 if(
T.expectAndConsume(diag::err_expected_lparen_after,
"__uuidof"))
1808 if(isTypeIdInParens()) {
1818Ty.
get().getAsOpaquePtr(),
1819 T.getCloseLocation());
1826 if(
Result.isInvalid())
1833 Result.get(),
T.getCloseLocation());
1880 if(Tok.
is(tok::identifier)) {
1883assert(Tok.
is(tok::coloncolon) &&
"ParseOptionalCXXScopeSpecifier fail");
1885}
else if(Tok.
is(tok::annot_template_id)) {
1891ConsumeAnnotationToken();
1892assert(Tok.
is(tok::coloncolon) &&
"ParseOptionalCXXScopeSpecifier fail");
1895assert(SS.
isEmpty() &&
"missing last component of nested name specifier");
1900assert(Tok.
is(tok::tilde) &&
"ParseOptionalCXXScopeSpecifier fail");
1903 if(Tok.
is(tok::kw_decltype) && !FirstTypeName.
isValid()) {
1905ParseDecltypeSpecifier(DS);
1912 if(!Tok.
is(tok::identifier)) {
1913 Diag(Tok, diag::err_destructor_tilde_identifier);
1918 if(GetLookAheadToken(1).is(tok::ellipsis) &&
1919GetLookAheadToken(2).is(tok::l_square)) {
1921ParsePackIndexingType(DS);
1940 if(Tok.
is(tok::less) &&
1941ParseUnqualifiedIdTemplateId(
1943Name, NameLoc,
false, SecondTypeName,
1948SS, FirstTypeName, CCLoc, TildeLoc,
1967assert(Tok.
is(tok::kw_throw) &&
"Not throw!");
1984 if(
Expr.isInvalid())
return Expr;
1994assert(Tok.
is(tok::kw_co_yield) &&
"Not co_yield!");
1999 if(!
Expr.isInvalid())
2010assert(Tok.
is(tok::kw_this) &&
"Not 'this'!");
2029Parser::ParseCXXTypeConstructExpression(
const DeclSpec&DS) {
2034assert((Tok.
is(tok::l_paren) ||
2036&&
"Expected '(' or '{'!");
2038 if(Tok.
is(tok::l_brace)) {
2041 if(
Init.isInvalid())
2055 autoRunSignatureHelp = [&]() {
2061Exprs,
T.getOpenLocation(),
false);
2062CalledSignatureHelp =
true;
2063 returnPreferredType;
2066 if(Tok.
isNot(tok::r_paren)) {
2067 if(ParseExpressionList(Exprs, [&] {
2068PreferredType.enterFunctionArgument(Tok.
getLocation(),
2086Exprs,
T.getCloseLocation(),
2094assert(Tok.
is(tok::kw_using) &&
"Expected using");
2097 "Unexpected Declarator Context");
2101DG = ParseUsingDeclaration(Context, {}, DeclStart, DeclEnd, Attrs,
AS_none);
2106? diag::ext_alias_in_init_statement
2107: diag::warn_cxx20_alias_in_init_statement)
2147ForRangeInfo *FRI,
boolEnterForConditionScope) {
2149 structForConditionScopeRAII {
2151 voidenter(
boolIsConditionVariable) {
2154S->setIsConditionVarScope(IsConditionVariable);
2157~ForConditionScopeRAII() {
2159S->setIsConditionVarScope(
false);
2161} ForConditionScope{EnterForConditionScope ?
getCurScope() : nullptr};
2164PreferredType.enterCondition(Actions, Tok.
getLocation());
2166 if(Tok.
is(tok::code_completion)) {
2174MaybeParseCXX11Attributes(attrs);
2176 const autoWarnOnInit = [
this, &CK] {
2178? diag::warn_cxx14_compat_init_statement
2179: diag::ext_init_statement)
2184 switch(isCXXConditionDeclarationOrInitStatement(InitStmt, FRI)) {
2185 caseConditionOrInitStatement::Expression: {
2187ForConditionScope.enter(
false);
2189ProhibitAttributes(attrs);
2193 if(InitStmt && Tok.
is(tok::semi)) {
2197 Diag(SemiLoc, diag::warn_empty_init_statement)
2203 returnParseCXXCondition(
nullptr,
Loc, CK, MissingOK);
2208 if(
Expr.isInvalid())
2211 if(InitStmt && Tok.
is(tok::semi)) {
2215 returnParseCXXCondition(
nullptr,
Loc, CK, MissingOK);
2222 caseConditionOrInitStatement::InitStmtDecl: {
2226 if(Tok.
is(tok::kw_using))
2227DG = ParseAliasDeclarationInInitStatement(
2232attrs, DeclSpecAttrs,
true);
2234*InitStmt = Actions.
ActOnDeclStmt(DG, DeclStart, DeclEnd);
2235 returnParseCXXCondition(
nullptr,
Loc, CK, MissingOK);
2238 caseConditionOrInitStatement::ForRangeDecl: {
2242assert(FRI &&
"should not parse a for range declaration here");
2251 caseConditionOrInitStatement::ConditionDecl:
2252 caseConditionOrInitStatement::Error:
2257ForConditionScope.enter(
true);
2261ParseSpecifierQualifierList(DS,
AS_none, DeclSpecContext::DSC_condition);
2265ParseDeclarator(DeclaratorInfo);
2268 if(Tok.
is(tok::kw_asm)) {
2271 if(AsmLabel.isInvalid()) {
2275DeclaratorInfo.setAsmLabel(AsmLabel.get());
2276DeclaratorInfo.SetRangeEnd(
Loc);
2280MaybeParseGNUAttributes(DeclaratorInfo);
2291 boolCopyInitialization = isTokenEqualOrEqualTypo();
2292 if(CopyInitialization)
2298diag::warn_cxx98_compat_generalized_initializer_lists);
2299InitExpr = ParseBraceInitializer();
2300}
else if(CopyInitialization) {
2301PreferredType.enterVariableInit(Tok.
getLocation(), DeclOut);
2303}
else if(Tok.
is(tok::l_paren)) {
2307RParen = ConsumeParen();
2309diag::err_expected_init_in_condition_lparen)
2312 Diag(DeclOut->
getLocation(), diag::err_expected_init_in_condition);
2350voidParser::ParseCXXSimpleTypeSpecifier(
DeclSpec&DS) {
2352 const char*PrevSpec;
2359 casetok::identifier:
2360 casetok::coloncolon:
2361llvm_unreachable(
"Annotation token should already be formed!");
2363llvm_unreachable(
"Not a simple-type-specifier token!");
2366 casetok::annot_typename: {
2370ConsumeAnnotationToken();
2371DS.
Finish(Actions, Policy);
2375 casetok::kw__ExtInt:
2376 casetok::kw__BitInt: {
2377DiagnoseBitIntUse(Tok);
2386DS.
Finish(Actions, Policy);
2399 casetok::kw___int64:
2403 casetok::kw_signed:
2406 casetok::kw_unsigned:
2421 casetok::kw___int128:
2424 casetok::kw___bf16:
2433 casetok::kw_double:
2436 casetok::kw__Float16:
2439 casetok::kw___float128:
2442 casetok::kw___ibm128:
2445 casetok::kw_wchar_t:
2448 casetok::kw_char8_t:
2451 casetok::kw_char16_t:
2454 casetok::kw_char32_t:
2460 casetok::kw__Accum:
2463 casetok::kw__Fract:
2469#define GENERIC_IMAGE_TYPE(ImgType, Id) \ 2470 case tok::kw_##ImgType##_t: \ 2471 DS.SetTypeSpecType(DeclSpec::TST_##ImgType##_t, Loc, PrevSpec, DiagID, \ 2474#include "clang/Basic/OpenCLImageTypes.def" 2475#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ 2476 case tok::kw_##Name: \ 2477 DS.SetTypeSpecType(DeclSpec::TST_##Name, Loc, PrevSpec, DiagID, Policy); \ 2479#include "clang/Basic/HLSLIntangibleTypes.def" 2481 casetok::annot_decltype:
2482 casetok::kw_decltype:
2484 returnDS.
Finish(Actions, Policy);
2486 casetok::annot_pack_indexing_type:
2488 returnDS.
Finish(Actions, Policy);
2491 casetok::kw_typeof:
2492ParseTypeofSpecifier(DS);
2493DS.
Finish(Actions, Policy);
2498DS.
Finish(Actions, Policy);
2513ParseSpecifierQualifierList(DS,
AS_none,
2514getDeclSpecContextFromDeclaratorContext(Context));
2554boolParser::ParseUnqualifiedIdTemplateId(
2558assert(Tok.
is(tok::less) &&
"Expected '<' to finish parsing a template-id");
2562 switch(
Id.getKind()) {
2566 if(AssumeTemplateId) {
2570ObjectType, EnteringContext, Template,
2573 boolMemberOfUnknownSpecialization;
2576ObjectType, EnteringContext, Template,
2577MemberOfUnknownSpecialization);
2582isTemplateArgumentList(0) == TPResult::False)
2586ObjectType && isTemplateArgumentList(0) == TPResult::True) {
2589 if(!ObjectHadErrors) {
2596Name = std::string(
Id.Identifier->getName());
2598Name =
"operator ";
2602Name +=
Id.Identifier->getName();
2604 Diag(
Id.StartLocation, diag::err_missing_dependent_template_keyword)
2609 getCurScope(), SS, TemplateKWLoc,
Id, ObjectType, EnteringContext,
2619 boolMemberOfUnknownSpecialization;
2623EnteringContext, Template,
2624MemberOfUnknownSpecialization);
2632 boolMemberOfUnknownSpecialization;
2637EnteringContext, Template,
true);
2641EnteringContext, Template,
2642MemberOfUnknownSpecialization);
2645 Diag(NameLoc, diag::err_destructor_template_id)
2659TemplateArgList TemplateArgs;
2660 if(ParseTemplateIdAfterTemplateName(
true, LAngleLoc, TemplateArgs, RAngleLoc,
2681:
Id.OperatorFunctionId.Operator;
2684TemplateKWLoc,
Id.StartLocation, TemplateII, OpKind, Template, TNK,
2685LAngleLoc, RAngleLoc, TemplateArgs,
false, TemplateIds);
2687 Id.setTemplateId(TemplateId);
2696 getCurScope(), SS, TemplateKWLoc, Template, Name, NameLoc, LAngleLoc,
2697TemplateArgsPtr, RAngleLoc,
true);
2698 if(
Type.isInvalid())
2702 Id.setConstructorName(
Type.get(), NameLoc, RAngleLoc);
2704 Id.setDestructorName(
Id.StartLocation,
Type.get(), RAngleLoc);
2749boolParser::ParseUnqualifiedIdOperator(
CXXScopeSpec&SS,
boolEnteringContext,
2752assert(Tok.
is(tok::kw_operator) &&
"Expected 'operator' keyword");
2758 unsignedSymbolIdx = 0;
2763 casetok::kw_delete: {
2764 boolisNew = Tok.
getKind() == tok::kw_new;
2768 if(Tok.
is(tok::l_square) &&
2774 if(
T.getCloseLocation().isInvalid())
2777SymbolLocations[SymbolIdx++] =
T.getOpenLocation();
2778SymbolLocations[SymbolIdx++] =
T.getCloseLocation();
2779Op = isNew? OO_Array_New : OO_Array_Delete;
2781Op = isNew? OO_New : OO_Delete;
2786#define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \ 2788 SymbolLocations[SymbolIdx++] = ConsumeToken(); \ 2791#define OVERLOADED_OPERATOR_MULTI(Name,Spelling,Unary,Binary,MemberOnly) 2792#include "clang/Basic/OperatorKinds.def" 2794 casetok::l_paren: {
2799 if(
T.getCloseLocation().isInvalid())
2802SymbolLocations[SymbolIdx++] =
T.getOpenLocation();
2803SymbolLocations[SymbolIdx++] =
T.getCloseLocation();
2808 casetok::l_square: {
2813 if(
T.getCloseLocation().isInvalid())
2816SymbolLocations[SymbolIdx++] =
T.getOpenLocation();
2817SymbolLocations[SymbolIdx++] =
T.getCloseLocation();
2822 casetok::code_completion: {
2836 Result.setOperatorFunctionId(KeywordLoc, Op, SymbolLocations);
2850 unsignedDiagId = 0;
2856 while(isTokenStringLiteral()) {
2857 if(!Tok.
is(tok::string_literal) && !DiagId) {
2862DiagId = diag::err_literal_operator_string_prefix;
2864Toks.push_back(Tok);
2865TokLocs.push_back(ConsumeStringToken());
2874 boolIsUDSuffix = !
Literal.getUDSuffix().empty();
2883}
else if(Tok.
is(tok::identifier)) {
2886TokLocs.push_back(SuffixLoc);
2898DiagLoc = TokLocs.front();
2899DiagId = diag::err_literal_operator_string_not_empty;
2909 SourceRange(TokLocs.front(), TokLocs.back()), Str);
2912 Result.setLiteralOperatorId(II, KeywordLoc, SuffixLoc);
2930 if(ParseCXXTypeSpecifierSeq(
2938ParseDeclaratorInternal(
D,
nullptr);
2946 Result.setConversionFunctionId(KeywordLoc, Ty.
get(),
2988 boolObjectHadErrors,
boolEnteringContext,
2989 boolAllowDestructorName,
2990 boolAllowConstructorName,
2991 boolAllowDeductionGuide,
2999 boolTemplateSpecified =
false;
3000 if(Tok.
is(tok::kw_template)) {
3001 if(TemplateKWLoc && (ObjectType || SS.
isSet())) {
3002TemplateSpecified =
true;
3006 Diag(TemplateLoc, diag::err_unexpected_template_in_unqualified_id)
3014 if(Tok.
is(tok::identifier)) {
3023 Result.setIdentifier(
Id, IdLoc);
3028 if(AllowConstructorName &&
3035 Result.setConstructorName(Ty, IdLoc, IdLoc);
3044 Result.setIdentifier(
Id, IdLoc);
3049 if(Tok.
is(tok::less))
3050 returnParseUnqualifiedIdTemplateId(
3051SS, ObjectType, ObjectHadErrors,
3053EnteringContext,
Result, TemplateSpecified);
3055 if(TemplateSpecified) {
3058ObjectType, EnteringContext, Template,
3068!Tok.
is(tok::less))
3069 Diag(IdLoc, diag::missing_template_arg_list_after_template_kw);
3076 if(Tok.
is(tok::annot_template_id)) {
3082ConsumeAnnotationToken();
3087 if(AllowConstructorName && TemplateId->
Name&&
3095diag::err_out_of_line_constructor_template_id)
3096<< TemplateId->
Name 3106ConsumeAnnotationToken();
3110 Result.setConstructorTemplateId(TemplateId);
3111ConsumeAnnotationToken();
3117 Result.setTemplateId(TemplateId);
3119 if(TemplateLoc.
isValid()) {
3120 if(TemplateKWLoc && (ObjectType || SS.
isSet()))
3121*TemplateKWLoc = TemplateLoc;
3123 Diag(TemplateLoc, diag::err_unexpected_template_in_unqualified_id)
3126ConsumeAnnotationToken();
3133 if(Tok.
is(tok::kw_operator)) {
3134 if(ParseUnqualifiedIdOperator(SS, EnteringContext, ObjectType,
Result))
3145Tok.
is(tok::less))
3146 returnParseUnqualifiedIdTemplateId(
3147SS, ObjectType, ObjectHadErrors,
3150 else if(TemplateSpecified &&
3153EnteringContext, Template,
3161(AllowDestructorName || SS.
isSet()) && Tok.
is(tok::tilde)) {
3170 if(TemplateSpecified) {
3181 Diag(*TemplateKWLoc, diag::err_unexpected_template_in_destructor_name)
3186 if(SS.
isEmpty() && Tok.
is(tok::kw_decltype)) {
3191 Result.setDestructorName(TildeLoc,
Type, EndLoc);
3198 if(Tok.
isNot(tok::identifier)) {
3199 Diag(Tok, diag::err_destructor_tilde_identifier);
3204DeclaratorScopeObj DeclScopeObj(*
this, SS);
3205 if(
NextToken().is(tok::coloncolon)) {
3212AnnotateScopeToken(SS,
true);
3215 if(ParseOptionalCXXScopeSpecifier(SS, ObjectType, ObjectHadErrors,
3219ObjectType =
nullptr;
3220 if(Tok.
isNot(tok::identifier) ||
NextToken().is(tok::coloncolon) ||
3222 Diag(TildeLoc, diag::err_destructor_tilde_scope);
3227 Diag(TildeLoc, diag::err_destructor_tilde_scope)
3233DeclScopeObj.EnterDeclaratorScope();
3240 if(Tok.
is(tok::less)) {
3241 Result.setDestructorName(TildeLoc,
nullptr, ClassNameLoc);
3242 returnParseUnqualifiedIdTemplateId(
3243SS, ObjectType, ObjectHadErrors,
3245ClassNameLoc, EnteringContext,
Result, TemplateSpecified);
3251ObjectType, EnteringContext);
3255 Result.setDestructorName(TildeLoc, Ty, ClassNameLoc);
3260#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait: 3261#include "clang/Basic/TransformTypeTraits.def" 3263Tok.
setKind(tok::identifier);
3264 Diag(Tok, diag::ext_keyword_as_ident)
3266 gotoParseIdentifier;
3270 Diag(Tok, diag::err_expected_unqualified_id) <<
getLangOpts().CPlusPlus;
3304Parser::ParseCXXNewExpression(
boolUseGlobal,
SourceLocationStart) {
3305assert(Tok.
is(tok::kw_new) &&
"expected 'new' token");
3311ExprVector PlacementArgs;
3318 if(Tok.
is(tok::l_paren)) {
3322PlacementLParen =
T.getOpenLocation();
3323 if(ParseExpressionListOrTypeId(PlacementArgs, DeclaratorInfo)) {
3329PlacementRParen =
T.getCloseLocation();
3335 if(PlacementArgs.empty()) {
3337TypeIdParens =
T.getRange();
3341 if(Tok.
is(tok::l_paren)) {
3344MaybeParseGNUAttributes(DeclaratorInfo);
3345ParseSpecifierQualifierList(DS);
3347ParseDeclarator(DeclaratorInfo);
3349TypeIdParens =
T.getRange();
3351MaybeParseGNUAttributes(DeclaratorInfo);
3352 if(ParseCXXTypeSpecifierSeq(DS))
3353DeclaratorInfo.setInvalidType(
true);
3356ParseDeclaratorInternal(DeclaratorInfo,
3357&Parser::ParseDirectNewDeclarator);
3364MaybeParseGNUAttributes(DeclaratorInfo);
3366DeclaratorInfo.setInvalidType(
true);
3369ParseDeclaratorInternal(DeclaratorInfo,
3370&Parser::ParseDirectNewDeclarator);
3373 if(DeclaratorInfo.isInvalidType()) {
3380 if(Tok.
is(tok::l_paren)) {
3382ExprVector ConstructorArgs;
3385ConstructorLParen =
T.getOpenLocation();
3386 if(Tok.
isNot(tok::r_paren)) {
3387 autoRunSignatureHelp = [&]() {
3397DeclaratorInfo.getEndLoc(), ConstructorArgs,
3400CalledSignatureHelp =
true;
3401 returnPreferredType;
3403 if(ParseExpressionList(ConstructorArgs, [&] {
3404PreferredType.enterFunctionArgument(Tok.
getLocation(),
3414ConstructorRParen =
T.getCloseLocation();
3424diag::warn_cxx98_compat_generalized_initializer_lists);
3430 returnActions.
ActOnCXXNew(Start, UseGlobal, PlacementLParen,
3431PlacementArgs, PlacementRParen,
3432TypeIdParens, DeclaratorInfo,
Initializer.get());
3442voidParser::ParseDirectNewDeclarator(
Declarator&
D) {
3445 while(Tok.
is(tok::l_square)) {
3447 if(CheckProhibitedCXX11Attribute())
3456 if(
Size.isInvalid()) {
3467MaybeParseCXX11Attributes(Attrs);
3471 Size.get(),
T.getOpenLocation(),
3472 T.getCloseLocation()),
3473std::move(Attrs),
T.getCloseLocation());
3475 if(
T.getCloseLocation().isInvalid())
3490boolParser::ParseExpressionListOrTypeId(
3494 if(isTypeIdInParens()) {
3495ParseSpecifierQualifierList(
D.getMutableDeclSpec());
3497ParseDeclarator(
D);
3498 return D.isInvalidType();
3502 returnParseExpressionList(PlacementArgs);
3517Parser::ParseCXXDeleteExpression(
boolUseGlobal,
SourceLocationStart) {
3518assert(Tok.
is(tok::kw_delete) &&
"Expected 'delete' keyword");
3522 boolArrayDelete =
false;
3523 if(Tok.
is(tok::l_square) &&
NextToken().is(tok::r_square)) {
3531 const TokenNext = GetLookAheadToken(2);
3534 if(Next.isOneOf(tok::l_brace, tok::less) ||
3535(Next.is(tok::l_paren) &&
3536(GetLookAheadToken(3).is(tok::r_paren) ||
3537(GetLookAheadToken(3).is(tok::identifier) &&
3538GetLookAheadToken(4).is(tok::identifier))))) {
3539TentativeParsingAction TPA(*
this);
3547 boolEmitFixIt =
false;
3548 if(Tok.
is(tok::l_brace)) {
3558 Diag(Start, diag::err_lambda_after_delete)
3566 Diag(Start, diag::err_lambda_after_delete)
3576Lambda = ParsePostfixExpressionSuffix(Lambda);
3583ArrayDelete =
true;
3588 if(
T.getCloseLocation().isInvalid())
3623ExprResultParser::ParseRequiresExpression() {
3624assert(Tok.
is(tok::kw_requires) &&
"Expected 'requires' keyword");
3629 if(Tok.
is(tok::l_paren)) {
3634 if(!Tok.
is(tok::r_paren)) {
3639FirstArgAttrs, LocalParameters,
3642 Diag(EllipsisLoc, diag::err_requires_expr_parameter_list_ellipsis);
3643 for(
auto&ParamInfo : LocalParameters)
3644LocalParameterDecls.push_back(cast<ParmVarDecl>(ParamInfo.Param));
3650 if(
Braces.expectAndConsume())
3667RequiresKWLoc, LocalParameterDecls,
getCurScope());
3669 if(Tok.
is(tok::r_brace)) {
3676 Diag(Tok, diag::err_empty_requires_expr);
3679 while(!Tok.
is(tok::r_brace)) {
3681 casetok::l_brace: {
3692ExprBraces.consumeOpen();
3696ExprBraces.skipToEnd();
3700 if(ExprBraces.consumeClose())
3701ExprBraces.skipToEnd();
3706 if(Tok.
is(tok::semi)) {
3709Requirements.push_back(Req);
3714 Diag(Tok, diag::err_requires_expr_missing_arrow)
3717 if(TryAnnotateTypeConstraint()) {
3721 if(!isTypeConstraintAnnotation()) {
3722 Diag(Tok, diag::err_requires_expr_expected_type_constraint);
3727 if(Tok.
is(tok::annot_cxxscope)) {
3731ConsumeAnnotationToken();
3735 Expression.get(), NoexceptLoc, SS, takeTemplateIdAnnotation(Tok),
3736TemplateParameterDepth);
3737ConsumeAnnotationToken();
3739Requirements.push_back(Req);
3743 boolPossibleRequiresExprInSimpleRequirement =
false;
3744 if(Tok.
is(tok::kw_requires)) {
3745 autoIsNestedRequirement = [&] {
3746RevertingTentativeParsingAction TPA(*
this);
3748 if(Tok.
is(tok::l_brace))
3755 if(Tok.
is(tok::l_paren)) {
3758 autoRes = TryParseParameterDeclarationClause();
3759 if(Res != TPResult::False) {
3762 while(Depth != 0) {
3763 boolFoundParen =
SkipUntil(tok::l_paren, tok::r_paren,
3767 if(Tok.
is(tok::l_paren))
3769 else if(Tok.
is(tok::r_paren))
3780 if(Tok.
is(tok::l_brace))
3789 if(IsNestedRequirement()) {
3804Requirements.push_back(Req);
3812PossibleRequiresExprInSimpleRequirement =
true;
3813}
else if(Tok.
is(tok::kw_typename)) {
3816TentativeParsingAction TPA(*
this);
3826 if(Tok.
is(tok::annot_cxxscope)) {
3829ConsumeAnnotationToken();
3832 if(Tok.
isOneOf(tok::identifier, tok::annot_template_id) &&
3838 if(Tok.
is(tok::identifier)) {
3842TemplateId = takeTemplateIdAnnotation(Tok);
3843ConsumeAnnotationToken();
3851Requirements.push_back(Req);
3868 if(!
Expression.isInvalid() && PossibleRequiresExprInSimpleRequirement)
3869 Diag(StartLoc, diag::err_requires_expr_in_simple_requirement)
3872Requirements.push_back(Req);
3878 if(Tok.
is(tok::kw_noexcept)) {
3879 Diag(Tok, diag::err_requires_expr_simple_requirement_noexcept)
3888 if(ExpectAndConsumeSemi(diag::err_expected_semi_requirement)) {
3894 if(Requirements.empty()) {
3905ParsingBodyDecl.complete(Body);
3907RequiresKWLoc, Body,
Parens.getOpenLocation(), LocalParameterDecls,
3908 Parens.getCloseLocation(), Requirements,
Braces.getCloseLocation());
3913 default: llvm_unreachable(
"Not a known type trait");
3914#define TYPE_TRAIT_1(Spelling, Name, Key) \ 3915case tok::kw_ ## Spelling: return UTT_ ## Name; 3916#define TYPE_TRAIT_2(Spelling, Name, Key) \ 3917case tok::kw_ ## Spelling: return BTT_ ## Name; 3918#include "clang/Basic/TokenKinds.def" 3919#define TYPE_TRAIT_N(Spelling, Name, Key) \ 3920 case tok::kw_ ## Spelling: return TT_ ## Name; 3921#include "clang/Basic/TokenKinds.def" 3928llvm_unreachable(
"Not a known array type trait");
3929#define ARRAY_TYPE_TRAIT(Spelling, Name, Key) \ 3930 case tok::kw_##Spelling: \ 3932#include "clang/Basic/TokenKinds.def" 3939llvm_unreachable(
"Not a known unary expression trait.");
3940#define EXPRESSION_TRAIT(Spelling, Name, Key) \ 3941 case tok::kw_##Spelling: \ 3943#include "clang/Basic/TokenKinds.def" 3964 if(
Parens.expectAndConsume())
3980 if(Tok.
is(tok::ellipsis)) {
3989Args.push_back(Ty.
get());
3992 if(
Parens.consumeClose())
4012 if(
T.expectAndConsume())
4024 caseATT_ArrayRank: {
4027 T.getCloseLocation());
4029 caseATT_ArrayExtent: {
4030 if(ExpectAndConsume(tok::comma)) {
4042 T.getCloseLocation());
4045llvm_unreachable(
"Invalid ArrayTypeTrait!");
4059 if(
T.expectAndConsume())
4067 T.getCloseLocation());
4075Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType,
4080assert(ExprType ==
CastExpr&&
"Compound literals are not ambiguous!");
4081assert(isTypeIdInParens() &&
"Not a type-id!");
4105ParenParseOption ParseAs;
4110 if(!ConsumeAndStoreUntil(tok::r_paren, Toks)) {
4116 if(Tok.
is(tok::l_brace)) {
4117ParseAs = CompoundLiteral;
4120 if(Tok.
is(tok::l_paren) &&
NextToken().is(tok::r_paren)) {
4121NotCastExpr =
true;
4127 Result= ParseCastExpression(AnyCastExpr,
4136ParseAs = NotCastExpr ? SimpleExpr :
CastExpr;
4145Toks.push_back(AttrEnd);
4148Toks.push_back(Tok);
4151PP.EnterTokenStream(Toks,
true,
4157 if(ParseAs >= CompoundLiteral) {
4164ParseSpecifierQualifierList(DS);
4165ParseDeclarator(DeclaratorInfo);
4176 if(ParseAs == CompoundLiteral) {
4177ExprType = CompoundLiteral;
4178 if(DeclaratorInfo.isInvalidType())
4182 returnParseCompoundLiteralExpression(Ty.
get(),
4190 if(DeclaratorInfo.isInvalidType())
4194 if(!
Result.isInvalid())
4196DeclaratorInfo, CastTy,
4202assert(ParseAs == SimpleExpr);
4204ExprType = SimpleExpr;
4206 if(!
Result.isInvalid() && Tok.
is(tok::r_paren))
4211 if(
Result.isInvalid()) {
4212 while(Tok.
isNot(tok::eof))
4231 if(
T.expectAndConsume(diag::err_expected_lparen_after,
"__builtin_bit_cast"))
4236ParseSpecifierQualifierList(DS);
4241ParseDeclarator(DeclaratorInfo);
4243 if(ExpectAndConsume(tok::comma)) {
4251 if(
T.consumeClose())
4254 if(
Operand.isInvalid() || DeclaratorInfo.isInvalidType())
4258 T.getCloseLocation());
Defines the clang::ASTContext interface.
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
static void addConstexprToLambdaDeclSpecifier(Parser &P, SourceLocation ConstexprLoc, DeclSpec &DS)
static void FixDigraph(Parser &P, Preprocessor &PP, Token &DigraphToken, Token &ColonToken, tok::TokenKind Kind, bool AtDigraph)
static ArrayTypeTrait ArrayTypeTraitFromTokKind(tok::TokenKind kind)
static void tryConsumeLambdaSpecifierToken(Parser &P, SourceLocation &MutableLoc, SourceLocation &StaticLoc, SourceLocation &ConstexprLoc, SourceLocation &ConstevalLoc, SourceLocation &DeclEndLoc)
static ExpressionTrait ExpressionTraitFromTokKind(tok::TokenKind kind)
static void addConstevalToLambdaDeclSpecifier(Parser &P, SourceLocation ConstevalLoc, DeclSpec &DS)
static TypeTrait TypeTraitFromTokKind(tok::TokenKind kind)
static void DiagnoseStaticSpecifierRestrictions(Parser &P, SourceLocation StaticLoc, SourceLocation MutableLoc, const LambdaIntroducer &Intro)
static int SelectDigraphErrorMessage(tok::TokenKind Kind)
static void addStaticToLambdaDeclSpecifier(Parser &P, SourceLocation StaticLoc, DeclSpec &DS)
Defines the PrettyStackTraceEntry class, which is used to make crashes give more contextual informati...
static constexpr bool isOneOf()
This file declares facilities that support code completion.
Defines the clang::TemplateNameKind enum.
Defines the clang::TokenKind enum and support functions.
const clang::PrintingPolicy & getPrintingPolicy() const
RAII class that helps handle the parsing of an open/close delimiter pair, such as braces { ....
SourceLocation getOpenLocation() const
SourceLocation getCloseLocation() const
Represents a C++ nested-name-specifier or a global scope specifier.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
SourceRange getRange() const
SourceLocation getBeginLoc() const
bool isSet() const
Deprecated.
void setEndLoc(SourceLocation Loc)
void SetInvalid(SourceRange R)
Indicate that this nested-name-specifier is invalid.
bool isEmpty() const
No scope specifier.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and restores it when destroyed.
void restore()
restore - This can be used to restore the state early, before the dtor is run.
Captures information about "declaration specifiers".
static const TST TST_typename
SourceLocation getEndLoc() const LLVM_READONLY
bool SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec and return false if there was no error.
static const TST TST_char8
static const TST TST_BFloat16
bool SetConstexprSpec(ConstexprSpecKind ConstexprKind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool SetTypeSpecWidth(TypeSpecifierWidth W, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec, but return true and ignore the request if ...
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceRange getSourceRange() const LLVM_READONLY
void SetRangeEnd(SourceLocation Loc)
bool SetBitIntType(SourceLocation KWLoc, Expr *BitWidth, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
static const TST TST_double
void SetRangeStart(SourceLocation Loc)
static const TST TST_char
static const TST TST_bool
static const TST TST_char16
static const TST TST_accum
static const TST TST_half
static const TST TST_ibm128
static const TST TST_float128
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Complex" (la...
static const TST TST_wchar
static const TST TST_void
static const TST TST_float
static const TST TST_fract
static const TST TST_float16
static const TST TST_decltype_auto
static const TST TST_error
static const TST TST_char32
static const TST TST_int128
bool SetTypeSpecSign(TypeSpecifierSign S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_auto
Decl - This represents one declaration (or definition), e.g.
SourceLocation getLocation() const
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Information about one declarator, including the parsed type information and the identifier.
RAII object that enters a new expression evaluation context.
This represents one expression.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart, unsigned Characters, const SourceManager &SM, const LangOptions &LangOpts)
AdvanceToTokenCharacter - If the current SourceLocation specifies a location at the start of a token,...
static SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset, const SourceManager &SM, const LangOptions &LangOpts)
Computes the source location just past the end of the token at this source location.
This represents a decl that may have a name.
static OpaquePtr make(QualType P)
RAII object that makes sure paren/bracket/brace count is correct after declaration/statement parsing,...
ParsedAttr - Represents a syntactic attribute.
static const ParsedAttributesView & none()
ParsedAttributes - A collection of parsed attributes.
Parser - This implements a parser for the C family of languages.
TypeResult ParseTypeName(SourceRange *Range=nullptr, DeclaratorContext Context=DeclaratorContext::TypeName, AccessSpecifier AS=AS_none, Decl **OwnedType=nullptr, ParsedAttributes *Attrs=nullptr)
ParseTypeName type-name: [C99 6.7.6] specifier-qualifier-list abstract-declarator[opt].
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
SourceLocation ConsumeToken()
ConsumeToken - Consume the current 'peek token' and lex the next one.
AttributeFactory & getAttrFactory()
static TypeResult getTypeAnnotation(const Token &Tok)
getTypeAnnotation - Read a parsed type out of an annotation token.
ExprResult ParseConstraintLogicalOrExpression(bool IsTrailingRequiresClause)
Parse a constraint-logical-or-expression.
bool ParseUnqualifiedId(CXXScopeSpec &SS, ParsedType ObjectType, bool ObjectHadErrors, bool EnteringContext, bool AllowDestructorName, bool AllowConstructorName, bool AllowDeductionGuide, SourceLocation *TemplateKWLoc, UnqualifiedId &Result)
Parse a C++ unqualified-id (or a C identifier), which describes the name of an entity.
bool TryAnnotateOptionalCXXScopeToken(bool EnteringContext=false)
SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok=false)
ConsumeAnyToken - Dispatch to the right Consume* method based on the current token type.
ExprResult ParseConstantExpression()
bool TryConsumeToken(tok::TokenKind Expected)
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Scope * getCurScope() const
OpaquePtr< TemplateName > TemplateTy
bool SkipUntil(tok::TokenKind T, SkipUntilFlags Flags=static_cast< SkipUntilFlags >(0))
SkipUntil - Read tokens until we get to the specified token, then consume it (unless StopBeforeMatch ...
ExprResult ParseAssignmentExpression(TypeCastState isTypeCast=NotTypeCast)
Parse an expr that doesn't include (top-level) commas.
const LangOptions & getLangOpts() const
ExprResult ParseExpression(TypeCastState isTypeCast=NotTypeCast)
Simple precedence-based parser for binary/ternary operators.
@ StopBeforeMatch
Stop skipping at specified token, but don't skip the token itself.
@ StopAtSemi
Stop skipping at semicolon.
const Token & NextToken()
NextToken - This peeks ahead one token and returns it without consuming it.
ExprResult ParseConstraintExpression()
Parse a constraint-expression.
RAII object used to inform the actions that we're currently parsing a declaration.
void enterTypeCast(SourceLocation Tok, QualType CastType)
Handles all type casts, including C-style cast, C++ casts, etc.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void EnterToken(const Token &Tok, bool IsReinject)
Enters a token in the token stream to be lexed next.
void AnnotateCachedTokens(const Token &Tok)
We notify the Preprocessor that if it is caching tokens (because backtrack is enabled) it should repl...
void Lex(Token &Result)
Lex the next token for this preprocessor.
const Token & LookAhead(unsigned N)
Peeks ahead N tokens and returns that token without consuming any tokens.
SourceManager & getSourceManager() const
void RevertCachedTokens(unsigned N)
When backtracking is enabled and tokens are cached, this allows to revert a specific number of tokens...
IdentifierTable & getIdentifierTable()
bool isCodeCompletionReached() const
Returns true if code-completion is enabled and we have hit the code-completion point.
SourceLocation getLastCachedTokenLocation() const
Get the location of the last cached token, suitable for setting the end location of an annotation tok...
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Computes the source location just past the end of the token at this source location.
If a crash happens while one of these objects are live, the message is printed out along with the spe...
A (possibly-)qualified type.
Represents the body of a requires-expression.
Scope - A scope is a transient data structure that is used while parsing the program.
@ FunctionPrototypeScope
This is a scope that corresponds to the parameters within a function prototype.
@ LambdaScope
This is the scope for a lambda, after the lambda introducer.
@ BlockScope
This is a scope that corresponds to a block/closure object.
@ ContinueScope
This is a while, do, for, which can have continue statements embedded into it.
@ BreakScope
This is a while, do, switch, for, etc that can have break statements embedded into it.
@ CompoundStmtScope
This is a compound statement scope.
@ FunctionDeclarationScope
This is a scope that corresponds to the parameters within a function prototype for a function declara...
@ FnScope
This indicates that the scope corresponds to a function, which means that labels are set here.
@ DeclScope
This is a scope that can contain a declaration.
void CodeCompleteObjCMessageReceiver(Scope *S)
void CodeCompleteOperatorName(Scope *S)
@ PCC_Condition
Code completion occurs within the condition of an if, while, switch, or for statement.
void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, bool AfterAmpersand)
QualType ProduceConstructorSignatureHelp(QualType Type, SourceLocation Loc, ArrayRef< Expr * > Args, SourceLocation OpenParLoc, bool Braced)
void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext, bool IsUsingDeclaration, QualType BaseType, QualType PreferredType)
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body)
ActOnLambdaExpr - This is called when the body of a lambda expression was successfully completed.
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, const IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No)
DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D)
ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a C++ if/switch/while/for statem...
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
@ Switch
An integral condition for a 'switch' statement.
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
void ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro, Scope *CurContext)
Once the Lambdas capture are known, we can start to create the closure, call operator method,...
concepts::Requirement * ActOnSimpleRequirement(Expr *E)
StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue=true)
concepts::Requirement * ActOnCompoundRequirement(Expr *E, SourceLocation NoexceptLoc)
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in:
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization, bool Disambiguation=false)
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E)
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ASTContext & getASTContext() const
bool isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS=nullptr)
isCurrentClassName - Determine whether the identifier II is the name of the class type currently bein...
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary type trait support pseudo-functions.
void ActOnFinishRequiresExpr()
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
ExprResult ActOnNameClassifiedAsNonType(Scope *S, const CXXScopeSpec &SS, NamedDecl *Found, SourceLocation NameLoc, const Token &NextToken)
Act on the result of classifying a name as a specific non-type declaration.
ExprResult ActOnBuiltinBitCastExpr(SourceLocation KWLoc, Declarator &Dcl, ExprResult Operand, SourceLocation RParenLoc)
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id, bool IsUDSuffix)
ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr, ConditionKind CK, bool MissingOK=false)
sema::LambdaScopeInfo * PushLambdaScope()
SemaCodeCompletion & CodeCompletion()
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Declarator &ParamInfo, const DeclSpec &DS)
ActOnStartOfLambdaDefinition - This is called just before we start parsing the body of a lambda; it a...
void ActOnLambdaClosureParameters(Scope *LambdaScope, MutableArrayRef< DeclaratorChunk::ParamInfo > ParamInfo)
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenOrBraceLoc, MultiExprArg Exprs, SourceLocation RParenOrBraceLoc, bool ListInitialization)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
ExprResult ActOnRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation ClosingBraceLoc)
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, Declarator &D, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, Expr *E, SourceLocation RParenLoc)
ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const,addrspace}_cast's.
ExprResult ActOnPackIndexingExpr(Scope *S, Expr *PackExpression, SourceLocation EllipsisLoc, SourceLocation LSquareLoc, Expr *IndexExpr, SourceLocation RSquareLoc)
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
Parsed a C++ 'new' expression (C++ 5.3.4).
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.
TemplateNameKind ActOnTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a template name from a name that is syntactically required to name a template,...
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
SourceManager & getSourceManager() const
void ActOnLambdaExplicitTemplateParameterList(LambdaIntroducer &Intro, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > TParams, SourceLocation RAngleLoc, ExprResult RequiresClause)
This is called after parsing the explicit template parameter list on a lambda (if it exists) in C++2a...
bool ActOnCXXNestedNameSpecifierIndexedPack(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc, QualType Type)
ParsedType actOnLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init)
Perform initialization analysis of the init-capture and perform any implicit conversions such as an l...
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
ExprResult ActOnNameClassifiedAsUndeclaredNonType(IdentifierInfo *Name, SourceLocation NameLoc)
Act on the result of classifying a name as an undeclared (ADL-only) non-type declaration.
TypeResult ActOnTypeName(Declarator &D)
void ActOnLambdaClosureQualifiers(LambdaIntroducer &Intro, SourceLocation MutableLoc)
void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, bool IsInstantiation=false)
ActOnLambdaError - If there is an error parsing a lambda, this callback is invoked to pop the informa...
concepts::Requirement * ActOnTypeRequirement(SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc, const IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId)
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
ExprResult ActOnRequiresClause(ExprResult ConstraintExpr)
RequiresExprBodyDecl * ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, ArrayRef< ParmVarDecl * > LocalParameters, Scope *BodyScope)
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
void RecordParsingTemplateParameterDepth(unsigned Depth)
This is used to inform Sema what the current TemplateParameterDepth is during Parsing.
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, CXXScopeSpec &SS, ParsedTemplateTy *Template=nullptr)
Determine whether a particular identifier might be the name in a C++1z deduction-guide declaration.
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
QualType ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc)
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
ParsedType getConstructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, bool EnteringContext)
ExprResult ActOnNameClassifiedAsDependentNonType(const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, bool IsAddressOfOperand)
Act on the result of classifying a name as an undeclared member of a dependent base class.
concepts::Requirement * ActOnNestedRequirement(Expr *Constraint)
static ConditionResult ConditionError()
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
ExprResult ActOnCXXThis(SourceLocation Loc)
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
void setBegin(SourceLocation b)
SourceLocation getEnd() const
SourceLocation getBegin() const
void setEnd(SourceLocation e)
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteralParser - This decodes string escape characters and performs wide string analysis and Tra...
Represents a C++ template name within the type system.
Token - This structure provides full information about a lexed token.
IdentifierInfo * getIdentifierInfo() const
void setAnnotationEndLoc(SourceLocation L)
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
const char * getName() const
unsigned getLength() const
void setLength(unsigned Len)
void setKind(tok::TokenKind K)
SourceLocation getAnnotationEndLoc() const
bool is(tok::TokenKind K) const
is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {....
void * getAnnotationValue() const
tok::TokenKind getKind() const
bool isRegularKeywordAttribute() const
Return true if the token is a keyword that is parsed in the same position as a standard attribute,...
void setEofData(const void *D)
SourceRange getAnnotationRange() const
SourceRange of the group of tokens that this annotation token represents.
void setLocation(SourceLocation L)
bool hasLeadingEmptyMacro() const
Return true if this token has an empty macro before it.
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const
bool isNot(tok::TokenKind K) const
const void * getEofData() const
void startToken()
Reset all flags to cleared.
The base class of the type hierarchy.
QualType getCanonicalTypeInternal() const
Represents a C++ unqualified-id that has been parsed.
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
A static requirement that can be used in a requires-expression to check properties of types and expre...
uint32_t Literal
Literals are represented as positive integers.
@ After
Like System, but searched after the system directories.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
ArrayTypeTrait
Names for the array type traits.
LambdaCaptureKind
The different capture forms in a lambda introducer.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_StarThis
Capturing the *this object by copy.
@ LCK_This
Capturing the *this object by reference.
@ IK_ConstructorName
A constructor name.
@ IK_LiteralOperatorId
A user-defined literal name, e.g., operator "" _i.
@ IK_Identifier
An identifier.
@ IK_DestructorName
A destructor name.
@ IK_OperatorFunctionId
An overloaded operator name, e.g., operator+.
@ CopyInit
[a = b], [a = {b}]
@ Result
The result type of a method or function.
ActionResult< Expr * > ExprResult
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
@ TNK_Dependent_template_name
The name refers to a dependent template name:
@ TNK_Function_template
The name refers to a function template or a set of overloaded functions that includes at least one fu...
@ TNK_Non_template
The name does not refer to a template.
@ TNK_Undeclared_template
Lookup for the name failed, but we're assuming it was a template name anyway.
const FunctionProtoType * T
const char * getOperatorSpelling(OverloadedOperatorKind Operator)
Retrieve the spelling of the given overloaded operator, without the preceding "operator" keyword.
TypeTrait
Names for traits that operate specifically on types.
@ Parens
New-expression has a C++98 paren-delimited initializer.
@ Braces
New-expression has a C++11 list-initializer.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_None
no exception specification
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, ArrayRef< NamedDecl * > DeclsInPrototype, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult(), SourceLocation TrailingReturnTypeLoc=SourceLocation(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
static DeclaratorChunk getArray(unsigned TypeQuals, bool isStatic, bool isStar, Expr *NumElts, SourceLocation LBLoc, SourceLocation RBLoc)
Return a DeclaratorChunk for an array.
Represents a complete lambda introducer.
bool hasLambdaCapture() const
void addCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange)
Append a capture in a lambda introducer.
SourceLocation DefaultLoc
LambdaCaptureDefault Default
Describes how types, statements, expressions, and declarations should be printed.
Keeps information about an identifier in a nested-name-spec.
Information about a template-id annotation token.
const IdentifierInfo * Name
FIXME: Temporarily stores the name of a specialization.
unsigned NumArgs
NumArgs - The number of template arguments.
SourceLocation TemplateNameLoc
TemplateNameLoc - The location of the template name within the source.
ParsedTemplateArgument * getTemplateArgs()
Retrieves a pointer to the template arguments.
SourceLocation RAngleLoc
The location of the '>' after the template argument list.
SourceLocation LAngleLoc
The location of the '<' before the template argument list.
SourceLocation TemplateKWLoc
TemplateKWLoc - The location of the template keyword.
ParsedTemplateTy Template
The declaration of the template corresponding to the template-name.
static TemplateIdAnnotation * Create(SourceLocation TemplateKWLoc, SourceLocation TemplateNameLoc, const IdentifierInfo *Name, OverloadedOperatorKind OperatorKind, ParsedTemplateTy OpaqueTemplateName, TemplateNameKind TemplateKind, SourceLocation LAngleLoc, SourceLocation RAngleLoc, ArrayRef< ParsedTemplateArgument > TemplateArgs, bool ArgsInvalid, SmallVectorImpl< TemplateIdAnnotation * > &CleanupList)
Creates a new TemplateIdAnnotation with NumArgs arguments and appends it to List.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4