37#include "llvm/ADT/SmallVector.h"
131 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
142 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
149Parser::ParseExpressionWithLeadingExtension(
SourceLocation ExtLoc) {
155 LHS = ParseCastExpression(AnyCastExpr);
158 if (!LHS.isInvalid())
162 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
167 if (Tok.
is(tok::code_completion)) {
174 if (Tok.
is(tok::kw_throw))
175 return ParseThrowExpression();
176 if (Tok.
is(tok::kw_co_yield))
177 return ParseCoyieldExpression();
179 ExprResult LHS = ParseCastExpression(AnyCastExpr,
186 if (Tok.
is(tok::code_completion)) {
208Parser::ParseAssignmentExprWithObjCMessageExprStart(
SourceLocation LBracLoc,
211 Expr *ReceiverExpr) {
213 = ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
214 ReceiverType, ReceiverExpr);
215 R = ParsePostfixExpressionSuffix(R);
223 "Call this function only if your ExpressionEvaluationContext is "
224 "already ConstantEvaluated");
225 ExprResult LHS(ParseCastExpression(AnyCastExpr,
false, isTypeCast));
245 Actions.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
266 ExprResult LHS(ParseCastExpression(AnyCastExpr));
288 bool NotPrimaryExpression =
false;
289 auto ParsePrimary = [&] () {
290 ExprResult E = ParseCastExpression(PrimaryExprOnly,
294 &NotPrimaryExpression);
298 E = ParsePostfixExpressionSuffix(E);
305 ? diag::note_unparenthesized_non_primary_expr_in_requires_clause
306 : diag::err_unparenthesized_non_primary_expr_in_requires_clause)
314 if (NotPrimaryExpression ||
321 Tok.
isOneOf(tok::period, tok::plusplus, tok::minusminus) ||
322 (Tok.
is(tok::l_square) && !
NextToken().is(tok::l_square))) {
323 E = RecoverFromNonPrimary(E,
false);
326 NotPrimaryExpression =
false;
328 bool PossibleNonPrimary;
329 bool IsConstraintExpr =
331 IsTrailingRequiresClause);
332 if (!IsConstraintExpr || PossibleNonPrimary) {
337 if (PossibleNonPrimary)
338 E = RecoverFromNonPrimary(E, !IsConstraintExpr);
347 while (Tok.
is(tok::ampamp)) {
355 tok::ampamp, LHS.
get(), RHS.
get());
381 while (Tok.
is(tok::pipepipe)) {
390 tok::pipepipe, LHS.
get(), RHS.
get());
401bool Parser::isNotExpressionStart() {
403 if (K == tok::l_brace || K == tok::r_brace ||
404 K == tok::kw_for || K == tok::kw_while ||
405 K == tok::kw_if || K == tok::kw_else ||
406 K == tok::kw_goto || K == tok::kw_try)
409 return isKnownToBeDeclarationSpecifier();
412bool Parser::isFoldOperator(
prec::Level Level)
const {
426 GreaterThanIsOperator,
430 auto SavedType = PreferredType;
433 PreferredType = SavedType;
437 if (NextTokPrec < MinPrec)
444 if (OpToken.
is(tok::caretcaret)) {
445 return ExprError(
Diag(Tok, diag::err_opencl_logical_exclusive_or));
450 if (OpToken.
isOneOf(tok::comma, tok::greater, tok::greatergreater,
451 tok::greatergreatergreater) &&
452 checkPotentialAngleBracketDelimiter(OpToken))
460 if (OpToken.
is(tok::comma) && isNotExpressionStart()) {
468 if (isFoldOperator(NextTokPrec) && Tok.
is(tok::ellipsis)) {
482 Tok.
isOneOf(tok::colon, tok::r_square) &&
495 TernaryMiddle = ParseBraceInitializer();
496 if (!TernaryMiddle.isInvalid()) {
497 Diag(BraceLoc, diag::err_init_list_bin_op)
502 }
else if (Tok.
isNot(tok::colon)) {
514 TernaryMiddle =
nullptr;
515 Diag(Tok, diag::ext_gnu_conditional_expr);
518 if (TernaryMiddle.isInvalid()) {
521 TernaryMiddle =
nullptr;
530 const char *FIText =
": ";
534 bool IsInvalid =
false;
535 const char *SourcePtr =
537 if (!IsInvalid && *SourcePtr ==
' ') {
540 if (!IsInvalid && *SourcePtr ==
' ') {
547 Diag(Tok, diag::err_expected)
549 Diag(OpToken, diag::note_matching) << tok::question;
567 bool RHSIsInitList =
false;
569 RHS = ParseBraceInitializer();
570 RHSIsInitList =
true;
574 RHS = ParseCastExpression(AnyCastExpr);
580 if (TernaryMiddle.isUsable())
597 if (ThisPrec < NextTokPrec ||
598 (ThisPrec == NextTokPrec && isRightAssoc)) {
600 Diag(Tok, diag::err_init_list_bin_op)
609 RHS = ParseRHSOfBinaryExpression(RHS,
610 static_cast<prec::Level>(ThisPrec + !isRightAssoc));
611 RHSIsInitList =
false;
617 if (TernaryMiddle.isUsable())
628 Diag(OpToken, diag::warn_cxx98_compat_generalized_initializer_lists)
630 }
else if (ColonLoc.
isValid()) {
631 Diag(ColonLoc, diag::err_init_list_bin_op)
636 Diag(OpToken, diag::err_init_list_bin_op)
646 if (TernaryMiddle.isInvalid()) {
650 if (!GreaterThanIsOperator && OpToken.
is(tok::greatergreater))
652 diag::warn_cxx11_right_shift_in_template_arg,
662 {LHS.get(), RHS.get()});
670 std::vector<clang::Expr *> Args;
672 if (TernaryMiddle.get())
673 Args = {LHS.
get(), TernaryMiddle.get(), RHS.
get()};
675 Args = {LHS.
get(), RHS.
get()};
703ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
704 bool isAddressOfOperand,
705 TypeCastState isTypeCast,
706 bool isVectorLiteral,
707 bool *NotPrimaryExpression) {
709 ExprResult Res = ParseCastExpression(ParseKind,
714 NotPrimaryExpression);
716 Diag(Tok, diag::err_expected_expression);
723 CastExpressionIdValidator(
Token Next,
bool AllowTypes,
bool AllowNonTypes)
724 : NextToken(Next), AllowNonTypes(AllowNonTypes) {
725 WantTypeSpecifiers = WantFunctionLikeCasts = AllowTypes;
728 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
733 if (isa<TypeDecl>(ND))
734 return WantTypeSpecifiers;
739 if (!NextToken.isOneOf(tok::equal, tok::arrow, tok::period))
742 for (
auto *
C : candidate) {
744 if (isa<ValueDecl>(ND) && !isa<FunctionDecl>(ND))
750 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
751 return std::make_unique<CastExpressionIdValidator>(*
this);
943ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
944 bool isAddressOfOperand,
946 TypeCastState isTypeCast,
947 bool isVectorLiteral,
948 bool *NotPrimaryExpression) {
951 auto SavedType = PreferredType;
957 bool AllowSuffix =
true;
973 ParenParseOption ParenExprType;
975 case CastParseKind::UnaryExprOnly:
978 case CastParseKind::AnyCastExpr:
979 ParenExprType = ParenParseOption::CastExpr;
981 case CastParseKind::PrimaryExprOnly:
982 ParenExprType = FoldExpr;
987 Res = ParseParenExpression(ParenExprType,
false,
996 switch (ParenExprType) {
997 case SimpleExpr:
break;
999 case CompoundLiteral:
1017 case tok::numeric_constant:
1027 Res = ParseCXXBoolLiteral();
1030 case tok::kw___objc_yes:
1031 case tok::kw___objc_no:
1032 Res = ParseObjCBoolLiteral();
1035 case tok::kw_nullptr:
1037 Diag(Tok, diag::warn_cxx98_compat_nullptr);
1040 : diag::ext_c_nullptr) << Tok.
getName();
1045 case tok::annot_primary_expr:
1046 case tok::annot_overload_set:
1047 Res = getExprAnnotation(Tok);
1050 ConsumeAnnotationToken();
1052 checkPotentialAngleBracket(Res);
1055 case tok::annot_non_type:
1056 case tok::annot_non_type_dependent:
1057 case tok::annot_non_type_undeclared: {
1060 Res = tryParseCXXIdExpression(SS, isAddressOfOperand, Replacement);
1062 "should not perform typo correction on annotation token");
1066 case tok::kw___super:
1067 case tok::kw_decltype:
1071 assert(Tok.
isNot(tok::kw_decltype) && Tok.
isNot(tok::kw___super));
1072 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1073 isVectorLiteral, NotPrimaryExpression);
1075 case tok::identifier:
1086 if (Next.is(tok::ellipsis) && Tok.
is(tok::identifier) &&
1087 GetLookAheadToken(2).is(tok::l_square)) {
1092 Tok.
is(tok::annot_pack_indexing_type))
1093 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1094 isVectorLiteral, NotPrimaryExpression);
1100 else if (Next.is(tok::l_paren) && Tok.
is(tok::identifier) &&
1104 if (RevertibleTypeTraits.empty()) {
1105#define RTT_JOIN(X,Y) X##Y
1106#define REVERTIBLE_TYPE_TRAIT(Name) \
1107 RevertibleTypeTraits[PP.getIdentifierInfo(#Name)] \
1108 = RTT_JOIN(tok::kw_,Name)
1169#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
1170 REVERTIBLE_TYPE_TRAIT(RTT_JOIN(__, Trait));
1171#include "clang/Basic/TransformTypeTraits.def"
1172#undef REVERTIBLE_TYPE_TRAIT
1179 llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind>::iterator Known
1180 = RevertibleTypeTraits.find(II);
1181 if (Known != RevertibleTypeTraits.end()) {
1183 return ParseCastExpression(ParseKind, isAddressOfOperand,
1184 NotCastExpr, isTypeCast,
1185 isVectorLiteral, NotPrimaryExpression);
1189 else if ((!ColonIsSacred && Next.is(tok::colon)) ||
1190 Next.isOneOf(tok::coloncolon, tok::less, tok::l_paren,
1195 if (!Tok.
is(tok::identifier))
1196 return ParseCastExpression(ParseKind, isAddressOfOperand,
1197 NotCastExpr, isTypeCast,
1199 NotPrimaryExpression);
1212 (&II == Ident_super &&
getCurScope()->isInObjcMethodScope()))) {
1215 if (Tok.
is(tok::code_completion) && &II != Ident_super) {
1218 getCurScope(), II, ILoc, ExprStatementTokLoc == ILoc);
1222 if (Tok.
isNot(tok::identifier) &&
1224 Diag(Tok, diag::err_expected_property_name);
1239 if (
getLangOpts().
ObjC && &II == Ident_super && !InMessageExpression &&
1241 ((Tok.
is(tok::identifier) &&
1243 Tok.
is(tok::code_completion))) {
1244 Res = ParseObjCMessageExpressionBody(
SourceLocation(), ILoc,
nullptr,
1255 ((Tok.
is(tok::identifier) && !InMessageExpression) ||
1256 Tok.
is(tok::code_completion))) {
1258 if (Tok.
is(tok::code_completion) ||
1259 Next.is(tok::colon) || Next.is(tok::r_square))
1261 if (Typ.get()->isObjCObjectOrInterfaceType()) {
1264 DS.SetRangeStart(ILoc);
1265 DS.SetRangeEnd(ILoc);
1266 const char *PrevSpec =
nullptr;
1268 DS.SetTypeSpecType(
TST_typename, ILoc, PrevSpec, DiagID, Typ,
1285 if (isAddressOfOperand && isPostfixExpressionSuffixStart())
1286 isAddressOfOperand =
false;
1295 CastExpressionIdValidator Validator(
1299 Validator.IsAddressOfOperand = isAddressOfOperand;
1300 if (Tok.
isOneOf(tok::periodstar, tok::arrowstar)) {
1301 Validator.WantExpressionKeywords =
false;
1302 Validator.WantRemainingKeywords =
false;
1304 Validator.WantRemainingKeywords = Tok.
isNot(tok::r_paren);
1306 Name.setIdentifier(&II, ILoc);
1308 getCurScope(), ScopeSpec, TemplateKWLoc, Name, Tok.
is(tok::l_paren),
1309 isAddressOfOperand, &Validator,
1311 Tok.
is(tok::r_paren) ?
nullptr : &Replacement);
1313 UnconsumeToken(Replacement);
1314 return ParseCastExpression(ParseKind, isAddressOfOperand,
1315 NotCastExpr, isTypeCast,
1317 NotPrimaryExpression);
1319 Res = tryParseCXXPackIndexingExpression(Res);
1321 checkPotentialAngleBracket(Res);
1324 case tok::char_constant:
1325 case tok::wide_char_constant:
1326 case tok::utf8_char_constant:
1327 case tok::utf16_char_constant:
1328 case tok::utf32_char_constant:
1332 case tok::kw___func__:
1333 case tok::kw___FUNCTION__:
1334 case tok::kw___FUNCDNAME__:
1335 case tok::kw___FUNCSIG__:
1336 case tok::kw_L__FUNCTION__:
1337 case tok::kw_L__FUNCSIG__:
1338 case tok::kw___PRETTY_FUNCTION__:
1350 case tok::string_literal:
1351 case tok::wide_string_literal:
1352 case tok::utf8_string_literal:
1353 case tok::utf16_string_literal:
1354 case tok::utf32_string_literal:
1357 case tok::kw__Generic:
1358 Res = ParseGenericSelectionExpression();
1360 case tok::kw___builtin_available:
1361 Res = ParseAvailabilityCheckExpr(Tok.
getLocation());
1363 case tok::kw___builtin_va_arg:
1364 case tok::kw___builtin_offsetof:
1365 case tok::kw___builtin_choose_expr:
1366 case tok::kw___builtin_astype:
1367 case tok::kw___builtin_convertvector:
1368 case tok::kw___builtin_COLUMN:
1369 case tok::kw___builtin_FILE:
1370 case tok::kw___builtin_FILE_NAME:
1371 case tok::kw___builtin_FUNCTION:
1372 case tok::kw___builtin_FUNCSIG:
1373 case tok::kw___builtin_LINE:
1374 case tok::kw___builtin_source_location:
1375 if (NotPrimaryExpression)
1376 *NotPrimaryExpression =
true;
1378 return ParseBuiltinPrimaryExpression();
1379 case tok::kw___null:
1384 case tok::minusminus: {
1385 if (NotPrimaryExpression)
1386 *NotPrimaryExpression =
true;
1391 Token SavedTok = Tok;
1400 UnaryExprOnly : AnyCastExpr,
1407 UnconsumeToken(SavedTok);
1421 if (NotPrimaryExpression)
1422 *NotPrimaryExpression =
true;
1427 Res = ParseCastExpression(AnyCastExpr,
true);
1443 case tok::kw___real:
1444 case tok::kw___imag: {
1445 if (NotPrimaryExpression)
1446 *NotPrimaryExpression =
true;
1449 Res = ParseCastExpression(AnyCastExpr);
1453 isAddressOfOperand);
1460 case tok::kw_co_await: {
1461 if (NotPrimaryExpression)
1462 *NotPrimaryExpression =
true;
1464 Res = ParseCastExpression(AnyCastExpr);
1470 case tok::kw___extension__:{
1472 if (NotPrimaryExpression)
1473 *NotPrimaryExpression =
true;
1476 Res = ParseCastExpression(AnyCastExpr);
1481 case tok::kw__Alignof:
1482 diagnoseUseOfC11Keyword(Tok);
1484 case tok::kw_alignof:
1485 case tok::kw___alignof:
1487 case tok::kw_sizeof:
1491 case tok::kw___datasizeof:
1492 case tok::kw_vec_step:
1494 case tok::kw___builtin_omp_required_simd_align:
1495 case tok::kw___builtin_vectorelements:
1496 if (NotPrimaryExpression)
1497 *NotPrimaryExpression =
true;
1498 AllowSuffix =
false;
1499 Res = ParseUnaryExprOrTypeTraitExpression();
1502 if (NotPrimaryExpression)
1503 *NotPrimaryExpression =
true;
1505 if (Tok.
isNot(tok::identifier))
1506 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
1509 return ExprError(
Diag(Tok, diag::err_address_of_label_outside_fn));
1511 Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
1516 AllowSuffix =
false;
1519 case tok::kw_const_cast:
1520 case tok::kw_dynamic_cast:
1521 case tok::kw_reinterpret_cast:
1522 case tok::kw_static_cast:
1523 case tok::kw_addrspace_cast:
1524 if (NotPrimaryExpression)
1525 *NotPrimaryExpression =
true;
1526 Res = ParseCXXCasts();
1528 case tok::kw___builtin_bit_cast:
1529 if (NotPrimaryExpression)
1530 *NotPrimaryExpression =
true;
1531 Res = ParseBuiltinBitCast();
1533 case tok::kw_typeid:
1534 if (NotPrimaryExpression)
1535 *NotPrimaryExpression =
true;
1536 Res = ParseCXXTypeid();
1538 case tok::kw___uuidof:
1539 if (NotPrimaryExpression)
1540 *NotPrimaryExpression =
true;
1541 Res = ParseCXXUuidof();
1544 Res = ParseCXXThis();
1546 case tok::kw___builtin_sycl_unique_stable_name:
1547 Res = ParseSYCLUniqueStableNameExpression();
1550 case tok::annot_typename:
1551 if (isStartOfObjCClassMessageMissingOpenBracket()) {
1559 const char *PrevSpec =
nullptr;
1562 PrevSpec, DiagID,
Type,
1571 ConsumeAnnotationToken();
1578 case tok::annot_decltype:
1579 case tok::annot_pack_indexing_type:
1581 case tok::kw_wchar_t:
1582 case tok::kw_char8_t:
1583 case tok::kw_char16_t:
1584 case tok::kw_char32_t:
1589 case tok::kw___int64:
1590 case tok::kw___int128:
1591 case tok::kw__ExtInt:
1592 case tok::kw__BitInt:
1593 case tok::kw_signed:
1594 case tok::kw_unsigned:
1597 case tok::kw_double:
1598 case tok::kw___bf16:
1599 case tok::kw__Float16:
1600 case tok::kw___float128:
1601 case tok::kw___ibm128:
1604 case tok::kw_typename:
1605 case tok::kw_typeof:
1606 case tok::kw___vector:
1607 case tok::kw__Accum:
1608 case tok::kw__Fract:
1610#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:
1611#include "clang/Basic/OpenCLImageTypes.def"
1614 Diag(Tok, diag::err_expected_expression);
1619 if (NotPrimaryExpression)
1620 *NotPrimaryExpression =
true;
1622 if (SavedKind == tok::kw_typename) {
1639 ParseCXXSimpleTypeSpecifier(DS);
1640 if (Tok.
isNot(tok::l_paren) &&
1642 return ExprError(
Diag(Tok, diag::err_expected_lparen_after_type)
1643 << DS.getSourceRange());
1645 if (Tok.
is(tok::l_brace))
1646 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1648 Res = ParseCXXTypeConstructExpression(DS);
1652 case tok::annot_cxxscope: {
1657 if (!Tok.
is(tok::annot_cxxscope))
1658 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1659 isTypeCast, isVectorLiteral,
1660 NotPrimaryExpression);
1663 if (Next.is(tok::annot_template_id)) {
1670 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
1674 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1675 isTypeCast, isVectorLiteral,
1676 NotPrimaryExpression);
1681 Res = ParseCXXIdExpression(isAddressOfOperand);
1685 case tok::annot_template_id: {
1693 return ParseCastExpression(ParseKind, isAddressOfOperand,
1694 NotCastExpr, isTypeCast, isVectorLiteral,
1695 NotPrimaryExpression);
1702 case tok::kw_operator:
1703 Res = ParseCXXIdExpression(isAddressOfOperand);
1706 case tok::coloncolon: {
1711 if (!Tok.
is(tok::coloncolon))
1712 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1713 isVectorLiteral, NotPrimaryExpression);
1718 if (Tok.
is(tok::kw_new)) {
1719 if (NotPrimaryExpression)
1720 *NotPrimaryExpression =
true;
1721 Res = ParseCXXNewExpression(
true, CCLoc);
1722 AllowSuffix =
false;
1725 if (Tok.
is(tok::kw_delete)) {
1726 if (NotPrimaryExpression)
1727 *NotPrimaryExpression =
true;
1728 Res = ParseCXXDeleteExpression(
true, CCLoc);
1729 AllowSuffix =
false;
1734 Diag(CCLoc, diag::err_expected_expression);
1739 if (NotPrimaryExpression)
1740 *NotPrimaryExpression =
true;
1741 Res = ParseCXXNewExpression(
false, Tok.
getLocation());
1742 AllowSuffix =
false;
1745 case tok::kw_delete:
1746 if (NotPrimaryExpression)
1747 *NotPrimaryExpression =
true;
1748 Res = ParseCXXDeleteExpression(
false, Tok.
getLocation());
1749 AllowSuffix =
false;
1752 case tok::kw_requires:
1753 Res = ParseRequiresExpression();
1754 AllowSuffix =
false;
1757 case tok::kw_noexcept: {
1758 if (NotPrimaryExpression)
1759 *NotPrimaryExpression =
true;
1760 Diag(Tok, diag::warn_cxx98_compat_noexcept_expr);
1764 if (
T.expectAndConsume(diag::err_expected_lparen_after,
"noexcept"))
1777 T.getCloseLocation());
1778 AllowSuffix =
false;
1782#define TYPE_TRAIT(N,Spelling,K) \
1783 case tok::kw_##Spelling:
1784#include "clang/Basic/TokenKinds.def"
1785 Res = ParseTypeTrait();
1788 case tok::kw___array_rank:
1789 case tok::kw___array_extent:
1790 if (NotPrimaryExpression)
1791 *NotPrimaryExpression =
true;
1792 Res = ParseArrayTypeTrait();
1795 case tok::kw___is_lvalue_expr:
1796 case tok::kw___is_rvalue_expr:
1797 if (NotPrimaryExpression)
1798 *NotPrimaryExpression =
true;
1799 Res = ParseExpressionTrait();
1803 if (NotPrimaryExpression)
1804 *NotPrimaryExpression =
true;
1806 return ParseObjCAtExpression(AtLoc);
1809 Res = ParseBlockLiteralExpression();
1811 case tok::code_completion: {
1817#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait:
1818#include "clang/Basic/TransformTypeTraits.def"
1823 Diag(Tok, diag::ext_keyword_as_ident)
1825 goto ParseIdentifier;
1827 goto ExpectedExpression;
1836 Res = TryParseLambdaExpression();
1840 if (NotPrimaryExpression)
1841 *NotPrimaryExpression =
true;
1842 Res = ParseObjCMessageExpression();
1846 Res = ParseLambdaExpression();
1850 Res = ParseObjCMessageExpression();
1864 if (ParseKind == PrimaryExprOnly)
1879 case tok::minusminus:
1897 Diag(Tok.
getLocation(), diag::err_postfix_after_unary_requires_parens)
1905 PreferredType = SavedType;
1906 Res = ParsePostfixExpressionSuffix(Res);
1908 !
getActions().getOpenCLOptions().isAvailableOption(
1910 if (
Expr *PostfixExpr = Res.
get()) {
1911 QualType Ty = PostfixExpr->getType();
1913 Diag(PostfixExpr->getExprLoc(),
1914 diag::err_opencl_taking_function_address_parser);
1944Parser::ParsePostfixExpressionSuffix(
ExprResult LHS) {
1948 auto SavedType = PreferredType;
1951 PreferredType = SavedType;
1953 case tok::code_completion:
1954 if (InMessageExpression)
1962 case tok::identifier:
1969 nullptr, LHS.
get());
1977 case tok::l_square: {
1985 isSimpleObjCMessageExpression())
1990 if (CheckProhibitedCXX11Attribute()) {
1996 Loc =
T.getOpenLocation();
1999 ExprVector ArgExprs;
2000 bool HasError =
false;
2007 if ((!
getLangOpts().OpenMP && !AllowOpenACCArraySections) ||
2008 Tok.
isNot(tok::colon)) {
2012 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
2013 Idx = ParseBraceInitializer();
2022 ArgExprs.push_back(Idx.
get());
2024 }
else if (Tok.
isNot(tok::r_square)) {
2025 if (ParseExpressionList(ArgExprs)) {
2036 if (ArgExprs.size() <= 1 && AllowOpenACCArraySections) {
2038 if (Tok.
is(tok::colon)) {
2043 }
else if (ArgExprs.size() <= 1 &&
getLangOpts().OpenMP) {
2045 if (Tok.
is(tok::colon)) {
2048 if (Tok.
isNot(tok::r_square) &&
2056 (OMPClauseKind == llvm::omp::Clause::OMPC_to ||
2057 OMPClauseKind == llvm::omp::Clause::OMPC_from) &&
2058 Tok.
is(tok::colon)) {
2061 if (Tok.
isNot(tok::r_square)) {
2070 if (!LHS.
isInvalid() && !HasError && !Length.isInvalid() &&
2080 LHS.
get(), Loc, ArgExprs.empty() ?
nullptr : ArgExprs[0],
2081 ColonLocFirst, ColonLocSecond, Length.get(), Stride.
get(), RLoc);
2096 case tok::lesslessless: {
2101 Expr *ExecConfig =
nullptr;
2105 if (OpKind == tok::lesslessless) {
2106 ExprVector ExecConfigExprs;
2109 if (ParseSimpleExpressionList(ExecConfigExprs)) {
2120 Diag(Tok, diag::err_expected) << tok::greatergreatergreater;
2121 Diag(OpenLoc, diag::note_matching) << tok::lesslessless;
2127 if (ExpectAndConsume(tok::l_paren))
2130 Loc = PrevTokLocation;
2135 getCurScope(), OpenLoc, ExecConfigExprs, CloseLoc);
2139 ExecConfig = ECResult.
get();
2143 Loc = PT.getOpenLocation();
2146 ExprVector ArgExprs;
2147 auto RunSignatureHelp = [&]() ->
QualType {
2149 LHS.
get(), ArgExprs, PT.getOpenLocation());
2150 CalledSignatureHelp =
true;
2151 return PreferredType;
2153 if (OpKind == tok::l_paren || !LHS.
isInvalid()) {
2154 if (Tok.
isNot(tok::r_paren)) {
2155 if (ParseExpressionList(ArgExprs, [&] {
2156 PreferredType.enterFunctionArgument(Tok.
getLocation(),
2168 for (
auto &E : ArgExprs)
2177 }
else if (Tok.
isNot(tok::r_paren)) {
2178 bool HadDelayedTypo =
false;
2180 HadDelayedTypo =
true;
2181 for (
auto &E : ArgExprs)
2183 HadDelayedTypo =
true;
2198 ArgExprs.insert(ArgExprs.begin(), Fn);
2216 bool MayBePseudoDestructor =
false;
2219 PreferredType.enterMemAccess(Actions, Tok.
getLocation(), OrigLHS);
2223 const Type* BaseType =
Base->getType().getTypePtrOrNull();
2224 if (BaseType && Tok.
is(tok::l_paren) &&
2227 Diag(OpLoc, diag::err_function_is_not_record)
2228 << OpKind <<
Base->getSourceRange()
2230 return ParsePostfixExpressionSuffix(
Base);
2235 MayBePseudoDestructor);
2240 if (Tok.
is(tok::code_completion)) {
2246 ParseOptionalCXXScopeSpecifier(
2248 false, &MayBePseudoDestructor);
2250 ObjectType =
nullptr;
2253 if (Tok.
is(tok::code_completion)) {
2255 OpKind == tok::arrow ? tok::period : tok::arrow;
2262 getCurScope(), OrigLHS, OpLoc, CorrectedOpKind, ObjectType,
2263 MayBePseudoDestructor);
2267 Expr *CorrectedBase = CorrectedLHS.get();
2269 CorrectedBase =
Base;
2275 Base && ExprStatementTokLoc ==
Base->getBeginLoc(),
2281 if (MayBePseudoDestructor && !LHS.
isInvalid()) {
2282 LHS = ParseCXXPseudoDestructor(LHS.
get(), OpLoc, OpKind, SS,
2297 Tok.
is(tok::kw_class)) {
2307 Name.setIdentifier(
Id, Loc);
2314 false, &TemplateKWLoc, Name)) {
2321 OpKind, SS, TemplateKWLoc, Name,
2322 CurParsedObjCImpl ? CurParsedObjCImpl->Dcl
2325 if (Tok.
is(tok::less))
2326 checkPotentialAngleBracket(LHS);
2327 }
else if (OrigLHS && Name.isValid()) {
2330 Name.getEndLoc(), {OrigLHS});
2335 case tok::minusminus:
2383Parser::ParseExprAfterUnaryExprOrTypeTrait(
const Token &OpTok,
2388 assert(OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual, tok::kw_sizeof,
2389 tok::kw___datasizeof, tok::kw___alignof, tok::kw_alignof,
2390 tok::kw__Alignof, tok::kw_vec_step,
2391 tok::kw___builtin_omp_required_simd_align,
2392 tok::kw___builtin_vectorelements) &&
2393 "Not a typeof/sizeof/alignof/vec_step expression!");
2398 if (Tok.
isNot(tok::l_paren)) {
2401 if (OpTok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2402 tok::kw_alignof, tok::kw__Alignof)) {
2403 if (isTypeIdUnambiguously()) {
2405 ParseSpecifierQualifierList(DS);
2408 ParseDeclarator(DeclaratorInfo);
2414 diag::err_expected_parentheses_around_typename)
2417 Diag(LParenLoc, diag::err_expected_parentheses_around_typename)
2427 if (OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual) &&
2434 Operand = ParseCastExpression(UnaryExprOnly);
2440 ParenParseOption ExprType =
CastExpr;
2443 Operand = ParseParenExpression(ExprType,
true,
2444 false, CastTy, RParenLoc);
2455 !OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual)) {
2472ExprResult Parser::ParseSYCLUniqueStableNameExpression() {
2473 assert(Tok.
is(tok::kw___builtin_sycl_unique_stable_name) &&
2474 "Not __builtin_sycl_unique_stable_name");
2480 if (
T.expectAndConsume(diag::err_expected_lparen_after,
2481 "__builtin_sycl_unique_stable_name"))
2491 if (
T.consumeClose())
2495 OpLoc,
T.getOpenLocation(),
T.getCloseLocation(), Ty.
get());
2512ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
2513 assert(Tok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2514 tok::kw_alignof, tok::kw__Alignof, tok::kw_vec_step,
2515 tok::kw___builtin_omp_required_simd_align,
2516 tok::kw___builtin_vectorelements) &&
2517 "Not a sizeof/alignof/vec_step expression!");
2522 if (Tok.
is(tok::ellipsis) && OpTok.
is(tok::kw_sizeof)) {
2527 if (Tok.
is(tok::l_paren)) {
2530 LParenLoc =
T.getOpenLocation();
2531 if (Tok.
is(tok::identifier)) {
2535 RParenLoc =
T.getCloseLocation();
2539 Diag(Tok, diag::err_expected_parameter_pack);
2542 }
else if (Tok.
is(tok::identifier)) {
2547 Diag(LParenLoc, diag::err_paren_sizeof_parameter_pack)
2552 Diag(Tok, diag::err_sizeof_parameter_pack);
2569 OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2570 Diag(OpTok, diag::warn_cxx98_compat_alignof);
2572 Diag(OpTok, diag::warn_c23_compat_keyword) << OpTok.
getName();
2588 case tok::kw_alignof:
2589 case tok::kw__Alignof:
2590 ExprKind = UETT_AlignOf;
2592 case tok::kw___alignof:
2593 ExprKind = UETT_PreferredAlignOf;
2595 case tok::kw_vec_step:
2596 ExprKind = UETT_VecStep;
2598 case tok::kw___builtin_omp_required_simd_align:
2599 ExprKind = UETT_OpenMPRequiredSimdAlign;
2601 case tok::kw___datasizeof:
2602 ExprKind = UETT_DataSizeOf;
2604 case tok::kw___builtin_vectorelements:
2605 ExprKind = UETT_VectorElements;
2618 if (OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2654ExprResult Parser::ParseBuiltinPrimaryExpression() {
2662 if (Tok.
isNot(tok::l_paren))
2663 return ExprError(
Diag(Tok, diag::err_expected_after) << BuiltinII
2672 default: llvm_unreachable(
"Not a builtin primary expression!");
2673 case tok::kw___builtin_va_arg: {
2676 if (ExpectAndConsume(tok::comma)) {
2683 if (Tok.
isNot(tok::r_paren)) {
2684 Diag(Tok, diag::err_expected) << tok::r_paren;
2694 case tok::kw___builtin_offsetof: {
2700 if (MacroName ==
"offsetof")
2713 if (ExpectAndConsume(tok::comma)) {
2719 if (Tok.
isNot(tok::identifier)) {
2720 Diag(Tok, diag::err_expected) << tok::identifier;
2729 Comps.back().isBrackets =
false;
2731 Comps.back().LocStart = Comps.back().LocEnd =
ConsumeToken();
2735 if (Tok.
is(tok::period)) {
2738 Comps.back().isBrackets =
false;
2741 if (Tok.
isNot(tok::identifier)) {
2742 Diag(Tok, diag::err_expected) << tok::identifier;
2748 }
else if (Tok.
is(tok::l_square)) {
2749 if (CheckProhibitedCXX11Attribute())
2754 Comps.back().isBrackets =
true;
2757 Comps.back().LocStart = ST.getOpenLocation();
2763 Comps.back().U.E = Res.
get();
2766 Comps.back().LocEnd = ST.getCloseLocation();
2768 if (Tok.
isNot(tok::r_paren)) {
2777 PT.getCloseLocation());
2784 case tok::kw___builtin_choose_expr: {
2786 if (Cond.isInvalid()) {
2790 if (ExpectAndConsume(tok::comma)) {
2796 if (Expr1.isInvalid()) {
2800 if (ExpectAndConsume(tok::comma)) {
2806 if (Expr2.isInvalid()) {
2810 if (Tok.
isNot(tok::r_paren)) {
2811 Diag(Tok, diag::err_expected) << tok::r_paren;
2815 Expr2.get(), ConsumeParen());
2818 case tok::kw___builtin_astype: {
2821 if (
Expr.isInvalid()) {
2826 if (ExpectAndConsume(tok::comma)) {
2837 if (Tok.
isNot(tok::r_paren)) {
2838 Diag(Tok, diag::err_expected) << tok::r_paren;
2847 case tok::kw___builtin_convertvector: {
2850 if (
Expr.isInvalid()) {
2855 if (ExpectAndConsume(tok::comma)) {
2866 if (Tok.
isNot(tok::r_paren)) {
2867 Diag(Tok, diag::err_expected) << tok::r_paren;
2876 case tok::kw___builtin_COLUMN:
2877 case tok::kw___builtin_FILE:
2878 case tok::kw___builtin_FILE_NAME:
2879 case tok::kw___builtin_FUNCTION:
2880 case tok::kw___builtin_FUNCSIG:
2881 case tok::kw___builtin_LINE:
2882 case tok::kw___builtin_source_location: {
2884 if (Tok.
isNot(tok::r_paren)) {
2885 Diag(Tok, diag::err_expected) << tok::r_paren;
2891 case tok::kw___builtin_FILE:
2893 case tok::kw___builtin_FILE_NAME:
2895 case tok::kw___builtin_FUNCTION:
2897 case tok::kw___builtin_FUNCSIG:
2899 case tok::kw___builtin_LINE:
2901 case tok::kw___builtin_COLUMN:
2903 case tok::kw___builtin_source_location:
2906 llvm_unreachable(
"invalid keyword");
2919 return ParsePostfixExpressionSuffix(Res.
get());
2922bool Parser::tryParseOpenMPArrayShapingCastPart() {
2923 assert(Tok.
is(tok::l_square) &&
"Expected open bracket");
2924 bool ErrorFound =
true;
2925 TentativeParsingAction TPA(*
this);
2927 if (Tok.
isNot(tok::l_square))
2932 while (!
SkipUntil(tok::r_square, tok::annot_pragma_openmp_end,
2935 if (Tok.
isNot(tok::r_square))
2940 if (Tok.
is(tok::r_paren)) {
2944 }
while (Tok.
isNot(tok::annot_pragma_openmp_end));
2977Parser::ParseParenExpression(ParenParseOption &ExprType,
bool stopIfCastExpr,
2980 assert(Tok.
is(tok::l_paren) &&
"Not a paren expr!");
2983 if (
T.consumeOpen())
2987 PreferredType.enterParenExpr(Tok.
getLocation(), OpenLoc);
2990 bool isAmbiguousTypeId;
2993 if (Tok.
is(tok::code_completion)) {
2997 ExprType >= CompoundLiteral);
3004 tok::kw___bridge_transfer,
3005 tok::kw___bridge_retained,
3006 tok::kw___bridge_retain));
3007 if (BridgeCast && !
getLangOpts().ObjCAutoRefCount) {
3009 StringRef BridgeCastName = Tok.
getName();
3012 Diag(BridgeKeywordLoc, diag::warn_arc_bridge_cast_nonarc)
3022 Diag(Tok, OpenLoc.
isMacroID() ? diag::ext_gnu_statement_expr_macro
3023 : diag::ext_gnu_statement_expr);
3025 checkCompoundToken(OpenLoc, tok::l_paren, CompoundToken::StmtExprBegin);
3034 while (CodeDC->
isRecord() || isa<EnumDecl>(CodeDC)) {
3037 "statement expr not in code context");
3047 if (!
Stmt.isInvalid()) {
3054 }
else if (ExprType >= CompoundLiteral && BridgeCast) {
3060 if (tokenKind == tok::kw___bridge)
3062 else if (tokenKind == tok::kw___bridge_transfer)
3064 else if (tokenKind == tok::kw___bridge_retained)
3069 assert(tokenKind == tok::kw___bridge_retain);
3072 Diag(BridgeKeywordLoc, diag::err_arc_bridge_retain)
3074 "__bridge_retained");
3079 ColonProtection.restore();
3080 RParenLoc =
T.getCloseLocation();
3083 ExprResult SubExpr = ParseCastExpression(AnyCastExpr);
3089 BridgeKeywordLoc, Ty.
get(),
3090 RParenLoc, SubExpr.
get());
3091 }
else if (ExprType >= CompoundLiteral &&
3092 isTypeIdInParens(isAmbiguousTypeId)) {
3101 if (isAmbiguousTypeId && !stopIfCastExpr) {
3102 ExprResult res = ParseCXXAmbiguousParenExpression(ExprType, CastTy,
T,
3104 RParenLoc =
T.getCloseLocation();
3110 ParseSpecifierQualifierList(DS);
3113 ParseDeclarator(DeclaratorInfo);
3118 if (!DeclaratorInfo.isInvalidType() && Tok.
is(tok::identifier) &&
3132 ColonProtection.restore();
3133 RParenLoc =
T.getCloseLocation();
3134 if (Tok.
is(tok::l_brace)) {
3135 ExprType = CompoundLiteral;
3141 return ParseCompoundLiteralExpression(Ty.
get(), OpenLoc, RParenLoc);
3144 if (Tok.
is(tok::l_paren)) {
3165 Result = ParseCastExpression(AnyCastExpr,
3170 if (!
Result.isInvalid()) {
3172 DeclaratorInfo, CastTy,
3173 RParenLoc,
Result.get());
3177 if (!
Result.isInvalid()) {
3189 if (DeclaratorInfo.isInvalidType())
3194 if (stopIfCastExpr) {
3208 GetLookAheadToken(1).isNot(tok::period)) {
3217 Result = ParseCastExpression(AnyCastExpr,
3220 if (!
Result.isInvalid()) {
3222 DeclaratorInfo, CastTy,
3223 RParenLoc,
Result.get());
3228 Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
3231 }
else if (ExprType >= FoldExpr && Tok.
is(tok::ellipsis) &&
3233 ExprType = FoldExpr;
3235 }
else if (isTypeCast) {
3238 ExprVector ArgExprs;
3240 if (!ParseSimpleExpressionList(ArgExprs)) {
3243 if (ExprType >= FoldExpr && ArgExprs.size() == 1 &&
3245 ExprType = FoldExpr;
3246 return ParseFoldExpression(ArgExprs[0],
T);
3249 ExprType = SimpleExpr;
3253 }
else if (
getLangOpts().OpenMP >= 50 && OpenMPDirectiveParsing &&
3254 ExprType ==
CastExpr && Tok.
is(tok::l_square) &&
3255 tryParseOpenMPArrayShapingCastPart()) {
3256 bool ErrorFound =
false;
3266 while (!
SkipUntil(tok::r_square, tok::r_paren,
3271 OMPDimensions.push_back(NumElements.
get());
3272 OMPBracketsRanges.push_back(TS.getRange());
3273 }
while (Tok.
isNot(tok::r_paren));
3276 RParenLoc =
T.getCloseLocation();
3280 }
else if (!
Result.isInvalid()) {
3282 Result.get(), OpenLoc, RParenLoc, OMPDimensions, OMPBracketsRanges);
3295 if (ExprType >= FoldExpr && isFoldOperator(Tok.
getKind()) &&
3297 ExprType = FoldExpr;
3298 return ParseFoldExpression(
Result,
T);
3300 ExprType = SimpleExpr;
3303 if (!
Result.isInvalid() && Tok.
is(tok::r_paren))
3309 if (
Result.isInvalid()) {
3315 RParenLoc =
T.getCloseLocation();
3328Parser::ParseCompoundLiteralExpression(
ParsedType Ty,
3331 assert(Tok.
is(tok::l_brace) &&
"Not a compound literal!");
3333 Diag(LParenLoc, diag::ext_c99_compound_literal);
3336 if (!
Result.isInvalid() && Ty)
3362 "Not a string-literal-like token!");
3370 StringToks.push_back(Tok);
3375 assert(!AllowUserDefinedLiteral &&
"UDL are always evaluated");
3404ExprResult Parser::ParseGenericSelectionExpression() {
3405 assert(Tok.
is(tok::kw__Generic) &&
"_Generic keyword expected");
3407 diagnoseUseOfC11Keyword(Tok);
3411 if (
T.expectAndConsume())
3418 if (isTypeIdForGenericSelection()) {
3424 const auto *LIT = cast<LocInfoType>(ControllingType.
get().get());
3425 SourceLocation Loc = LIT->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
3426 Diag(Loc, diag::ext_generic_with_type_arg);
3440 if (ExpectAndConsume(tok::comma)) {
3450 if (Tok.
is(tok::kw_default)) {
3454 Diag(Tok, diag::err_duplicate_default_assoc);
3455 Diag(DefaultLoc, diag::note_previous_default_assoc);
3470 Types.push_back(Ty);
3472 if (ExpectAndConsume(tok::colon)) {
3481 if (ER.isInvalid()) {
3485 Exprs.push_back(ER.get());
3489 if (
T.getCloseLocation().isInvalid())
3492 void *ExprOrTy = ControllingExpr.
isUsable()
3493 ? ControllingExpr.
get()
3494 : ControllingType.
get().getAsOpaquePtr();
3497 KeyLoc, DefaultLoc,
T.getCloseLocation(), ControllingExpr.
isUsable(),
3498 ExprOrTy, Types, Exprs);
3520 assert(isFoldOperator(Kind) &&
"missing fold-operator");
3524 assert(Tok.
is(tok::ellipsis) &&
"not a fold-expression");
3528 if (Tok.
isNot(tok::r_paren)) {
3529 if (!isFoldOperator(Tok.
getKind()))
3532 if (Kind != tok::unknown && Tok.
getKind() != Kind)
3546 ? diag::warn_cxx14_compat_fold_expression
3547 : diag::ext_fold_expression);
3551 Kind, EllipsisLoc, RHS.
get(),
3552 T.getCloseLocation());
3578 llvm::function_ref<
void()> ExpressionStarts,
3579 bool FailImmediatelyOnInvalidExpr,
3580 bool EarlyTypoCorrection) {
3581 bool SawError =
false;
3583 if (ExpressionStarts)
3588 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3589 Expr = ParseBraceInitializer();
3593 if (EarlyTypoCorrection)
3596 if (Tok.
is(tok::ellipsis))
3598 else if (Tok.
is(tok::code_completion)) {
3608 if (
Expr.isInvalid()) {
3610 if (FailImmediatelyOnInvalidExpr)
3614 Exprs.push_back(
Expr.get());
3617 if (Tok.
isNot(tok::comma))
3622 checkPotentialAngleBracketDelimiter(Comma);
3627 for (
auto &E : Exprs) {
3629 if (
Expr.isUsable()) E =
Expr.get();
3646 if (
Expr.isInvalid())
3649 Exprs.push_back(
Expr.get());
3659 checkPotentialAngleBracketDelimiter(Comma);
3670 if (Tok.
is(tok::code_completion)) {
3678 ParseSpecifierQualifierList(DS);
3684 ParseDeclarator(DeclaratorInfo);
3686 MaybeParseGNUAttributes(DeclaratorInfo);
3702ExprResult Parser::ParseBlockLiteralExpression() {
3703 assert(Tok.
is(tok::caret) &&
"block literal starts with ^");
3707 "block literal parsing");
3730 if (Tok.
is(tok::l_paren)) {
3731 ParseParenDeclarator(ParamInfo);
3736 ParamInfo.SetIdentifier(
nullptr, CaretLoc);
3737 ParamInfo.SetRangeEnd(Tmp);
3738 if (ParamInfo.isInvalidType()) {
3746 MaybeParseGNUAttributes(ParamInfo);
3750 }
else if (!Tok.
is(tok::l_brace)) {
3751 ParseBlockId(CaretLoc);
3755 ParamInfo.AddTypeInfo(
3773 CaretLoc, CaretLoc, ParamInfo),
3776 MaybeParseGNUAttributes(ParamInfo);
3784 if (!Tok.
is(tok::l_brace)) {
3786 Diag(Tok, diag::err_expected_expression);
3793 if (!
Stmt.isInvalid())
3813 llvm::SmallSet<StringRef, 4> Platforms;
3814 bool HasOtherPlatformSpec =
false;
3816 for (
const auto &Spec : AvailSpecs) {
3817 if (Spec.isOtherPlatformSpec()) {
3818 if (HasOtherPlatformSpec) {
3819 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_star);
3823 HasOtherPlatformSpec =
true;
3827 bool Inserted = Platforms.insert(Spec.getPlatform()).second;
3832 StringRef Platform = Spec.getPlatform();
3833 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_platform)
3834 << Spec.getEndLoc() << Platform;
3839 if (!HasOtherPlatformSpec) {
3840 SourceLocation InsertWildcardLoc = AvailSpecs.back().getEndLoc();
3841 P.Diag(InsertWildcardLoc, diag::err_availability_query_wildcard_required)
3854std::optional<AvailabilitySpec> Parser::ParseAvailabilitySpec() {
3855 if (Tok.
is(tok::star)) {
3859 if (Tok.
is(tok::code_completion)) {
3862 return std::nullopt;
3864 if (Tok.
isNot(tok::identifier)) {
3865 Diag(Tok, diag::err_avail_query_expected_platform_name);
3866 return std::nullopt;
3871 VersionTuple Version = ParseVersionTuple(VersionRange);
3873 if (Version.empty())
3874 return std::nullopt;
3876 StringRef GivenPlatform = PlatformIdentifier->
Ident->
getName();
3877 StringRef Platform =
3878 AvailabilityAttr::canonicalizePlatformName(GivenPlatform);
3880 if (AvailabilityAttr::getPrettyPlatformName(Platform).empty() ||
3881 (GivenPlatform.contains(
"xros") || GivenPlatform.contains(
"xrOS"))) {
3883 diag::err_avail_query_unrecognized_platform_name)
3885 return std::nullopt;
3894 assert(Tok.
is(tok::kw___builtin_available) ||
3901 if (
Parens.expectAndConsume())
3905 bool HasError =
false;
3907 std::optional<AvailabilitySpec> Spec = ParseAvailabilitySpec();
3911 AvailSpecs.push_back(*Spec);
3924 if (
Parens.consumeClose())
3928 Parens.getCloseLocation());
Defines the clang::ASTContext interface.
static Decl::Kind getKind(const Decl *D)
Defines the clang::Expr interface and subclasses for C++ expressions.
static bool CheckAvailabilitySpecList(Parser &P, ArrayRef< AvailabilitySpec > AvailSpecs)
Validate availability spec list, emitting diagnostics if necessary.
#define REVERTIBLE_TYPE_TRAIT(Name)
Defines the PrettyStackTraceEntry class, which is used to make crashes give more contextual informati...
This file declares semantic analysis for CUDA constructs.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for SYCL constructs.
const clang::PrintingPolicy & getPrintingPolicy() const
One specifier in an @available expression.
RAII class that helps handle the parsing of an open/close delimiter pair, such as braces { ....
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.
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.
CompoundStmt - This represents a group of statements like { stmt stmt }.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
virtual bool ValidateCandidate(const TypoCorrection &candidate)
Simple predicate used by the default RankCandidate to determine whether to return an edit distance of...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isFileContext() const
Captures information about "declaration specifiers".
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.
bool containsErrors() const
Whether this expression contains subexpressions which had errors, e.g.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
ExtensionRAIIObject - This saves the state of extension warnings when constructed and disables them.
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.
bool hasRevertedTokenIDToIdentifier() const
True if revertTokenIDToIdentifier() was called.
StringRef getName() const
Return the actual identifier string.
Represents the declaration of a label.
static StringRef getImmediateMacroNameForDiagnostics(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
Retrieve the name of the immediate macro expansion.
This represents a decl that may have a name.
void * getAsOpaquePtr() const
static const ParsedAttributesView & none()
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.
Sema & getActions() const
static TypeResult getTypeAnnotation(const Token &Tok)
getTypeAnnotation - Read a parsed type out of an annotation token.
ExprResult ParseCaseExpression(SourceLocation CaseLoc)
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.
SourceLocation ConsumeAnyToken(bool ConsumeCodeCompletionTok=false)
ConsumeAnyToken - Dispatch to the right Consume* method based on the current token type.
ExprResult ParseConstantExpression()
ExprResult ParseConditionalExpression()
bool TryConsumeToken(tok::TokenKind Expected)
Scope * getCurScope() const
ExprResult ParseArrayBoundExpression()
ExprResult ParseConstraintLogicalAndExpression(bool IsTrailingRequiresClause)
Parse a constraint-logical-and-expression.
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.
ExprResult ParseConstantExpressionInExprEvalContext(TypeCastState isTypeCast=NotTypeCast)
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.
bool TryAnnotateTypeOrScopeToken(ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No)
TryAnnotateTypeOrScopeToken - If the current token position is on a typename (possibly qualified in C...
TypeCastState
TypeCastState - State whether an expression is or may be a type cast.
ExprResult ParseUnevaluatedStringLiteralExpression()
ExprResult ParseStringLiteralExpression(bool AllowUserDefinedLiteral=false)
const Token & NextToken()
NextToken - This peeks ahead one token and returns it without consuming it.
ExprResult ParseConstraintExpression()
Parse a constraint-expression.
void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS)
void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind, SourceLocation OpLoc)
void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op)
QualType get(SourceLocation Tok) const
Get the expected type associated with this location, if any.
void EnterToken(const Token &Tok, bool IsReinject)
Enters a token in the token stream to be lexed next.
SourceManager & getSourceManager() const
StringRef getSpelling(SourceLocation loc, SmallVectorImpl< char > &buffer, bool *invalid=nullptr) const
Return the 'spelling' of the token at the given location; does not go up to the spelling location or ...
bool isAtStartOfMacroExpansion(SourceLocation loc, SourceLocation *MacroBegin=nullptr) const
Returns true if the given MacroID location points at the first token of the macro expansion.
bool isCodeCompletionReached() const
Returns true if code-completion is enabled and we have hit the code-completion point.
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.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
@ BlockScope
This is a scope that corresponds to a block/closure object.
@ CompoundStmtScope
This is a compound statement scope.
@ 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.
ExprResult ActOnExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
ExprResult ActOnUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input, bool IsAfterAmp=false)
ExprResult ActOnConstantExpression(ExprResult Res)
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
ExprResult ActOnClassPropertyRefExpr(const IdentifierInfo &receiverName, const IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType)
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
void ActOnStartStmtExpr()
QualType ProduceCallSignatureHelp(Expr *Fn, ArrayRef< Expr * > Args, SourceLocation OpenParLoc)
Determines the preferred type of the current function argument, by examining the signatures of all po...
void ActOnStmtExprError()
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, const IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, QualType PreferredType)
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
void CodeCompleteAvailabilityPlatformName()
bool CheckConstraintExpression(const Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
ASTContext & getASTContext() const
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
ExprResult ActOnUnevaluatedStringLiteral(ArrayRef< Token > StringToks)
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for.
SourceRange getExprRange(Expr *E) const
ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E)
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
The main callback when the parser finds something like expression .
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
ControllingExprOrType is either an opaque pointer coming out of a ParsedType or an Expr *.
void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockError - If there is an error parsing a block, this callback is invoked to pop the informati...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
@ PCC_Type
Code completion occurs where only a type is permitted.
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult ActOnSourceLocExpr(SourceLocIdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
TypeResult ActOnTypeName(Declarator &D)
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e....
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type.
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, IdentifierInfo &Name, SourceLocation NameLoc, SourceLocation RParenLoc)
Called when an expression computing the size of a parameter pack is parsed.
ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, SourceRange ArgRange)
ActOnUnaryExprOrTypeTraitExpr - Handle sizeof(type) and sizeof expr and the same for alignof and __al...
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
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...
ExprResult ActOnNameClassifiedAsOverloadSet(Scope *S, Expr *OverloadSet)
Act on the result of classifying a name as an overload set.
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.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
Token - This structure provides full information about a lexed token.
IdentifierInfo * getIdentifierInfo() const
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
const char * getName() const
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)) {....
tok::TokenKind getKind() const
bool isAtStartOfLine() const
isAtStartOfLine - Return true if this token is at the start of a line.
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const
bool isNot(tok::TokenKind K) const
bool isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const
Return true if we have an ObjC keyword identifier.
bool isSimpleTypeSpecifier(const LangOptions &LangOpts) const
Determine whether the token kind starts a simple-type-specifier.
SourceLocation getLastLoc() const
Base wrapper for a particular "section" of type source info.
The base class of the type hierarchy.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
bool isFunctionType() const
bool isVectorType() const
Simple class containing the result of Sema::CorrectTypo.
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
Represents a C++ unqualified-id that has been parsed.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
bool tokenIsLikeStringLiteral(const Token &Tok, const LangOptions &LO)
Return true if the token is a string literal, or a function local predefined macro,...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
@ Result
The result type of a method or function.
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
@ OBC_Bridge
Bridging via __bridge, which does nothing but reinterpret the bits.
@ OBC_BridgeTransfer
Bridging via __bridge_transfer, which transfers ownership of an Objective-C pointer into ARC.
@ OBC_BridgeRetained
Bridging via __bridge_retain, which makes an ARC object available as a +1 C pointer.
ActionResult< Expr * > ExprResult
prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, bool CPlusPlus11)
Return the precedence of the specified binary operator token.
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
const FunctionProtoType * T
@ Parens
New-expression has a C++98 paren-delimited initializer.
@ 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.
Wraps an identifier and optional source location for the identifier.
Information about a template-id annotation token.
TemplateNameKind Kind
The kind of template that Template refers to.