34#include "llvm/ADT/SmallVector.h"
128 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
139 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
146Parser::ParseExpressionWithLeadingExtension(
SourceLocation ExtLoc) {
152 LHS = ParseCastExpression(AnyCastExpr);
155 if (!LHS.isInvalid())
159 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
164 if (Tok.
is(tok::code_completion)) {
171 if (Tok.
is(tok::kw_throw))
172 return ParseThrowExpression();
173 if (Tok.
is(tok::kw_co_yield))
174 return ParseCoyieldExpression();
176 ExprResult LHS = ParseCastExpression(AnyCastExpr,
183 if (Tok.
is(tok::code_completion)) {
205Parser::ParseAssignmentExprWithObjCMessageExprStart(
SourceLocation LBracLoc,
208 Expr *ReceiverExpr) {
210 = ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
211 ReceiverType, ReceiverExpr);
212 R = ParsePostfixExpressionSuffix(R);
220 "Call this function only if your ExpressionEvaluationContext is "
221 "already ConstantEvaluated");
222 ExprResult LHS(ParseCastExpression(AnyCastExpr,
false, isTypeCast));
242 Actions.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
263 ExprResult LHS(ParseCastExpression(AnyCastExpr));
285 bool NotPrimaryExpression =
false;
286 auto ParsePrimary = [&] () {
287 ExprResult E = ParseCastExpression(PrimaryExprOnly,
291 &NotPrimaryExpression);
295 E = ParsePostfixExpressionSuffix(E);
302 ? diag::note_unparenthesized_non_primary_expr_in_requires_clause
303 : diag::err_unparenthesized_non_primary_expr_in_requires_clause)
311 if (NotPrimaryExpression ||
318 Tok.
isOneOf(tok::period, tok::plusplus, tok::minusminus) ||
319 (Tok.
is(tok::l_square) && !
NextToken().is(tok::l_square))) {
320 E = RecoverFromNonPrimary(E,
false);
323 NotPrimaryExpression =
false;
325 bool PossibleNonPrimary;
326 bool IsConstraintExpr =
328 IsTrailingRequiresClause);
329 if (!IsConstraintExpr || PossibleNonPrimary) {
334 if (PossibleNonPrimary)
335 E = RecoverFromNonPrimary(E, !IsConstraintExpr);
344 while (Tok.
is(tok::ampamp)) {
352 tok::ampamp, LHS.
get(), RHS.
get());
378 while (Tok.
is(tok::pipepipe)) {
387 tok::pipepipe, LHS.
get(), RHS.
get());
398bool Parser::isNotExpressionStart() {
400 if (K == tok::l_brace || K == tok::r_brace ||
401 K == tok::kw_for || K == tok::kw_while ||
402 K == tok::kw_if || K == tok::kw_else ||
403 K == tok::kw_goto || K == tok::kw_try)
406 return isKnownToBeDeclarationSpecifier();
409bool Parser::isFoldOperator(
prec::Level Level)
const {
423 GreaterThanIsOperator,
427 auto SavedType = PreferredType;
430 PreferredType = SavedType;
434 if (NextTokPrec < MinPrec)
441 if (OpToken.
is(tok::caretcaret)) {
442 return ExprError(
Diag(Tok, diag::err_opencl_logical_exclusive_or));
447 if (OpToken.
isOneOf(tok::comma, tok::greater, tok::greatergreater,
448 tok::greatergreatergreater) &&
449 checkPotentialAngleBracketDelimiter(OpToken))
457 if (OpToken.
is(tok::comma) && isNotExpressionStart()) {
465 if (isFoldOperator(NextTokPrec) && Tok.
is(tok::ellipsis)) {
479 Tok.
isOneOf(tok::colon, tok::r_square) &&
492 TernaryMiddle = ParseBraceInitializer();
493 if (!TernaryMiddle.isInvalid()) {
494 Diag(BraceLoc, diag::err_init_list_bin_op)
499 }
else if (Tok.
isNot(tok::colon)) {
511 TernaryMiddle =
nullptr;
512 Diag(Tok, diag::ext_gnu_conditional_expr);
515 if (TernaryMiddle.isInvalid()) {
518 TernaryMiddle =
nullptr;
527 const char *FIText =
": ";
531 bool IsInvalid =
false;
532 const char *SourcePtr =
534 if (!IsInvalid && *SourcePtr ==
' ') {
537 if (!IsInvalid && *SourcePtr ==
' ') {
544 Diag(Tok, diag::err_expected)
546 Diag(OpToken, diag::note_matching) << tok::question;
564 bool RHSIsInitList =
false;
566 RHS = ParseBraceInitializer();
567 RHSIsInitList =
true;
571 RHS = ParseCastExpression(AnyCastExpr);
577 if (TernaryMiddle.isUsable())
594 if (ThisPrec < NextTokPrec ||
595 (ThisPrec == NextTokPrec && isRightAssoc)) {
597 Diag(Tok, diag::err_init_list_bin_op)
606 RHS = ParseRHSOfBinaryExpression(RHS,
607 static_cast<prec::Level>(ThisPrec + !isRightAssoc));
608 RHSIsInitList =
false;
614 if (TernaryMiddle.isUsable())
625 Diag(OpToken, diag::warn_cxx98_compat_generalized_initializer_lists)
627 }
else if (ColonLoc.
isValid()) {
628 Diag(ColonLoc, diag::err_init_list_bin_op)
633 Diag(OpToken, diag::err_init_list_bin_op)
643 if (TernaryMiddle.isInvalid()) {
647 if (!GreaterThanIsOperator && OpToken.
is(tok::greatergreater))
649 diag::warn_cxx11_right_shift_in_template_arg,
659 {LHS.get(), RHS.get()});
667 std::vector<clang::Expr *> Args;
669 if (TernaryMiddle.get())
670 Args = {LHS.
get(), TernaryMiddle.get(), RHS.
get()};
672 Args = {LHS.
get(), RHS.
get()};
700ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
701 bool isAddressOfOperand,
702 TypeCastState isTypeCast,
703 bool isVectorLiteral,
704 bool *NotPrimaryExpression) {
706 ExprResult Res = ParseCastExpression(ParseKind,
711 NotPrimaryExpression);
713 Diag(Tok, diag::err_expected_expression);
720 CastExpressionIdValidator(
Token Next,
bool AllowTypes,
bool AllowNonTypes)
721 : NextToken(Next), AllowNonTypes(AllowNonTypes) {
722 WantTypeSpecifiers = WantFunctionLikeCasts = AllowTypes;
725 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
730 if (isa<TypeDecl>(ND))
731 return WantTypeSpecifiers;
736 if (!NextToken.isOneOf(tok::equal, tok::arrow, tok::period))
739 for (
auto *
C : candidate) {
741 if (isa<ValueDecl>(ND) && !isa<FunctionDecl>(ND))
747 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
748 return std::make_unique<CastExpressionIdValidator>(*
this);
940ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
941 bool isAddressOfOperand,
943 TypeCastState isTypeCast,
944 bool isVectorLiteral,
945 bool *NotPrimaryExpression) {
948 auto SavedType = PreferredType;
954 bool AllowSuffix =
true;
970 ParenParseOption ParenExprType;
972 case CastParseKind::UnaryExprOnly:
975 case CastParseKind::AnyCastExpr:
976 ParenExprType = ParenParseOption::CastExpr;
978 case CastParseKind::PrimaryExprOnly:
979 ParenExprType = FoldExpr;
984 Res = ParseParenExpression(ParenExprType,
false,
993 switch (ParenExprType) {
994 case SimpleExpr:
break;
996 case CompoundLiteral:
1014 case tok::numeric_constant:
1024 Res = ParseCXXBoolLiteral();
1027 case tok::kw___objc_yes:
1028 case tok::kw___objc_no:
1029 Res = ParseObjCBoolLiteral();
1032 case tok::kw_nullptr:
1034 Diag(Tok, diag::warn_cxx98_compat_nullptr);
1037 : diag::ext_c_nullptr) << Tok.
getName();
1042 case tok::annot_primary_expr:
1043 case tok::annot_overload_set:
1044 Res = getExprAnnotation(Tok);
1047 ConsumeAnnotationToken();
1049 checkPotentialAngleBracket(Res);
1052 case tok::annot_non_type:
1053 case tok::annot_non_type_dependent:
1054 case tok::annot_non_type_undeclared: {
1057 Res = tryParseCXXIdExpression(SS, isAddressOfOperand, Replacement);
1059 "should not perform typo correction on annotation token");
1063 case tok::kw___super:
1064 case tok::kw_decltype:
1068 assert(Tok.
isNot(tok::kw_decltype) && Tok.
isNot(tok::kw___super));
1069 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1070 isVectorLiteral, NotPrimaryExpression);
1072 case tok::identifier:
1083 if (Next.is(tok::ellipsis) && Tok.
is(tok::identifier) &&
1084 GetLookAheadToken(2).is(tok::l_square)) {
1089 Tok.
is(tok::annot_pack_indexing_type))
1090 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1091 isVectorLiteral, NotPrimaryExpression);
1097 else if (Next.is(tok::l_paren) && Tok.
is(tok::identifier) &&
1101 if (RevertibleTypeTraits.empty()) {
1102#define RTT_JOIN(X,Y) X##Y
1103#define REVERTIBLE_TYPE_TRAIT(Name) \
1104 RevertibleTypeTraits[PP.getIdentifierInfo(#Name)] \
1105 = RTT_JOIN(tok::kw_,Name)
1166#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
1167 REVERTIBLE_TYPE_TRAIT(RTT_JOIN(__, Trait));
1168#include "clang/Basic/TransformTypeTraits.def"
1169#undef REVERTIBLE_TYPE_TRAIT
1176 llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind>::iterator Known
1177 = RevertibleTypeTraits.find(II);
1178 if (Known != RevertibleTypeTraits.end()) {
1180 return ParseCastExpression(ParseKind, isAddressOfOperand,
1181 NotCastExpr, isTypeCast,
1182 isVectorLiteral, NotPrimaryExpression);
1186 else if ((!ColonIsSacred && Next.is(tok::colon)) ||
1187 Next.isOneOf(tok::coloncolon, tok::less, tok::l_paren,
1192 if (!Tok.
is(tok::identifier))
1193 return ParseCastExpression(ParseKind, isAddressOfOperand,
1194 NotCastExpr, isTypeCast,
1196 NotPrimaryExpression);
1209 (&II == Ident_super &&
getCurScope()->isInObjcMethodScope()))) {
1212 if (Tok.
is(tok::code_completion) && &II != Ident_super) {
1215 getCurScope(), II, ILoc, ExprStatementTokLoc == ILoc);
1219 if (Tok.
isNot(tok::identifier) &&
1221 Diag(Tok, diag::err_expected_property_name);
1236 if (
getLangOpts().
ObjC && &II == Ident_super && !InMessageExpression &&
1238 ((Tok.
is(tok::identifier) &&
1240 Tok.
is(tok::code_completion))) {
1241 Res = ParseObjCMessageExpressionBody(
SourceLocation(), ILoc,
nullptr,
1252 ((Tok.
is(tok::identifier) && !InMessageExpression) ||
1253 Tok.
is(tok::code_completion))) {
1255 if (Tok.
is(tok::code_completion) ||
1256 Next.is(tok::colon) || Next.is(tok::r_square))
1258 if (Typ.get()->isObjCObjectOrInterfaceType()) {
1261 DS.SetRangeStart(ILoc);
1262 DS.SetRangeEnd(ILoc);
1263 const char *PrevSpec =
nullptr;
1265 DS.SetTypeSpecType(
TST_typename, ILoc, PrevSpec, DiagID, Typ,
1282 if (isAddressOfOperand && isPostfixExpressionSuffixStart())
1283 isAddressOfOperand =
false;
1292 CastExpressionIdValidator Validator(
1296 Validator.IsAddressOfOperand = isAddressOfOperand;
1297 if (Tok.
isOneOf(tok::periodstar, tok::arrowstar)) {
1298 Validator.WantExpressionKeywords =
false;
1299 Validator.WantRemainingKeywords =
false;
1301 Validator.WantRemainingKeywords = Tok.
isNot(tok::r_paren);
1303 Name.setIdentifier(&II, ILoc);
1305 getCurScope(), ScopeSpec, TemplateKWLoc, Name, Tok.
is(tok::l_paren),
1306 isAddressOfOperand, &Validator,
1308 Tok.
is(tok::r_paren) ?
nullptr : &Replacement);
1310 UnconsumeToken(Replacement);
1311 return ParseCastExpression(ParseKind, isAddressOfOperand,
1312 NotCastExpr, isTypeCast,
1314 NotPrimaryExpression);
1316 Res = tryParseCXXPackIndexingExpression(Res);
1318 checkPotentialAngleBracket(Res);
1321 case tok::char_constant:
1322 case tok::wide_char_constant:
1323 case tok::utf8_char_constant:
1324 case tok::utf16_char_constant:
1325 case tok::utf32_char_constant:
1329 case tok::kw___func__:
1330 case tok::kw___FUNCTION__:
1331 case tok::kw___FUNCDNAME__:
1332 case tok::kw___FUNCSIG__:
1333 case tok::kw_L__FUNCTION__:
1334 case tok::kw_L__FUNCSIG__:
1335 case tok::kw___PRETTY_FUNCTION__:
1347 case tok::string_literal:
1348 case tok::wide_string_literal:
1349 case tok::utf8_string_literal:
1350 case tok::utf16_string_literal:
1351 case tok::utf32_string_literal:
1354 case tok::kw__Generic:
1355 Res = ParseGenericSelectionExpression();
1357 case tok::kw___builtin_available:
1358 Res = ParseAvailabilityCheckExpr(Tok.
getLocation());
1360 case tok::kw___builtin_va_arg:
1361 case tok::kw___builtin_offsetof:
1362 case tok::kw___builtin_choose_expr:
1363 case tok::kw___builtin_astype:
1364 case tok::kw___builtin_convertvector:
1365 case tok::kw___builtin_COLUMN:
1366 case tok::kw___builtin_FILE:
1367 case tok::kw___builtin_FILE_NAME:
1368 case tok::kw___builtin_FUNCTION:
1369 case tok::kw___builtin_FUNCSIG:
1370 case tok::kw___builtin_LINE:
1371 case tok::kw___builtin_source_location:
1372 if (NotPrimaryExpression)
1373 *NotPrimaryExpression =
true;
1375 return ParseBuiltinPrimaryExpression();
1376 case tok::kw___null:
1381 case tok::minusminus: {
1382 if (NotPrimaryExpression)
1383 *NotPrimaryExpression =
true;
1388 Token SavedTok = Tok;
1397 UnaryExprOnly : AnyCastExpr,
1404 UnconsumeToken(SavedTok);
1418 if (NotPrimaryExpression)
1419 *NotPrimaryExpression =
true;
1424 Res = ParseCastExpression(AnyCastExpr,
true);
1440 case tok::kw___real:
1441 case tok::kw___imag: {
1442 if (NotPrimaryExpression)
1443 *NotPrimaryExpression =
true;
1446 Res = ParseCastExpression(AnyCastExpr);
1450 isAddressOfOperand);
1457 case tok::kw_co_await: {
1458 if (NotPrimaryExpression)
1459 *NotPrimaryExpression =
true;
1461 Res = ParseCastExpression(AnyCastExpr);
1467 case tok::kw___extension__:{
1469 if (NotPrimaryExpression)
1470 *NotPrimaryExpression =
true;
1473 Res = ParseCastExpression(AnyCastExpr);
1478 case tok::kw__Alignof:
1479 diagnoseUseOfC11Keyword(Tok);
1481 case tok::kw_alignof:
1482 case tok::kw___alignof:
1484 case tok::kw_sizeof:
1488 case tok::kw___datasizeof:
1489 case tok::kw_vec_step:
1491 case tok::kw___builtin_omp_required_simd_align:
1492 case tok::kw___builtin_vectorelements:
1493 if (NotPrimaryExpression)
1494 *NotPrimaryExpression =
true;
1495 AllowSuffix =
false;
1496 Res = ParseUnaryExprOrTypeTraitExpression();
1499 if (NotPrimaryExpression)
1500 *NotPrimaryExpression =
true;
1502 if (Tok.
isNot(tok::identifier))
1503 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
1506 return ExprError(
Diag(Tok, diag::err_address_of_label_outside_fn));
1508 Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
1513 AllowSuffix =
false;
1516 case tok::kw_const_cast:
1517 case tok::kw_dynamic_cast:
1518 case tok::kw_reinterpret_cast:
1519 case tok::kw_static_cast:
1520 case tok::kw_addrspace_cast:
1521 if (NotPrimaryExpression)
1522 *NotPrimaryExpression =
true;
1523 Res = ParseCXXCasts();
1525 case tok::kw___builtin_bit_cast:
1526 if (NotPrimaryExpression)
1527 *NotPrimaryExpression =
true;
1528 Res = ParseBuiltinBitCast();
1530 case tok::kw_typeid:
1531 if (NotPrimaryExpression)
1532 *NotPrimaryExpression =
true;
1533 Res = ParseCXXTypeid();
1535 case tok::kw___uuidof:
1536 if (NotPrimaryExpression)
1537 *NotPrimaryExpression =
true;
1538 Res = ParseCXXUuidof();
1541 Res = ParseCXXThis();
1543 case tok::kw___builtin_sycl_unique_stable_name:
1544 Res = ParseSYCLUniqueStableNameExpression();
1547 case tok::annot_typename:
1548 if (isStartOfObjCClassMessageMissingOpenBracket()) {
1556 const char *PrevSpec =
nullptr;
1559 PrevSpec, DiagID,
Type,
1568 ConsumeAnnotationToken();
1575 case tok::annot_decltype:
1576 case tok::annot_pack_indexing_type:
1578 case tok::kw_wchar_t:
1579 case tok::kw_char8_t:
1580 case tok::kw_char16_t:
1581 case tok::kw_char32_t:
1586 case tok::kw___int64:
1587 case tok::kw___int128:
1588 case tok::kw__ExtInt:
1589 case tok::kw__BitInt:
1590 case tok::kw_signed:
1591 case tok::kw_unsigned:
1594 case tok::kw_double:
1595 case tok::kw___bf16:
1596 case tok::kw__Float16:
1597 case tok::kw___float128:
1598 case tok::kw___ibm128:
1601 case tok::kw_typename:
1602 case tok::kw_typeof:
1603 case tok::kw___vector:
1604 case tok::kw__Accum:
1605 case tok::kw__Fract:
1607#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:
1608#include "clang/Basic/OpenCLImageTypes.def"
1611 Diag(Tok, diag::err_expected_expression);
1616 if (NotPrimaryExpression)
1617 *NotPrimaryExpression =
true;
1619 if (SavedKind == tok::kw_typename) {
1636 ParseCXXSimpleTypeSpecifier(DS);
1637 if (Tok.
isNot(tok::l_paren) &&
1639 return ExprError(
Diag(Tok, diag::err_expected_lparen_after_type)
1640 << DS.getSourceRange());
1642 if (Tok.
is(tok::l_brace))
1643 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1645 Res = ParseCXXTypeConstructExpression(DS);
1649 case tok::annot_cxxscope: {
1654 if (!Tok.
is(tok::annot_cxxscope))
1655 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1656 isTypeCast, isVectorLiteral,
1657 NotPrimaryExpression);
1660 if (Next.is(tok::annot_template_id)) {
1667 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
1671 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1672 isTypeCast, isVectorLiteral,
1673 NotPrimaryExpression);
1678 Res = ParseCXXIdExpression(isAddressOfOperand);
1682 case tok::annot_template_id: {
1690 return ParseCastExpression(ParseKind, isAddressOfOperand,
1691 NotCastExpr, isTypeCast, isVectorLiteral,
1692 NotPrimaryExpression);
1699 case tok::kw_operator:
1700 Res = ParseCXXIdExpression(isAddressOfOperand);
1703 case tok::coloncolon: {
1708 if (!Tok.
is(tok::coloncolon))
1709 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1710 isVectorLiteral, NotPrimaryExpression);
1715 if (Tok.
is(tok::kw_new)) {
1716 if (NotPrimaryExpression)
1717 *NotPrimaryExpression =
true;
1718 Res = ParseCXXNewExpression(
true, CCLoc);
1719 AllowSuffix =
false;
1722 if (Tok.
is(tok::kw_delete)) {
1723 if (NotPrimaryExpression)
1724 *NotPrimaryExpression =
true;
1725 Res = ParseCXXDeleteExpression(
true, CCLoc);
1726 AllowSuffix =
false;
1731 Diag(CCLoc, diag::err_expected_expression);
1736 if (NotPrimaryExpression)
1737 *NotPrimaryExpression =
true;
1738 Res = ParseCXXNewExpression(
false, Tok.
getLocation());
1739 AllowSuffix =
false;
1742 case tok::kw_delete:
1743 if (NotPrimaryExpression)
1744 *NotPrimaryExpression =
true;
1745 Res = ParseCXXDeleteExpression(
false, Tok.
getLocation());
1746 AllowSuffix =
false;
1749 case tok::kw_requires:
1750 Res = ParseRequiresExpression();
1751 AllowSuffix =
false;
1754 case tok::kw_noexcept: {
1755 if (NotPrimaryExpression)
1756 *NotPrimaryExpression =
true;
1757 Diag(Tok, diag::warn_cxx98_compat_noexcept_expr);
1761 if (T.expectAndConsume(diag::err_expected_lparen_after,
"noexcept"))
1774 T.getCloseLocation());
1775 AllowSuffix =
false;
1779#define TYPE_TRAIT(N,Spelling,K) \
1780 case tok::kw_##Spelling:
1781#include "clang/Basic/TokenKinds.def"
1782 Res = ParseTypeTrait();
1785 case tok::kw___array_rank:
1786 case tok::kw___array_extent:
1787 if (NotPrimaryExpression)
1788 *NotPrimaryExpression =
true;
1789 Res = ParseArrayTypeTrait();
1792 case tok::kw___is_lvalue_expr:
1793 case tok::kw___is_rvalue_expr:
1794 if (NotPrimaryExpression)
1795 *NotPrimaryExpression =
true;
1796 Res = ParseExpressionTrait();
1800 if (NotPrimaryExpression)
1801 *NotPrimaryExpression =
true;
1803 return ParseObjCAtExpression(AtLoc);
1806 Res = ParseBlockLiteralExpression();
1808 case tok::code_completion: {
1814#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait:
1815#include "clang/Basic/TransformTypeTraits.def"
1820 Diag(Tok, diag::ext_keyword_as_ident)
1822 goto ParseIdentifier;
1824 goto ExpectedExpression;
1833 Res = TryParseLambdaExpression();
1837 if (NotPrimaryExpression)
1838 *NotPrimaryExpression =
true;
1839 Res = ParseObjCMessageExpression();
1843 Res = ParseLambdaExpression();
1847 Res = ParseObjCMessageExpression();
1861 if (ParseKind == PrimaryExprOnly)
1876 case tok::minusminus:
1894 Diag(Tok.
getLocation(), diag::err_postfix_after_unary_requires_parens)
1902 PreferredType = SavedType;
1903 Res = ParsePostfixExpressionSuffix(Res);
1905 !
getActions().getOpenCLOptions().isAvailableOption(
1907 if (
Expr *PostfixExpr = Res.
get()) {
1908 QualType Ty = PostfixExpr->getType();
1910 Diag(PostfixExpr->getExprLoc(),
1911 diag::err_opencl_taking_function_address_parser);
1941Parser::ParsePostfixExpressionSuffix(
ExprResult LHS) {
1945 auto SavedType = PreferredType;
1948 PreferredType = SavedType;
1950 case tok::code_completion:
1951 if (InMessageExpression)
1959 case tok::identifier:
1966 nullptr, LHS.
get());
1974 case tok::l_square: {
1982 isSimpleObjCMessageExpression())
1987 if (CheckProhibitedCXX11Attribute()) {
1993 Loc = T.getOpenLocation();
1996 ExprVector ArgExprs;
1997 bool HasError =
false;
2004 if ((!
getLangOpts().OpenMP && !AllowOpenACCArraySections) ||
2005 Tok.
isNot(tok::colon)) {
2009 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
2010 Idx = ParseBraceInitializer();
2019 ArgExprs.push_back(Idx.
get());
2021 }
else if (Tok.
isNot(tok::r_square)) {
2022 if (ParseExpressionList(ArgExprs)) {
2033 if (ArgExprs.size() <= 1 && AllowOpenACCArraySections) {
2035 if (Tok.
is(tok::colon)) {
2040 }
else if (ArgExprs.size() <= 1 &&
getLangOpts().OpenMP) {
2042 if (Tok.
is(tok::colon)) {
2045 if (Tok.
isNot(tok::r_square) &&
2053 (OMPClauseKind == llvm::omp::Clause::OMPC_to ||
2054 OMPClauseKind == llvm::omp::Clause::OMPC_from) &&
2055 Tok.
is(tok::colon)) {
2058 if (Tok.
isNot(tok::r_square)) {
2067 if (!LHS.
isInvalid() && !HasError && !Length.isInvalid() &&
2077 LHS.
get(), Loc, ArgExprs.empty() ?
nullptr : ArgExprs[0],
2078 ColonLocFirst, ColonLocSecond, Length.get(), Stride.
get(), RLoc);
2093 case tok::lesslessless: {
2098 Expr *ExecConfig =
nullptr;
2102 if (OpKind == tok::lesslessless) {
2103 ExprVector ExecConfigExprs;
2106 if (ParseSimpleExpressionList(ExecConfigExprs)) {
2117 Diag(Tok, diag::err_expected) << tok::greatergreatergreater;
2118 Diag(OpenLoc, diag::note_matching) << tok::lesslessless;
2124 if (ExpectAndConsume(tok::l_paren))
2127 Loc = PrevTokLocation;
2138 ExecConfig = ECResult.
get();
2142 Loc = PT.getOpenLocation();
2145 ExprVector ArgExprs;
2146 auto RunSignatureHelp = [&]() ->
QualType {
2148 LHS.
get(), ArgExprs, PT.getOpenLocation());
2149 CalledSignatureHelp =
true;
2150 return PreferredType;
2152 if (OpKind == tok::l_paren || !LHS.
isInvalid()) {
2153 if (Tok.
isNot(tok::r_paren)) {
2154 if (ParseExpressionList(ArgExprs, [&] {
2155 PreferredType.enterFunctionArgument(Tok.
getLocation(),
2167 for (
auto &E : ArgExprs)
2176 }
else if (Tok.
isNot(tok::r_paren)) {
2177 bool HadDelayedTypo =
false;
2179 HadDelayedTypo =
true;
2180 for (
auto &E : ArgExprs)
2182 HadDelayedTypo =
true;
2197 ArgExprs.insert(ArgExprs.begin(), Fn);
2215 bool MayBePseudoDestructor =
false;
2218 PreferredType.enterMemAccess(Actions, Tok.
getLocation(), OrigLHS);
2222 const Type* BaseType =
Base->getType().getTypePtrOrNull();
2223 if (BaseType && Tok.
is(tok::l_paren) &&
2226 Diag(OpLoc, diag::err_function_is_not_record)
2227 << OpKind <<
Base->getSourceRange()
2229 return ParsePostfixExpressionSuffix(
Base);
2234 MayBePseudoDestructor);
2239 if (Tok.
is(tok::code_completion)) {
2245 ParseOptionalCXXScopeSpecifier(
2247 false, &MayBePseudoDestructor);
2249 ObjectType =
nullptr;
2252 if (Tok.
is(tok::code_completion)) {
2254 OpKind == tok::arrow ? tok::period : tok::arrow;
2261 getCurScope(), OrigLHS, OpLoc, CorrectedOpKind, ObjectType,
2262 MayBePseudoDestructor);
2266 Expr *CorrectedBase = CorrectedLHS.get();
2268 CorrectedBase =
Base;
2274 Base && ExprStatementTokLoc ==
Base->getBeginLoc(),
2280 if (MayBePseudoDestructor && !LHS.
isInvalid()) {
2281 LHS = ParseCXXPseudoDestructor(LHS.
get(), OpLoc, OpKind, SS,
2296 Tok.
is(tok::kw_class)) {
2306 Name.setIdentifier(
Id, Loc);
2313 false, &TemplateKWLoc, Name)) {
2320 OpKind, SS, TemplateKWLoc, Name,
2321 CurParsedObjCImpl ? CurParsedObjCImpl->Dcl
2324 if (Tok.
is(tok::less))
2325 checkPotentialAngleBracket(LHS);
2326 }
else if (OrigLHS && Name.isValid()) {
2329 Name.getEndLoc(), {OrigLHS});
2334 case tok::minusminus:
2382Parser::ParseExprAfterUnaryExprOrTypeTrait(
const Token &OpTok,
2387 assert(OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual, tok::kw_sizeof,
2388 tok::kw___datasizeof, tok::kw___alignof, tok::kw_alignof,
2389 tok::kw__Alignof, tok::kw_vec_step,
2390 tok::kw___builtin_omp_required_simd_align,
2391 tok::kw___builtin_vectorelements) &&
2392 "Not a typeof/sizeof/alignof/vec_step expression!");
2397 if (Tok.
isNot(tok::l_paren)) {
2400 if (OpTok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2401 tok::kw_alignof, tok::kw__Alignof)) {
2402 if (isTypeIdUnambiguously()) {
2404 ParseSpecifierQualifierList(DS);
2407 ParseDeclarator(DeclaratorInfo);
2413 diag::err_expected_parentheses_around_typename)
2416 Diag(LParenLoc, diag::err_expected_parentheses_around_typename)
2426 if (OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual) &&
2433 Operand = ParseCastExpression(UnaryExprOnly);
2439 ParenParseOption ExprType =
CastExpr;
2442 Operand = ParseParenExpression(ExprType,
true,
2443 false, CastTy, RParenLoc);
2454 !OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual)) {
2471ExprResult Parser::ParseSYCLUniqueStableNameExpression() {
2472 assert(Tok.
is(tok::kw___builtin_sycl_unique_stable_name) &&
2473 "Not __builtin_sycl_unique_stable_name");
2479 if (T.expectAndConsume(diag::err_expected_lparen_after,
2480 "__builtin_sycl_unique_stable_name"))
2490 if (T.consumeClose())
2494 T.getCloseLocation(), Ty.
get());
2511ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
2512 assert(Tok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2513 tok::kw_alignof, tok::kw__Alignof, tok::kw_vec_step,
2514 tok::kw___builtin_omp_required_simd_align,
2515 tok::kw___builtin_vectorelements) &&
2516 "Not a sizeof/alignof/vec_step expression!");
2521 if (Tok.
is(tok::ellipsis) && OpTok.
is(tok::kw_sizeof)) {
2526 if (Tok.
is(tok::l_paren)) {
2529 LParenLoc = T.getOpenLocation();
2530 if (Tok.
is(tok::identifier)) {
2534 RParenLoc = T.getCloseLocation();
2538 Diag(Tok, diag::err_expected_parameter_pack);
2541 }
else if (Tok.
is(tok::identifier)) {
2546 Diag(LParenLoc, diag::err_paren_sizeof_parameter_pack)
2551 Diag(Tok, diag::err_sizeof_parameter_pack);
2568 OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2569 Diag(OpTok, diag::warn_cxx98_compat_alignof);
2571 Diag(OpTok, diag::warn_c23_compat_keyword) << OpTok.
getName();
2587 case tok::kw_alignof:
2588 case tok::kw__Alignof:
2589 ExprKind = UETT_AlignOf;
2591 case tok::kw___alignof:
2592 ExprKind = UETT_PreferredAlignOf;
2594 case tok::kw_vec_step:
2595 ExprKind = UETT_VecStep;
2597 case tok::kw___builtin_omp_required_simd_align:
2598 ExprKind = UETT_OpenMPRequiredSimdAlign;
2600 case tok::kw___datasizeof:
2601 ExprKind = UETT_DataSizeOf;
2603 case tok::kw___builtin_vectorelements:
2604 ExprKind = UETT_VectorElements;
2617 if (OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2653ExprResult Parser::ParseBuiltinPrimaryExpression() {
2661 if (Tok.
isNot(tok::l_paren))
2662 return ExprError(
Diag(Tok, diag::err_expected_after) << BuiltinII
2671 default: llvm_unreachable(
"Not a builtin primary expression!");
2672 case tok::kw___builtin_va_arg: {
2675 if (ExpectAndConsume(tok::comma)) {
2682 if (Tok.
isNot(tok::r_paren)) {
2683 Diag(Tok, diag::err_expected) << tok::r_paren;
2693 case tok::kw___builtin_offsetof: {
2699 if (MacroName ==
"offsetof")
2712 if (ExpectAndConsume(tok::comma)) {
2718 if (Tok.
isNot(tok::identifier)) {
2719 Diag(Tok, diag::err_expected) << tok::identifier;
2728 Comps.back().isBrackets =
false;
2730 Comps.back().LocStart = Comps.back().LocEnd =
ConsumeToken();
2734 if (Tok.
is(tok::period)) {
2737 Comps.back().isBrackets =
false;
2740 if (Tok.
isNot(tok::identifier)) {
2741 Diag(Tok, diag::err_expected) << tok::identifier;
2747 }
else if (Tok.
is(tok::l_square)) {
2748 if (CheckProhibitedCXX11Attribute())
2753 Comps.back().isBrackets =
true;
2756 Comps.back().LocStart = ST.getOpenLocation();
2762 Comps.back().U.E = Res.
get();
2765 Comps.back().LocEnd = ST.getCloseLocation();
2767 if (Tok.
isNot(tok::r_paren)) {
2776 PT.getCloseLocation());
2783 case tok::kw___builtin_choose_expr: {
2785 if (Cond.isInvalid()) {
2789 if (ExpectAndConsume(tok::comma)) {
2795 if (Expr1.isInvalid()) {
2799 if (ExpectAndConsume(tok::comma)) {
2805 if (Expr2.isInvalid()) {
2809 if (Tok.
isNot(tok::r_paren)) {
2810 Diag(Tok, diag::err_expected) << tok::r_paren;
2814 Expr2.get(), ConsumeParen());
2817 case tok::kw___builtin_astype: {
2820 if (
Expr.isInvalid()) {
2825 if (ExpectAndConsume(tok::comma)) {
2836 if (Tok.
isNot(tok::r_paren)) {
2837 Diag(Tok, diag::err_expected) << tok::r_paren;
2846 case tok::kw___builtin_convertvector: {
2849 if (
Expr.isInvalid()) {
2854 if (ExpectAndConsume(tok::comma)) {
2865 if (Tok.
isNot(tok::r_paren)) {
2866 Diag(Tok, diag::err_expected) << tok::r_paren;
2875 case tok::kw___builtin_COLUMN:
2876 case tok::kw___builtin_FILE:
2877 case tok::kw___builtin_FILE_NAME:
2878 case tok::kw___builtin_FUNCTION:
2879 case tok::kw___builtin_FUNCSIG:
2880 case tok::kw___builtin_LINE:
2881 case tok::kw___builtin_source_location: {
2883 if (Tok.
isNot(tok::r_paren)) {
2884 Diag(Tok, diag::err_expected) << tok::r_paren;
2890 case tok::kw___builtin_FILE:
2892 case tok::kw___builtin_FILE_NAME:
2894 case tok::kw___builtin_FUNCTION:
2896 case tok::kw___builtin_FUNCSIG:
2898 case tok::kw___builtin_LINE:
2900 case tok::kw___builtin_COLUMN:
2902 case tok::kw___builtin_source_location:
2905 llvm_unreachable(
"invalid keyword");
2918 return ParsePostfixExpressionSuffix(Res.
get());
2921bool Parser::tryParseOpenMPArrayShapingCastPart() {
2922 assert(Tok.
is(tok::l_square) &&
"Expected open bracket");
2923 bool ErrorFound =
true;
2924 TentativeParsingAction TPA(*
this);
2926 if (Tok.
isNot(tok::l_square))
2931 while (!
SkipUntil(tok::r_square, tok::annot_pragma_openmp_end,
2934 if (Tok.
isNot(tok::r_square))
2939 if (Tok.
is(tok::r_paren)) {
2943 }
while (Tok.
isNot(tok::annot_pragma_openmp_end));
2976Parser::ParseParenExpression(ParenParseOption &ExprType,
bool stopIfCastExpr,
2979 assert(Tok.
is(tok::l_paren) &&
"Not a paren expr!");
2982 if (T.consumeOpen())
2986 PreferredType.enterParenExpr(Tok.
getLocation(), OpenLoc);
2989 bool isAmbiguousTypeId;
2992 if (Tok.
is(tok::code_completion)) {
2996 ExprType >= CompoundLiteral);
3003 tok::kw___bridge_transfer,
3004 tok::kw___bridge_retained,
3005 tok::kw___bridge_retain));
3006 if (BridgeCast && !
getLangOpts().ObjCAutoRefCount) {
3008 StringRef BridgeCastName = Tok.
getName();
3011 Diag(BridgeKeywordLoc, diag::warn_arc_bridge_cast_nonarc)
3021 Diag(Tok, OpenLoc.
isMacroID() ? diag::ext_gnu_statement_expr_macro
3022 : diag::ext_gnu_statement_expr);
3024 checkCompoundToken(OpenLoc, tok::l_paren, CompoundToken::StmtExprBegin);
3033 while (CodeDC->
isRecord() || isa<EnumDecl>(CodeDC)) {
3036 "statement expr not in code context");
3046 if (!
Stmt.isInvalid()) {
3053 }
else if (ExprType >= CompoundLiteral && BridgeCast) {
3059 if (tokenKind == tok::kw___bridge)
3061 else if (tokenKind == tok::kw___bridge_transfer)
3063 else if (tokenKind == tok::kw___bridge_retained)
3068 assert(tokenKind == tok::kw___bridge_retain);
3071 Diag(BridgeKeywordLoc, diag::err_arc_bridge_retain)
3073 "__bridge_retained");
3078 ColonProtection.restore();
3079 RParenLoc = T.getCloseLocation();
3082 ExprResult SubExpr = ParseCastExpression(AnyCastExpr);
3088 BridgeKeywordLoc, Ty.
get(),
3089 RParenLoc, SubExpr.
get());
3090 }
else if (ExprType >= CompoundLiteral &&
3091 isTypeIdInParens(isAmbiguousTypeId)) {
3100 if (isAmbiguousTypeId && !stopIfCastExpr) {
3101 ExprResult res = ParseCXXAmbiguousParenExpression(ExprType, CastTy, T,
3103 RParenLoc = T.getCloseLocation();
3109 ParseSpecifierQualifierList(DS);
3112 ParseDeclarator(DeclaratorInfo);
3117 if (!DeclaratorInfo.isInvalidType() && Tok.
is(tok::identifier) &&
3131 ColonProtection.restore();
3132 RParenLoc = T.getCloseLocation();
3133 if (Tok.
is(tok::l_brace)) {
3134 ExprType = CompoundLiteral;
3140 return ParseCompoundLiteralExpression(Ty.
get(), OpenLoc, RParenLoc);
3143 if (Tok.
is(tok::l_paren)) {
3164 Result = ParseCastExpression(AnyCastExpr,
3169 if (!
Result.isInvalid()) {
3171 DeclaratorInfo, CastTy,
3172 RParenLoc,
Result.get());
3176 if (!
Result.isInvalid()) {
3188 if (DeclaratorInfo.isInvalidType())
3193 if (stopIfCastExpr) {
3207 GetLookAheadToken(1).isNot(tok::period)) {
3216 Result = ParseCastExpression(AnyCastExpr,
3219 if (!
Result.isInvalid()) {
3221 DeclaratorInfo, CastTy,
3222 RParenLoc,
Result.get());
3227 Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
3230 }
else if (ExprType >= FoldExpr && Tok.
is(tok::ellipsis) &&
3232 ExprType = FoldExpr;
3234 }
else if (isTypeCast) {
3237 ExprVector ArgExprs;
3239 if (!ParseSimpleExpressionList(ArgExprs)) {
3242 if (ExprType >= FoldExpr && ArgExprs.size() == 1 &&
3244 ExprType = FoldExpr;
3245 return ParseFoldExpression(ArgExprs[0], T);
3248 ExprType = SimpleExpr;
3252 }
else if (
getLangOpts().OpenMP >= 50 && OpenMPDirectiveParsing &&
3253 ExprType ==
CastExpr && Tok.
is(tok::l_square) &&
3254 tryParseOpenMPArrayShapingCastPart()) {
3255 bool ErrorFound =
false;
3265 while (!
SkipUntil(tok::r_square, tok::r_paren,
3270 OMPDimensions.push_back(NumElements.
get());
3271 OMPBracketsRanges.push_back(TS.getRange());
3272 }
while (Tok.
isNot(tok::r_paren));
3275 RParenLoc = T.getCloseLocation();
3279 }
else if (!
Result.isInvalid()) {
3281 Result.get(), OpenLoc, RParenLoc, OMPDimensions, OMPBracketsRanges);
3294 if (ExprType >= FoldExpr && isFoldOperator(Tok.
getKind()) &&
3296 ExprType = FoldExpr;
3297 return ParseFoldExpression(
Result, T);
3299 ExprType = SimpleExpr;
3302 if (!
Result.isInvalid() && Tok.
is(tok::r_paren))
3308 if (
Result.isInvalid()) {
3314 RParenLoc = T.getCloseLocation();
3327Parser::ParseCompoundLiteralExpression(
ParsedType Ty,
3330 assert(Tok.
is(tok::l_brace) &&
"Not a compound literal!");
3332 Diag(LParenLoc, diag::ext_c99_compound_literal);
3335 if (!
Result.isInvalid() && Ty)
3361 "Not a string-literal-like token!");
3369 StringToks.push_back(Tok);
3374 assert(!AllowUserDefinedLiteral &&
"UDL are always evaluated");
3403ExprResult Parser::ParseGenericSelectionExpression() {
3404 assert(Tok.
is(tok::kw__Generic) &&
"_Generic keyword expected");
3406 diagnoseUseOfC11Keyword(Tok);
3410 if (T.expectAndConsume())
3417 if (isTypeIdForGenericSelection()) {
3423 const auto *LIT = cast<LocInfoType>(ControllingType.
get().get());
3424 SourceLocation Loc = LIT->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
3425 Diag(Loc, diag::ext_generic_with_type_arg);
3439 if (ExpectAndConsume(tok::comma)) {
3449 if (Tok.
is(tok::kw_default)) {
3453 Diag(Tok, diag::err_duplicate_default_assoc);
3454 Diag(DefaultLoc, diag::note_previous_default_assoc);
3469 Types.push_back(Ty);
3471 if (ExpectAndConsume(tok::colon)) {
3480 if (ER.isInvalid()) {
3484 Exprs.push_back(ER.get());
3488 if (T.getCloseLocation().isInvalid())
3491 void *ExprOrTy = ControllingExpr.
isUsable()
3492 ? ControllingExpr.
get()
3493 : ControllingType.
get().getAsOpaquePtr();
3496 KeyLoc, DefaultLoc, T.getCloseLocation(), ControllingExpr.
isUsable(),
3497 ExprOrTy, Types, Exprs);
3519 assert(isFoldOperator(Kind) &&
"missing fold-operator");
3523 assert(Tok.
is(tok::ellipsis) &&
"not a fold-expression");
3527 if (Tok.
isNot(tok::r_paren)) {
3528 if (!isFoldOperator(Tok.
getKind()))
3531 if (Kind != tok::unknown && Tok.
getKind() != Kind)
3545 ? diag::warn_cxx14_compat_fold_expression
3546 : diag::ext_fold_expression);
3550 Kind, EllipsisLoc, RHS.
get(),
3577 llvm::function_ref<
void()> ExpressionStarts,
3578 bool FailImmediatelyOnInvalidExpr,
3579 bool EarlyTypoCorrection) {
3580 bool SawError =
false;
3582 if (ExpressionStarts)
3587 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3588 Expr = ParseBraceInitializer();
3592 if (EarlyTypoCorrection)
3595 if (Tok.
is(tok::ellipsis))
3597 else if (Tok.
is(tok::code_completion)) {
3607 if (
Expr.isInvalid()) {
3609 if (FailImmediatelyOnInvalidExpr)
3613 Exprs.push_back(
Expr.get());
3616 if (Tok.
isNot(tok::comma))
3621 checkPotentialAngleBracketDelimiter(Comma);
3626 for (
auto &E : Exprs) {
3628 if (
Expr.isUsable()) E =
Expr.get();
3645 if (
Expr.isInvalid())
3648 Exprs.push_back(
Expr.get());
3658 checkPotentialAngleBracketDelimiter(Comma);
3669 if (Tok.
is(tok::code_completion)) {
3677 ParseSpecifierQualifierList(DS);
3683 ParseDeclarator(DeclaratorInfo);
3685 MaybeParseGNUAttributes(DeclaratorInfo);
3701ExprResult Parser::ParseBlockLiteralExpression() {
3702 assert(Tok.
is(tok::caret) &&
"block literal starts with ^");
3706 "block literal parsing");
3729 if (Tok.
is(tok::l_paren)) {
3730 ParseParenDeclarator(ParamInfo);
3735 ParamInfo.SetIdentifier(
nullptr, CaretLoc);
3736 ParamInfo.SetRangeEnd(Tmp);
3737 if (ParamInfo.isInvalidType()) {
3745 MaybeParseGNUAttributes(ParamInfo);
3749 }
else if (!Tok.
is(tok::l_brace)) {
3750 ParseBlockId(CaretLoc);
3754 ParamInfo.AddTypeInfo(
3772 CaretLoc, CaretLoc, ParamInfo),
3775 MaybeParseGNUAttributes(ParamInfo);
3783 if (!Tok.
is(tok::l_brace)) {
3785 Diag(Tok, diag::err_expected_expression);
3792 if (!
Stmt.isInvalid())
3812 llvm::SmallSet<StringRef, 4> Platforms;
3813 bool HasOtherPlatformSpec =
false;
3815 for (
const auto &Spec : AvailSpecs) {
3816 if (Spec.isOtherPlatformSpec()) {
3817 if (HasOtherPlatformSpec) {
3818 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_star);
3822 HasOtherPlatformSpec =
true;
3826 bool Inserted = Platforms.insert(Spec.getPlatform()).second;
3831 StringRef Platform = Spec.getPlatform();
3832 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_platform)
3833 << Spec.getEndLoc() << Platform;
3838 if (!HasOtherPlatformSpec) {
3839 SourceLocation InsertWildcardLoc = AvailSpecs.back().getEndLoc();
3840 P.Diag(InsertWildcardLoc, diag::err_availability_query_wildcard_required)
3853std::optional<AvailabilitySpec> Parser::ParseAvailabilitySpec() {
3854 if (Tok.
is(tok::star)) {
3858 if (Tok.
is(tok::code_completion)) {
3861 return std::nullopt;
3863 if (Tok.
isNot(tok::identifier)) {
3864 Diag(Tok, diag::err_avail_query_expected_platform_name);
3865 return std::nullopt;
3870 VersionTuple Version = ParseVersionTuple(VersionRange);
3872 if (Version.empty())
3873 return std::nullopt;
3875 StringRef GivenPlatform = PlatformIdentifier->
Ident->
getName();
3876 StringRef Platform =
3877 AvailabilityAttr::canonicalizePlatformName(GivenPlatform);
3879 if (AvailabilityAttr::getPrettyPlatformName(Platform).empty() ||
3880 (GivenPlatform.contains(
"xros") || GivenPlatform.contains(
"xrOS"))) {
3882 diag::err_avail_query_unrecognized_platform_name)
3884 return std::nullopt;
3893 assert(Tok.
is(tok::kw___builtin_available) ||
3900 if (
Parens.expectAndConsume())
3904 bool HasError =
false;
3906 std::optional<AvailabilitySpec> Spec = ParseAvailabilitySpec();
3910 AvailSpecs.push_back(*Spec);
3923 if (
Parens.consumeClose())
3927 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...
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 { ....
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.
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.
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)
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)
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
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 ActOnSYCLUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
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)
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
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 ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
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.
@ 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.