40#include "llvm/ADT/SmallVector.h"
134 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
145 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
152Parser::ParseExpressionWithLeadingExtension(
SourceLocation ExtLoc) {
158 LHS = ParseCastExpression(AnyCastExpr);
161 if (!LHS.isInvalid())
165 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
170 if (Tok.
is(tok::code_completion)) {
177 if (Tok.
is(tok::kw_throw))
178 return ParseThrowExpression();
179 if (Tok.
is(tok::kw_co_yield))
180 return ParseCoyieldExpression();
182 ExprResult LHS = ParseCastExpression(AnyCastExpr,
189 if (Tok.
is(tok::code_completion)) {
211Parser::ParseAssignmentExprWithObjCMessageExprStart(
SourceLocation LBracLoc,
214 Expr *ReceiverExpr) {
216 = ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
217 ReceiverType, ReceiverExpr);
218 R = ParsePostfixExpressionSuffix(R);
226 "Call this function only if your ExpressionEvaluationContext is "
227 "already ConstantEvaluated");
228 ExprResult LHS(ParseCastExpression(AnyCastExpr,
false, isTypeCast));
248 Actions.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
269 ExprResult LHS(ParseCastExpression(AnyCastExpr));
291 bool NotPrimaryExpression =
false;
292 auto ParsePrimary = [&] () {
293 ExprResult E = ParseCastExpression(PrimaryExprOnly,
297 &NotPrimaryExpression);
301 E = ParsePostfixExpressionSuffix(E);
308 ? diag::note_unparenthesized_non_primary_expr_in_requires_clause
309 : diag::err_unparenthesized_non_primary_expr_in_requires_clause)
317 if (NotPrimaryExpression ||
324 Tok.
isOneOf(tok::period, tok::plusplus, tok::minusminus) ||
325 (Tok.
is(tok::l_square) && !
NextToken().is(tok::l_square))) {
326 E = RecoverFromNonPrimary(E,
false);
329 NotPrimaryExpression =
false;
331 bool PossibleNonPrimary;
332 bool IsConstraintExpr =
334 IsTrailingRequiresClause);
335 if (!IsConstraintExpr || PossibleNonPrimary) {
340 if (PossibleNonPrimary)
341 E = RecoverFromNonPrimary(E, !IsConstraintExpr);
350 while (Tok.
is(tok::ampamp)) {
358 tok::ampamp, LHS.
get(), RHS.
get());
384 while (Tok.
is(tok::pipepipe)) {
393 tok::pipepipe, LHS.
get(), RHS.
get());
404bool Parser::isNotExpressionStart() {
406 if (K == tok::l_brace || K == tok::r_brace ||
407 K == tok::kw_for || K == tok::kw_while ||
408 K == tok::kw_if || K == tok::kw_else ||
409 K == tok::kw_goto || K == tok::kw_try)
412 return isKnownToBeDeclarationSpecifier();
415bool Parser::isFoldOperator(
prec::Level Level)
const {
429 GreaterThanIsOperator,
433 auto SavedType = PreferredType;
436 PreferredType = SavedType;
440 if (NextTokPrec < MinPrec)
447 if (OpToken.
is(tok::caretcaret)) {
448 return ExprError(
Diag(Tok, diag::err_opencl_logical_exclusive_or));
453 if (OpToken.
isOneOf(tok::comma, tok::greater, tok::greatergreater,
454 tok::greatergreatergreater) &&
455 checkPotentialAngleBracketDelimiter(OpToken))
463 if (OpToken.
is(tok::comma) && isNotExpressionStart()) {
471 if (isFoldOperator(NextTokPrec) && Tok.
is(tok::ellipsis)) {
485 Tok.
isOneOf(tok::colon, tok::r_square) &&
498 TernaryMiddle = ParseBraceInitializer();
499 if (!TernaryMiddle.isInvalid()) {
500 Diag(BraceLoc, diag::err_init_list_bin_op)
505 }
else if (Tok.
isNot(tok::colon)) {
517 TernaryMiddle =
nullptr;
518 Diag(Tok, diag::ext_gnu_conditional_expr);
521 if (TernaryMiddle.isInvalid()) {
524 TernaryMiddle =
nullptr;
533 const char *FIText =
": ";
537 bool IsInvalid =
false;
538 const char *SourcePtr =
540 if (!IsInvalid && *SourcePtr ==
' ') {
543 if (!IsInvalid && *SourcePtr ==
' ') {
550 Diag(Tok, diag::err_expected)
552 Diag(OpToken, diag::note_matching) << tok::question;
570 bool RHSIsInitList =
false;
572 RHS = ParseBraceInitializer();
573 RHSIsInitList =
true;
577 RHS = ParseCastExpression(AnyCastExpr);
583 if (TernaryMiddle.isUsable())
600 if (ThisPrec < NextTokPrec ||
601 (ThisPrec == NextTokPrec && isRightAssoc)) {
603 Diag(Tok, diag::err_init_list_bin_op)
612 RHS = ParseRHSOfBinaryExpression(RHS,
613 static_cast<prec::Level>(ThisPrec + !isRightAssoc));
614 RHSIsInitList =
false;
620 if (TernaryMiddle.isUsable())
631 Diag(OpToken, diag::warn_cxx98_compat_generalized_initializer_lists)
633 }
else if (ColonLoc.
isValid()) {
634 Diag(ColonLoc, diag::err_init_list_bin_op)
639 Diag(OpToken, diag::err_init_list_bin_op)
649 if (TernaryMiddle.isInvalid()) {
653 if (!GreaterThanIsOperator && OpToken.
is(tok::greatergreater))
655 diag::warn_cxx11_right_shift_in_template_arg,
665 {LHS.get(), RHS.get()});
673 std::vector<clang::Expr *> Args;
675 if (TernaryMiddle.get())
676 Args = {LHS.
get(), TernaryMiddle.get(), RHS.
get()};
678 Args = {LHS.
get(), RHS.
get()};
706ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
707 bool isAddressOfOperand,
708 TypeCastState isTypeCast,
709 bool isVectorLiteral,
710 bool *NotPrimaryExpression) {
712 ExprResult Res = ParseCastExpression(ParseKind,
717 NotPrimaryExpression);
719 Diag(Tok, diag::err_expected_expression);
726 CastExpressionIdValidator(
Token Next,
bool AllowTypes,
bool AllowNonTypes)
727 : NextToken(Next), AllowNonTypes(AllowNonTypes) {
728 WantTypeSpecifiers = WantFunctionLikeCasts = AllowTypes;
731 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
736 if (isa<TypeDecl>(ND))
737 return WantTypeSpecifiers;
742 if (!NextToken.isOneOf(tok::equal, tok::arrow, tok::period))
745 for (
auto *
C : candidate) {
747 if (isa<ValueDecl>(ND) && !isa<FunctionDecl>(ND))
753 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
754 return std::make_unique<CastExpressionIdValidator>(*
this);
946ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
947 bool isAddressOfOperand,
949 TypeCastState isTypeCast,
950 bool isVectorLiteral,
951 bool *NotPrimaryExpression) {
954 auto SavedType = PreferredType;
960 bool AllowSuffix =
true;
976 ParenParseOption ParenExprType;
978 case CastParseKind::UnaryExprOnly:
981 case CastParseKind::AnyCastExpr:
982 ParenExprType = ParenParseOption::CastExpr;
984 case CastParseKind::PrimaryExprOnly:
985 ParenExprType = FoldExpr;
990 Res = ParseParenExpression(ParenExprType,
false,
999 switch (ParenExprType) {
1000 case SimpleExpr:
break;
1002 case CompoundLiteral:
1020 case tok::numeric_constant:
1030 Res = ParseCXXBoolLiteral();
1033 case tok::kw___objc_yes:
1034 case tok::kw___objc_no:
1035 Res = ParseObjCBoolLiteral();
1038 case tok::kw_nullptr:
1040 Diag(Tok, diag::warn_cxx98_compat_nullptr);
1043 : diag::ext_c_nullptr) << Tok.
getName();
1048 case tok::annot_primary_expr:
1049 case tok::annot_overload_set:
1050 Res = getExprAnnotation(Tok);
1053 ConsumeAnnotationToken();
1055 checkPotentialAngleBracket(Res);
1058 case tok::annot_non_type:
1059 case tok::annot_non_type_dependent:
1060 case tok::annot_non_type_undeclared: {
1063 Res = tryParseCXXIdExpression(SS, isAddressOfOperand, Replacement);
1065 "should not perform typo correction on annotation token");
1069 case tok::kw___super:
1070 case tok::kw_decltype:
1074 assert(Tok.
isNot(tok::kw_decltype) && Tok.
isNot(tok::kw___super));
1075 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1076 isVectorLiteral, NotPrimaryExpression);
1078 case tok::identifier:
1089 if (Next.is(tok::ellipsis) && Tok.
is(tok::identifier) &&
1090 GetLookAheadToken(2).is(tok::l_square)) {
1095 Tok.
is(tok::annot_pack_indexing_type))
1096 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1097 isVectorLiteral, NotPrimaryExpression);
1103 else if (Next.is(tok::l_paren) && Tok.
is(tok::identifier) &&
1107 if (RevertibleTypeTraits.empty()) {
1108#define RTT_JOIN(X,Y) X##Y
1109#define REVERTIBLE_TYPE_TRAIT(Name) \
1110 RevertibleTypeTraits[PP.getIdentifierInfo(#Name)] \
1111 = RTT_JOIN(tok::kw_,Name)
1171#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
1172 REVERTIBLE_TYPE_TRAIT(RTT_JOIN(__, Trait));
1173#include "clang/Basic/TransformTypeTraits.def"
1174#undef REVERTIBLE_TYPE_TRAIT
1181 llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind>::iterator Known
1182 = RevertibleTypeTraits.find(II);
1183 if (Known != RevertibleTypeTraits.end()) {
1185 return ParseCastExpression(ParseKind, isAddressOfOperand,
1186 NotCastExpr, isTypeCast,
1187 isVectorLiteral, NotPrimaryExpression);
1191 else if ((!ColonIsSacred && Next.is(tok::colon)) ||
1192 Next.isOneOf(tok::coloncolon, tok::less, tok::l_paren,
1197 if (!Tok.
is(tok::identifier))
1198 return ParseCastExpression(ParseKind, isAddressOfOperand,
1199 NotCastExpr, isTypeCast,
1201 NotPrimaryExpression);
1214 (&II == Ident_super &&
getCurScope()->isInObjcMethodScope()))) {
1217 if (Tok.
is(tok::code_completion) && &II != Ident_super) {
1220 getCurScope(), II, ILoc, ExprStatementTokLoc == ILoc);
1224 if (Tok.
isNot(tok::identifier) &&
1226 Diag(Tok, diag::err_expected_property_name);
1241 if (
getLangOpts().
ObjC && &II == Ident_super && !InMessageExpression &&
1243 ((Tok.
is(tok::identifier) &&
1245 Tok.
is(tok::code_completion))) {
1246 Res = ParseObjCMessageExpressionBody(
SourceLocation(), ILoc,
nullptr,
1257 ((Tok.
is(tok::identifier) && !InMessageExpression) ||
1258 Tok.
is(tok::code_completion))) {
1260 if (Tok.
is(tok::code_completion) ||
1261 Next.is(tok::colon) || Next.is(tok::r_square))
1263 if (Typ.get()->isObjCObjectOrInterfaceType()) {
1266 DS.SetRangeStart(ILoc);
1267 DS.SetRangeEnd(ILoc);
1268 const char *PrevSpec =
nullptr;
1270 DS.SetTypeSpecType(
TST_typename, ILoc, PrevSpec, DiagID, Typ,
1287 if (isAddressOfOperand && isPostfixExpressionSuffixStart())
1288 isAddressOfOperand =
false;
1297 CastExpressionIdValidator Validator(
1301 Validator.IsAddressOfOperand = isAddressOfOperand;
1302 if (Tok.
isOneOf(tok::periodstar, tok::arrowstar)) {
1303 Validator.WantExpressionKeywords =
false;
1304 Validator.WantRemainingKeywords =
false;
1306 Validator.WantRemainingKeywords = Tok.
isNot(tok::r_paren);
1308 Name.setIdentifier(&II, ILoc);
1310 getCurScope(), ScopeSpec, TemplateKWLoc, Name, Tok.
is(tok::l_paren),
1311 isAddressOfOperand, &Validator,
1313 Tok.
is(tok::r_paren) ?
nullptr : &Replacement);
1315 UnconsumeToken(Replacement);
1316 return ParseCastExpression(ParseKind, isAddressOfOperand,
1317 NotCastExpr, isTypeCast,
1319 NotPrimaryExpression);
1321 Res = tryParseCXXPackIndexingExpression(Res);
1323 checkPotentialAngleBracket(Res);
1326 case tok::char_constant:
1327 case tok::wide_char_constant:
1328 case tok::utf8_char_constant:
1329 case tok::utf16_char_constant:
1330 case tok::utf32_char_constant:
1334 case tok::kw___func__:
1335 case tok::kw___FUNCTION__:
1336 case tok::kw___FUNCDNAME__:
1337 case tok::kw___FUNCSIG__:
1338 case tok::kw_L__FUNCTION__:
1339 case tok::kw_L__FUNCSIG__:
1340 case tok::kw___PRETTY_FUNCTION__:
1352 case tok::string_literal:
1353 case tok::wide_string_literal:
1354 case tok::utf8_string_literal:
1355 case tok::utf16_string_literal:
1356 case tok::utf32_string_literal:
1359 case tok::kw__Generic:
1360 Res = ParseGenericSelectionExpression();
1362 case tok::kw___builtin_available:
1363 Res = ParseAvailabilityCheckExpr(Tok.
getLocation());
1365 case tok::kw___builtin_va_arg:
1366 case tok::kw___builtin_offsetof:
1367 case tok::kw___builtin_choose_expr:
1368 case tok::kw___builtin_astype:
1369 case tok::kw___builtin_convertvector:
1370 case tok::kw___builtin_COLUMN:
1371 case tok::kw___builtin_FILE:
1372 case tok::kw___builtin_FILE_NAME:
1373 case tok::kw___builtin_FUNCTION:
1374 case tok::kw___builtin_FUNCSIG:
1375 case tok::kw___builtin_LINE:
1376 case tok::kw___builtin_source_location:
1377 if (NotPrimaryExpression)
1378 *NotPrimaryExpression =
true;
1380 return ParseBuiltinPrimaryExpression();
1381 case tok::kw___null:
1386 case tok::minusminus: {
1387 if (NotPrimaryExpression)
1388 *NotPrimaryExpression =
true;
1393 Token SavedTok = Tok;
1402 UnaryExprOnly : AnyCastExpr,
1409 UnconsumeToken(SavedTok);
1423 if (NotPrimaryExpression)
1424 *NotPrimaryExpression =
true;
1429 Res = ParseCastExpression(AnyCastExpr,
true);
1445 case tok::kw___real:
1446 case tok::kw___imag: {
1447 if (NotPrimaryExpression)
1448 *NotPrimaryExpression =
true;
1451 Res = ParseCastExpression(AnyCastExpr);
1455 isAddressOfOperand);
1462 case tok::kw_co_await: {
1463 if (NotPrimaryExpression)
1464 *NotPrimaryExpression =
true;
1466 Res = ParseCastExpression(AnyCastExpr);
1472 case tok::kw___extension__:{
1474 if (NotPrimaryExpression)
1475 *NotPrimaryExpression =
true;
1478 Res = ParseCastExpression(AnyCastExpr);
1483 case tok::kw__Alignof:
1484 diagnoseUseOfC11Keyword(Tok);
1486 case tok::kw_alignof:
1487 case tok::kw___alignof:
1489 case tok::kw_sizeof:
1493 case tok::kw___datasizeof:
1494 case tok::kw_vec_step:
1496 case tok::kw___builtin_omp_required_simd_align:
1497 case tok::kw___builtin_vectorelements:
1498 if (NotPrimaryExpression)
1499 *NotPrimaryExpression =
true;
1500 AllowSuffix =
false;
1501 Res = ParseUnaryExprOrTypeTraitExpression();
1504 if (NotPrimaryExpression)
1505 *NotPrimaryExpression =
true;
1507 if (Tok.
isNot(tok::identifier))
1508 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
1511 return ExprError(
Diag(Tok, diag::err_address_of_label_outside_fn));
1513 Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
1518 AllowSuffix =
false;
1521 case tok::kw_const_cast:
1522 case tok::kw_dynamic_cast:
1523 case tok::kw_reinterpret_cast:
1524 case tok::kw_static_cast:
1525 case tok::kw_addrspace_cast:
1526 if (NotPrimaryExpression)
1527 *NotPrimaryExpression =
true;
1528 Res = ParseCXXCasts();
1530 case tok::kw___builtin_bit_cast:
1531 if (NotPrimaryExpression)
1532 *NotPrimaryExpression =
true;
1533 Res = ParseBuiltinBitCast();
1535 case tok::kw_typeid:
1536 if (NotPrimaryExpression)
1537 *NotPrimaryExpression =
true;
1538 Res = ParseCXXTypeid();
1540 case tok::kw___uuidof:
1541 if (NotPrimaryExpression)
1542 *NotPrimaryExpression =
true;
1543 Res = ParseCXXUuidof();
1546 Res = ParseCXXThis();
1548 case tok::kw___builtin_sycl_unique_stable_name:
1549 Res = ParseSYCLUniqueStableNameExpression();
1552 case tok::annot_typename:
1553 if (isStartOfObjCClassMessageMissingOpenBracket()) {
1561 const char *PrevSpec =
nullptr;
1564 PrevSpec, DiagID,
Type,
1573 ConsumeAnnotationToken();
1580 case tok::annot_decltype:
1581 case tok::annot_pack_indexing_type:
1583 case tok::kw_wchar_t:
1584 case tok::kw_char8_t:
1585 case tok::kw_char16_t:
1586 case tok::kw_char32_t:
1591 case tok::kw___int64:
1592 case tok::kw___int128:
1593 case tok::kw__ExtInt:
1594 case tok::kw__BitInt:
1595 case tok::kw_signed:
1596 case tok::kw_unsigned:
1599 case tok::kw_double:
1600 case tok::kw___bf16:
1601 case tok::kw__Float16:
1602 case tok::kw___float128:
1603 case tok::kw___ibm128:
1606 case tok::kw_typename:
1607 case tok::kw_typeof:
1608 case tok::kw___vector:
1609 case tok::kw__Accum:
1610 case tok::kw__Fract:
1612#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:
1613#include "clang/Basic/OpenCLImageTypes.def"
1616 Diag(Tok, diag::err_expected_expression);
1621 if (NotPrimaryExpression)
1622 *NotPrimaryExpression =
true;
1624 if (SavedKind == tok::kw_typename) {
1641 ParseCXXSimpleTypeSpecifier(DS);
1642 if (Tok.
isNot(tok::l_paren) &&
1644 return ExprError(
Diag(Tok, diag::err_expected_lparen_after_type)
1645 << DS.getSourceRange());
1647 if (Tok.
is(tok::l_brace))
1648 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1650 Res = ParseCXXTypeConstructExpression(DS);
1654 case tok::annot_cxxscope: {
1659 if (!Tok.
is(tok::annot_cxxscope))
1660 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1661 isTypeCast, isVectorLiteral,
1662 NotPrimaryExpression);
1665 if (Next.is(tok::annot_template_id)) {
1672 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
1676 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1677 isTypeCast, isVectorLiteral,
1678 NotPrimaryExpression);
1683 Res = ParseCXXIdExpression(isAddressOfOperand);
1687 case tok::annot_template_id: {
1695 return ParseCastExpression(ParseKind, isAddressOfOperand,
1696 NotCastExpr, isTypeCast, isVectorLiteral,
1697 NotPrimaryExpression);
1704 case tok::kw_operator:
1705 Res = ParseCXXIdExpression(isAddressOfOperand);
1708 case tok::coloncolon: {
1713 if (!Tok.
is(tok::coloncolon))
1714 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1715 isVectorLiteral, NotPrimaryExpression);
1720 if (Tok.
is(tok::kw_new)) {
1721 if (NotPrimaryExpression)
1722 *NotPrimaryExpression =
true;
1723 Res = ParseCXXNewExpression(
true, CCLoc);
1724 AllowSuffix =
false;
1727 if (Tok.
is(tok::kw_delete)) {
1728 if (NotPrimaryExpression)
1729 *NotPrimaryExpression =
true;
1730 Res = ParseCXXDeleteExpression(
true, CCLoc);
1731 AllowSuffix =
false;
1736 Diag(CCLoc, diag::err_expected_expression);
1741 if (NotPrimaryExpression)
1742 *NotPrimaryExpression =
true;
1743 Res = ParseCXXNewExpression(
false, Tok.
getLocation());
1744 AllowSuffix =
false;
1747 case tok::kw_delete:
1748 if (NotPrimaryExpression)
1749 *NotPrimaryExpression =
true;
1750 Res = ParseCXXDeleteExpression(
false, Tok.
getLocation());
1751 AllowSuffix =
false;
1754 case tok::kw_requires:
1755 Res = ParseRequiresExpression();
1756 AllowSuffix =
false;
1759 case tok::kw_noexcept: {
1760 if (NotPrimaryExpression)
1761 *NotPrimaryExpression =
true;
1762 Diag(Tok, diag::warn_cxx98_compat_noexcept_expr);
1766 if (
T.expectAndConsume(diag::err_expected_lparen_after,
"noexcept"))
1779 T.getCloseLocation());
1780 AllowSuffix =
false;
1784#define TYPE_TRAIT(N,Spelling,K) \
1785 case tok::kw_##Spelling:
1786#include "clang/Basic/TokenKinds.def"
1787 Res = ParseTypeTrait();
1790 case tok::kw___array_rank:
1791 case tok::kw___array_extent:
1792 if (NotPrimaryExpression)
1793 *NotPrimaryExpression =
true;
1794 Res = ParseArrayTypeTrait();
1797 case tok::kw___is_lvalue_expr:
1798 case tok::kw___is_rvalue_expr:
1799 if (NotPrimaryExpression)
1800 *NotPrimaryExpression =
true;
1801 Res = ParseExpressionTrait();
1805 if (NotPrimaryExpression)
1806 *NotPrimaryExpression =
true;
1808 return ParseObjCAtExpression(AtLoc);
1811 Res = ParseBlockLiteralExpression();
1813 case tok::code_completion: {
1819#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait:
1820#include "clang/Basic/TransformTypeTraits.def"
1825 Diag(Tok, diag::ext_keyword_as_ident)
1827 goto ParseIdentifier;
1829 goto ExpectedExpression;
1838 Res = TryParseLambdaExpression();
1842 if (NotPrimaryExpression)
1843 *NotPrimaryExpression =
true;
1844 Res = ParseObjCMessageExpression();
1848 Res = ParseLambdaExpression();
1852 Res = ParseObjCMessageExpression();
1866 if (ParseKind == PrimaryExprOnly)
1881 case tok::minusminus:
1899 Diag(Tok.
getLocation(), diag::err_postfix_after_unary_requires_parens)
1907 PreferredType = SavedType;
1908 Res = ParsePostfixExpressionSuffix(Res);
1910 !
getActions().getOpenCLOptions().isAvailableOption(
1912 if (
Expr *PostfixExpr = Res.
get()) {
1913 QualType Ty = PostfixExpr->getType();
1915 Diag(PostfixExpr->getExprLoc(),
1916 diag::err_opencl_taking_function_address_parser);
1946Parser::ParsePostfixExpressionSuffix(
ExprResult LHS) {
1950 auto SavedType = PreferredType;
1953 PreferredType = SavedType;
1955 case tok::code_completion:
1956 if (InMessageExpression)
1964 case tok::identifier:
1971 nullptr, LHS.
get());
1979 case tok::l_square: {
1987 isSimpleObjCMessageExpression())
1992 if (CheckProhibitedCXX11Attribute()) {
1998 Loc =
T.getOpenLocation();
2001 ExprVector ArgExprs;
2002 bool HasError =
false;
2009 if ((!
getLangOpts().OpenMP && !AllowOpenACCArraySections) ||
2010 Tok.
isNot(tok::colon)) {
2014 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
2015 Idx = ParseBraceInitializer();
2024 ArgExprs.push_back(Idx.
get());
2026 }
else if (Tok.
isNot(tok::r_square)) {
2027 if (ParseExpressionList(ArgExprs)) {
2038 if (ArgExprs.size() <= 1 && AllowOpenACCArraySections) {
2040 if (Tok.
is(tok::colon)) {
2043 if (Tok.
isNot(tok::r_square))
2046 }
else if (ArgExprs.size() <= 1 &&
getLangOpts().OpenMP) {
2048 if (Tok.
is(tok::colon)) {
2051 if (Tok.
isNot(tok::r_square) &&
2059 (OMPClauseKind == llvm::omp::Clause::OMPC_to ||
2060 OMPClauseKind == llvm::omp::Clause::OMPC_from) &&
2061 Tok.
is(tok::colon)) {
2064 if (Tok.
isNot(tok::r_square)) {
2073 if (!LHS.
isInvalid() && !HasError && !Length.isInvalid() &&
2080 if (AllowOpenACCArraySections) {
2082 "Stride/second colon not allowed for OpenACC");
2084 LHS.
get(),
Loc, ArgExprs.empty() ?
nullptr : ArgExprs[0],
2085 ColonLocFirst, Length.get(), RLoc);
2088 LHS.
get(),
Loc, ArgExprs.empty() ?
nullptr : ArgExprs[0],
2089 ColonLocFirst, ColonLocSecond, Length.get(), Stride.
get(),
2106 case tok::lesslessless: {
2111 Expr *ExecConfig =
nullptr;
2115 if (OpKind == tok::lesslessless) {
2116 ExprVector ExecConfigExprs;
2119 if (ParseSimpleExpressionList(ExecConfigExprs)) {
2130 Diag(Tok, diag::err_expected) << tok::greatergreatergreater;
2131 Diag(OpenLoc, diag::note_matching) << tok::lesslessless;
2137 if (ExpectAndConsume(tok::l_paren))
2140 Loc = PrevTokLocation;
2145 getCurScope(), OpenLoc, ExecConfigExprs, CloseLoc);
2149 ExecConfig = ECResult.
get();
2153 Loc = PT.getOpenLocation();
2156 ExprVector ArgExprs;
2157 auto RunSignatureHelp = [&]() ->
QualType {
2160 LHS.
get(), ArgExprs, PT.getOpenLocation());
2161 CalledSignatureHelp =
true;
2162 return PreferredType;
2164 if (OpKind == tok::l_paren || !LHS.
isInvalid()) {
2165 if (Tok.
isNot(tok::r_paren)) {
2166 if (ParseExpressionList(ArgExprs, [&] {
2167 PreferredType.enterFunctionArgument(Tok.
getLocation(),
2179 for (
auto &E : ArgExprs)
2188 }
else if (Tok.
isNot(tok::r_paren)) {
2189 bool HadDelayedTypo =
false;
2191 HadDelayedTypo =
true;
2192 for (
auto &E : ArgExprs)
2194 HadDelayedTypo =
true;
2209 ArgExprs.insert(ArgExprs.begin(), Fn);
2227 bool MayBePseudoDestructor =
false;
2230 PreferredType.enterMemAccess(Actions, Tok.
getLocation(), OrigLHS);
2234 const Type* BaseType =
Base->getType().getTypePtrOrNull();
2235 if (BaseType && Tok.
is(tok::l_paren) &&
2238 Diag(OpLoc, diag::err_function_is_not_record)
2239 << OpKind <<
Base->getSourceRange()
2241 return ParsePostfixExpressionSuffix(
Base);
2246 MayBePseudoDestructor);
2251 if (Tok.
is(tok::code_completion)) {
2257 ParseOptionalCXXScopeSpecifier(
2259 false, &MayBePseudoDestructor);
2261 ObjectType =
nullptr;
2264 if (Tok.
is(tok::code_completion)) {
2266 OpKind == tok::arrow ? tok::period : tok::arrow;
2273 getCurScope(), OrigLHS, OpLoc, CorrectedOpKind, ObjectType,
2274 MayBePseudoDestructor);
2278 Expr *CorrectedBase = CorrectedLHS.get();
2280 CorrectedBase =
Base;
2286 Base && ExprStatementTokLoc ==
Base->getBeginLoc(),
2292 if (MayBePseudoDestructor && !LHS.
isInvalid()) {
2293 LHS = ParseCXXPseudoDestructor(LHS.
get(), OpLoc, OpKind, SS,
2308 Tok.
is(tok::kw_class)) {
2318 Name.setIdentifier(
Id,
Loc);
2325 false, &TemplateKWLoc, Name)) {
2332 OpKind, SS, TemplateKWLoc, Name,
2333 CurParsedObjCImpl ? CurParsedObjCImpl->Dcl
2336 if (Tok.
is(tok::less))
2337 checkPotentialAngleBracket(LHS);
2338 }
else if (OrigLHS && Name.isValid()) {
2341 Name.getEndLoc(), {OrigLHS});
2346 case tok::minusminus:
2394Parser::ParseExprAfterUnaryExprOrTypeTrait(
const Token &OpTok,
2399 assert(OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual, tok::kw_sizeof,
2400 tok::kw___datasizeof, tok::kw___alignof, tok::kw_alignof,
2401 tok::kw__Alignof, tok::kw_vec_step,
2402 tok::kw___builtin_omp_required_simd_align,
2403 tok::kw___builtin_vectorelements) &&
2404 "Not a typeof/sizeof/alignof/vec_step expression!");
2409 if (Tok.
isNot(tok::l_paren)) {
2412 if (OpTok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2413 tok::kw_alignof, tok::kw__Alignof)) {
2414 if (isTypeIdUnambiguously()) {
2416 ParseSpecifierQualifierList(DS);
2419 ParseDeclarator(DeclaratorInfo);
2425 diag::err_expected_parentheses_around_typename)
2428 Diag(LParenLoc, diag::err_expected_parentheses_around_typename)
2438 if (OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual) &&
2445 Operand = ParseCastExpression(UnaryExprOnly);
2451 ParenParseOption ExprType =
CastExpr;
2454 Operand = ParseParenExpression(ExprType,
true,
2455 false, CastTy, RParenLoc);
2466 !OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual)) {
2483ExprResult Parser::ParseSYCLUniqueStableNameExpression() {
2484 assert(Tok.
is(tok::kw___builtin_sycl_unique_stable_name) &&
2485 "Not __builtin_sycl_unique_stable_name");
2491 if (
T.expectAndConsume(diag::err_expected_lparen_after,
2492 "__builtin_sycl_unique_stable_name"))
2502 if (
T.consumeClose())
2506 OpLoc,
T.getOpenLocation(),
T.getCloseLocation(), Ty.
get());
2523ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
2524 assert(Tok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2525 tok::kw_alignof, tok::kw__Alignof, tok::kw_vec_step,
2526 tok::kw___builtin_omp_required_simd_align,
2527 tok::kw___builtin_vectorelements) &&
2528 "Not a sizeof/alignof/vec_step expression!");
2533 if (Tok.
is(tok::ellipsis) && OpTok.
is(tok::kw_sizeof)) {
2538 if (Tok.
is(tok::l_paren)) {
2541 LParenLoc =
T.getOpenLocation();
2542 if (Tok.
is(tok::identifier)) {
2546 RParenLoc =
T.getCloseLocation();
2550 Diag(Tok, diag::err_expected_parameter_pack);
2553 }
else if (Tok.
is(tok::identifier)) {
2558 Diag(LParenLoc, diag::err_paren_sizeof_parameter_pack)
2563 Diag(Tok, diag::err_sizeof_parameter_pack);
2580 OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2581 Diag(OpTok, diag::warn_cxx98_compat_alignof);
2583 Diag(OpTok, diag::warn_c23_compat_keyword) << OpTok.
getName();
2599 case tok::kw_alignof:
2600 case tok::kw__Alignof:
2601 ExprKind = UETT_AlignOf;
2603 case tok::kw___alignof:
2604 ExprKind = UETT_PreferredAlignOf;
2606 case tok::kw_vec_step:
2607 ExprKind = UETT_VecStep;
2609 case tok::kw___builtin_omp_required_simd_align:
2610 ExprKind = UETT_OpenMPRequiredSimdAlign;
2612 case tok::kw___datasizeof:
2613 ExprKind = UETT_DataSizeOf;
2615 case tok::kw___builtin_vectorelements:
2616 ExprKind = UETT_VectorElements;
2629 if (OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2665ExprResult Parser::ParseBuiltinPrimaryExpression() {
2673 if (Tok.
isNot(tok::l_paren))
2674 return ExprError(
Diag(Tok, diag::err_expected_after) << BuiltinII
2683 default: llvm_unreachable(
"Not a builtin primary expression!");
2684 case tok::kw___builtin_va_arg: {
2687 if (ExpectAndConsume(tok::comma)) {
2694 if (Tok.
isNot(tok::r_paren)) {
2695 Diag(Tok, diag::err_expected) << tok::r_paren;
2705 case tok::kw___builtin_offsetof: {
2711 if (MacroName ==
"offsetof")
2724 if (ExpectAndConsume(tok::comma)) {
2730 if (Tok.
isNot(tok::identifier)) {
2731 Diag(Tok, diag::err_expected) << tok::identifier;
2740 Comps.back().isBrackets =
false;
2742 Comps.back().LocStart = Comps.back().LocEnd =
ConsumeToken();
2746 if (Tok.
is(tok::period)) {
2749 Comps.back().isBrackets =
false;
2752 if (Tok.
isNot(tok::identifier)) {
2753 Diag(Tok, diag::err_expected) << tok::identifier;
2759 }
else if (Tok.
is(tok::l_square)) {
2760 if (CheckProhibitedCXX11Attribute())
2765 Comps.back().isBrackets =
true;
2768 Comps.back().LocStart = ST.getOpenLocation();
2774 Comps.back().U.E = Res.
get();
2777 Comps.back().LocEnd = ST.getCloseLocation();
2779 if (Tok.
isNot(tok::r_paren)) {
2788 PT.getCloseLocation());
2795 case tok::kw___builtin_choose_expr: {
2797 if (Cond.isInvalid()) {
2801 if (ExpectAndConsume(tok::comma)) {
2807 if (Expr1.isInvalid()) {
2811 if (ExpectAndConsume(tok::comma)) {
2817 if (Expr2.isInvalid()) {
2821 if (Tok.
isNot(tok::r_paren)) {
2822 Diag(Tok, diag::err_expected) << tok::r_paren;
2826 Expr2.get(), ConsumeParen());
2829 case tok::kw___builtin_astype: {
2832 if (
Expr.isInvalid()) {
2837 if (ExpectAndConsume(tok::comma)) {
2848 if (Tok.
isNot(tok::r_paren)) {
2849 Diag(Tok, diag::err_expected) << tok::r_paren;
2858 case tok::kw___builtin_convertvector: {
2861 if (
Expr.isInvalid()) {
2866 if (ExpectAndConsume(tok::comma)) {
2877 if (Tok.
isNot(tok::r_paren)) {
2878 Diag(Tok, diag::err_expected) << tok::r_paren;
2887 case tok::kw___builtin_COLUMN:
2888 case tok::kw___builtin_FILE:
2889 case tok::kw___builtin_FILE_NAME:
2890 case tok::kw___builtin_FUNCTION:
2891 case tok::kw___builtin_FUNCSIG:
2892 case tok::kw___builtin_LINE:
2893 case tok::kw___builtin_source_location: {
2895 if (Tok.
isNot(tok::r_paren)) {
2896 Diag(Tok, diag::err_expected) << tok::r_paren;
2902 case tok::kw___builtin_FILE:
2904 case tok::kw___builtin_FILE_NAME:
2906 case tok::kw___builtin_FUNCTION:
2908 case tok::kw___builtin_FUNCSIG:
2910 case tok::kw___builtin_LINE:
2912 case tok::kw___builtin_COLUMN:
2914 case tok::kw___builtin_source_location:
2917 llvm_unreachable(
"invalid keyword");
2930 return ParsePostfixExpressionSuffix(Res.
get());
2933bool Parser::tryParseOpenMPArrayShapingCastPart() {
2934 assert(Tok.
is(tok::l_square) &&
"Expected open bracket");
2935 bool ErrorFound =
true;
2936 TentativeParsingAction TPA(*
this);
2938 if (Tok.
isNot(tok::l_square))
2943 while (!
SkipUntil(tok::r_square, tok::annot_pragma_openmp_end,
2946 if (Tok.
isNot(tok::r_square))
2951 if (Tok.
is(tok::r_paren)) {
2955 }
while (Tok.
isNot(tok::annot_pragma_openmp_end));
2988Parser::ParseParenExpression(ParenParseOption &ExprType,
bool stopIfCastExpr,
2991 assert(Tok.
is(tok::l_paren) &&
"Not a paren expr!");
2994 if (
T.consumeOpen())
2998 PreferredType.enterParenExpr(Tok.
getLocation(), OpenLoc);
3001 bool isAmbiguousTypeId;
3004 if (Tok.
is(tok::code_completion)) {
3008 ExprType >= CompoundLiteral);
3015 tok::kw___bridge_transfer,
3016 tok::kw___bridge_retained,
3017 tok::kw___bridge_retain));
3018 if (BridgeCast && !
getLangOpts().ObjCAutoRefCount) {
3020 StringRef BridgeCastName = Tok.
getName();
3023 Diag(BridgeKeywordLoc, diag::warn_arc_bridge_cast_nonarc)
3033 Diag(Tok, OpenLoc.
isMacroID() ? diag::ext_gnu_statement_expr_macro
3034 : diag::ext_gnu_statement_expr);
3036 checkCompoundToken(OpenLoc, tok::l_paren, CompoundToken::StmtExprBegin);
3045 while (CodeDC->
isRecord() || isa<EnumDecl>(CodeDC)) {
3048 "statement expr not in code context");
3058 if (!
Stmt.isInvalid()) {
3065 }
else if (ExprType >= CompoundLiteral && BridgeCast) {
3071 if (tokenKind == tok::kw___bridge)
3073 else if (tokenKind == tok::kw___bridge_transfer)
3075 else if (tokenKind == tok::kw___bridge_retained)
3080 assert(tokenKind == tok::kw___bridge_retain);
3083 Diag(BridgeKeywordLoc, diag::err_arc_bridge_retain)
3085 "__bridge_retained");
3090 ColonProtection.restore();
3091 RParenLoc =
T.getCloseLocation();
3094 ExprResult SubExpr = ParseCastExpression(AnyCastExpr);
3100 BridgeKeywordLoc, Ty.
get(),
3101 RParenLoc, SubExpr.
get());
3102 }
else if (ExprType >= CompoundLiteral &&
3103 isTypeIdInParens(isAmbiguousTypeId)) {
3112 if (isAmbiguousTypeId && !stopIfCastExpr) {
3113 ExprResult res = ParseCXXAmbiguousParenExpression(ExprType, CastTy,
T,
3115 RParenLoc =
T.getCloseLocation();
3121 ParseSpecifierQualifierList(DS);
3124 ParseDeclarator(DeclaratorInfo);
3129 if (!DeclaratorInfo.isInvalidType() && Tok.
is(tok::identifier) &&
3143 ColonProtection.restore();
3144 RParenLoc =
T.getCloseLocation();
3145 if (Tok.
is(tok::l_brace)) {
3146 ExprType = CompoundLiteral;
3152 return ParseCompoundLiteralExpression(Ty.
get(), OpenLoc, RParenLoc);
3155 if (Tok.
is(tok::l_paren)) {
3176 Result = ParseCastExpression(AnyCastExpr,
3181 if (!
Result.isInvalid()) {
3183 DeclaratorInfo, CastTy,
3184 RParenLoc,
Result.get());
3188 if (!
Result.isInvalid()) {
3200 if (DeclaratorInfo.isInvalidType())
3205 if (stopIfCastExpr) {
3219 GetLookAheadToken(1).isNot(tok::period)) {
3228 Result = ParseCastExpression(AnyCastExpr,
3231 if (!
Result.isInvalid()) {
3233 DeclaratorInfo, CastTy,
3234 RParenLoc,
Result.get());
3239 Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
3242 }
else if (ExprType >= FoldExpr && Tok.
is(tok::ellipsis) &&
3244 ExprType = FoldExpr;
3246 }
else if (isTypeCast) {
3249 ExprVector ArgExprs;
3251 if (!ParseSimpleExpressionList(ArgExprs)) {
3254 if (ExprType >= FoldExpr && ArgExprs.size() == 1 &&
3256 ExprType = FoldExpr;
3257 return ParseFoldExpression(ArgExprs[0],
T);
3260 ExprType = SimpleExpr;
3264 }
else if (
getLangOpts().OpenMP >= 50 && OpenMPDirectiveParsing &&
3265 ExprType ==
CastExpr && Tok.
is(tok::l_square) &&
3266 tryParseOpenMPArrayShapingCastPart()) {
3267 bool ErrorFound =
false;
3277 while (!
SkipUntil(tok::r_square, tok::r_paren,
3282 OMPDimensions.push_back(NumElements.
get());
3283 OMPBracketsRanges.push_back(TS.getRange());
3284 }
while (Tok.
isNot(tok::r_paren));
3287 RParenLoc =
T.getCloseLocation();
3291 }
else if (!
Result.isInvalid()) {
3293 Result.get(), OpenLoc, RParenLoc, OMPDimensions, OMPBracketsRanges);
3306 if (ExprType >= FoldExpr && isFoldOperator(Tok.
getKind()) &&
3308 ExprType = FoldExpr;
3309 return ParseFoldExpression(
Result,
T);
3311 ExprType = SimpleExpr;
3314 if (!
Result.isInvalid() && Tok.
is(tok::r_paren))
3320 if (
Result.isInvalid()) {
3326 RParenLoc =
T.getCloseLocation();
3339Parser::ParseCompoundLiteralExpression(
ParsedType Ty,
3342 assert(Tok.
is(tok::l_brace) &&
"Not a compound literal!");
3344 Diag(LParenLoc, diag::ext_c99_compound_literal);
3347 if (!
Result.isInvalid() && Ty)
3373 "Not a string-literal-like token!");
3381 StringToks.push_back(Tok);
3386 assert(!AllowUserDefinedLiteral &&
"UDL are always evaluated");
3415ExprResult Parser::ParseGenericSelectionExpression() {
3416 assert(Tok.
is(tok::kw__Generic) &&
"_Generic keyword expected");
3418 diagnoseUseOfC11Keyword(Tok);
3422 if (
T.expectAndConsume())
3429 if (isTypeIdForGenericSelection()) {
3435 const auto *LIT = cast<LocInfoType>(ControllingType.
get().get());
3437 Diag(
Loc, diag::ext_generic_with_type_arg);
3451 if (ExpectAndConsume(tok::comma)) {
3461 if (Tok.
is(tok::kw_default)) {
3465 Diag(Tok, diag::err_duplicate_default_assoc);
3466 Diag(DefaultLoc, diag::note_previous_default_assoc);
3481 Types.push_back(Ty);
3483 if (ExpectAndConsume(tok::colon)) {
3492 if (ER.isInvalid()) {
3496 Exprs.push_back(ER.get());
3500 if (
T.getCloseLocation().isInvalid())
3503 void *ExprOrTy = ControllingExpr.
isUsable()
3504 ? ControllingExpr.
get()
3505 : ControllingType.
get().getAsOpaquePtr();
3508 KeyLoc, DefaultLoc,
T.getCloseLocation(), ControllingExpr.
isUsable(),
3509 ExprOrTy, Types, Exprs);
3531 assert(isFoldOperator(Kind) &&
"missing fold-operator");
3535 assert(Tok.
is(tok::ellipsis) &&
"not a fold-expression");
3539 if (Tok.
isNot(tok::r_paren)) {
3540 if (!isFoldOperator(Tok.
getKind()))
3543 if (Kind != tok::unknown && Tok.
getKind() != Kind)
3557 ? diag::warn_cxx14_compat_fold_expression
3558 : diag::ext_fold_expression);
3562 Kind, EllipsisLoc, RHS.
get(),
3563 T.getCloseLocation());
3589 llvm::function_ref<
void()> ExpressionStarts,
3590 bool FailImmediatelyOnInvalidExpr,
3591 bool EarlyTypoCorrection) {
3592 bool SawError =
false;
3594 if (ExpressionStarts)
3599 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3600 Expr = ParseBraceInitializer();
3604 if (EarlyTypoCorrection)
3607 if (Tok.
is(tok::ellipsis))
3609 else if (Tok.
is(tok::code_completion)) {
3619 if (
Expr.isInvalid()) {
3621 if (FailImmediatelyOnInvalidExpr)
3625 Exprs.push_back(
Expr.get());
3628 if (Tok.
isNot(tok::comma))
3633 checkPotentialAngleBracketDelimiter(Comma);
3638 for (
auto &E : Exprs) {
3640 if (
Expr.isUsable()) E =
Expr.get();
3657 if (
Expr.isInvalid())
3660 Exprs.push_back(
Expr.get());
3670 checkPotentialAngleBracketDelimiter(Comma);
3681 if (Tok.
is(tok::code_completion)) {
3690 ParseSpecifierQualifierList(DS);
3696 ParseDeclarator(DeclaratorInfo);
3698 MaybeParseGNUAttributes(DeclaratorInfo);
3714ExprResult Parser::ParseBlockLiteralExpression() {
3715 assert(Tok.
is(tok::caret) &&
"block literal starts with ^");
3719 "block literal parsing");
3742 if (Tok.
is(tok::l_paren)) {
3743 ParseParenDeclarator(ParamInfo);
3748 ParamInfo.SetIdentifier(
nullptr, CaretLoc);
3749 ParamInfo.SetRangeEnd(Tmp);
3750 if (ParamInfo.isInvalidType()) {
3758 MaybeParseGNUAttributes(ParamInfo);
3762 }
else if (!Tok.
is(tok::l_brace)) {
3763 ParseBlockId(CaretLoc);
3767 ParamInfo.AddTypeInfo(
3785 CaretLoc, CaretLoc, ParamInfo),
3788 MaybeParseGNUAttributes(ParamInfo);
3796 if (!Tok.
is(tok::l_brace)) {
3798 Diag(Tok, diag::err_expected_expression);
3805 if (!
Stmt.isInvalid())
3825 llvm::SmallSet<StringRef, 4> Platforms;
3826 bool HasOtherPlatformSpec =
false;
3828 for (
const auto &Spec : AvailSpecs) {
3829 if (Spec.isOtherPlatformSpec()) {
3830 if (HasOtherPlatformSpec) {
3831 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_star);
3835 HasOtherPlatformSpec =
true;
3839 bool Inserted = Platforms.insert(Spec.getPlatform()).second;
3844 StringRef Platform = Spec.getPlatform();
3845 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_platform)
3846 << Spec.getEndLoc() << Platform;
3851 if (!HasOtherPlatformSpec) {
3852 SourceLocation InsertWildcardLoc = AvailSpecs.back().getEndLoc();
3853 P.Diag(InsertWildcardLoc, diag::err_availability_query_wildcard_required)
3866std::optional<AvailabilitySpec> Parser::ParseAvailabilitySpec() {
3867 if (Tok.
is(tok::star)) {
3871 if (Tok.
is(tok::code_completion)) {
3874 return std::nullopt;
3876 if (Tok.
isNot(tok::identifier)) {
3877 Diag(Tok, diag::err_avail_query_expected_platform_name);
3878 return std::nullopt;
3883 VersionTuple Version = ParseVersionTuple(VersionRange);
3885 if (Version.empty())
3886 return std::nullopt;
3888 StringRef GivenPlatform = PlatformIdentifier->
Ident->
getName();
3889 StringRef Platform =
3890 AvailabilityAttr::canonicalizePlatformName(GivenPlatform);
3892 if (AvailabilityAttr::getPrettyPlatformName(Platform).empty() ||
3893 (GivenPlatform.contains(
"xros") || GivenPlatform.contains(
"xrOS"))) {
3895 diag::err_avail_query_unrecognized_platform_name)
3897 return std::nullopt;
3906 assert(Tok.
is(tok::kw___builtin_available) ||
3913 if (
Parens.expectAndConsume())
3917 bool HasError =
false;
3919 std::optional<AvailabilitySpec> Spec = ParseAvailabilitySpec();
3923 AvailSpecs.push_back(*Spec);
3936 if (
Parens.consumeClose())
3940 AvailSpecs, BeginLoc,
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 facilities that support code completion.
This file declares semantic analysis for Objective-C.
This file declares semantic analysis for OpenACC constructs and clauses.
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)
@ PCC_Type
Code completion occurs where only a type is permitted.
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for.
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 CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, const IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
void CodeCompleteAvailabilityPlatformName()
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType)
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, QualType PreferredType)
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
ExprResult ActOnClassPropertyRefExpr(const IdentifierInfo &receiverName, const IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
ExprResult ActOnObjCBoolLiteral(SourceLocation AtLoc, SourceLocation ValueLoc, bool Value)
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
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 ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
void ActOnStartStmtExpr()
void ActOnStmtExprError()
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 ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
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)
SourceRange getExprRange(Expr *E) const
SemaCodeCompletion & CodeCompletion()
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)
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.
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)
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 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.