38#include "llvm/ADT/SmallVector.h"
132 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
143 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
150Parser::ParseExpressionWithLeadingExtension(
SourceLocation ExtLoc) {
156 LHS = ParseCastExpression(AnyCastExpr);
159 if (!LHS.isInvalid())
163 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
168 if (Tok.
is(tok::code_completion)) {
175 if (Tok.
is(tok::kw_throw))
176 return ParseThrowExpression();
177 if (Tok.
is(tok::kw_co_yield))
178 return ParseCoyieldExpression();
180 ExprResult LHS = ParseCastExpression(AnyCastExpr,
187 if (Tok.
is(tok::code_completion)) {
209Parser::ParseAssignmentExprWithObjCMessageExprStart(
SourceLocation LBracLoc,
212 Expr *ReceiverExpr) {
214 = ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
215 ReceiverType, ReceiverExpr);
216 R = ParsePostfixExpressionSuffix(R);
224 "Call this function only if your ExpressionEvaluationContext is "
225 "already ConstantEvaluated");
226 ExprResult LHS(ParseCastExpression(AnyCastExpr,
false, isTypeCast));
246 Actions.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
267 ExprResult LHS(ParseCastExpression(AnyCastExpr));
289 bool NotPrimaryExpression =
false;
290 auto ParsePrimary = [&] () {
291 ExprResult E = ParseCastExpression(PrimaryExprOnly,
295 &NotPrimaryExpression);
299 E = ParsePostfixExpressionSuffix(E);
306 ? diag::note_unparenthesized_non_primary_expr_in_requires_clause
307 : diag::err_unparenthesized_non_primary_expr_in_requires_clause)
315 if (NotPrimaryExpression ||
322 Tok.
isOneOf(tok::period, tok::plusplus, tok::minusminus) ||
323 (Tok.
is(tok::l_square) && !
NextToken().is(tok::l_square))) {
324 E = RecoverFromNonPrimary(E,
false);
327 NotPrimaryExpression =
false;
329 bool PossibleNonPrimary;
330 bool IsConstraintExpr =
332 IsTrailingRequiresClause);
333 if (!IsConstraintExpr || PossibleNonPrimary) {
338 if (PossibleNonPrimary)
339 E = RecoverFromNonPrimary(E, !IsConstraintExpr);
348 while (Tok.
is(tok::ampamp)) {
356 tok::ampamp, LHS.
get(), RHS.
get());
382 while (Tok.
is(tok::pipepipe)) {
391 tok::pipepipe, LHS.
get(), RHS.
get());
402bool Parser::isNotExpressionStart() {
404 if (K == tok::l_brace || K == tok::r_brace ||
405 K == tok::kw_for || K == tok::kw_while ||
406 K == tok::kw_if || K == tok::kw_else ||
407 K == tok::kw_goto || K == tok::kw_try)
410 return isKnownToBeDeclarationSpecifier();
413bool Parser::isFoldOperator(
prec::Level Level)
const {
427 GreaterThanIsOperator,
431 auto SavedType = PreferredType;
434 PreferredType = SavedType;
438 if (NextTokPrec < MinPrec)
445 if (OpToken.
is(tok::caretcaret)) {
446 return ExprError(
Diag(Tok, diag::err_opencl_logical_exclusive_or));
451 if (OpToken.
isOneOf(tok::comma, tok::greater, tok::greatergreater,
452 tok::greatergreatergreater) &&
453 checkPotentialAngleBracketDelimiter(OpToken))
461 if (OpToken.
is(tok::comma) && isNotExpressionStart()) {
469 if (isFoldOperator(NextTokPrec) && Tok.
is(tok::ellipsis)) {
483 Tok.
isOneOf(tok::colon, tok::r_square) &&
496 TernaryMiddle = ParseBraceInitializer();
497 if (!TernaryMiddle.isInvalid()) {
498 Diag(BraceLoc, diag::err_init_list_bin_op)
503 }
else if (Tok.
isNot(tok::colon)) {
515 TernaryMiddle =
nullptr;
516 Diag(Tok, diag::ext_gnu_conditional_expr);
519 if (TernaryMiddle.isInvalid()) {
522 TernaryMiddle =
nullptr;
531 const char *FIText =
": ";
535 bool IsInvalid =
false;
536 const char *SourcePtr =
538 if (!IsInvalid && *SourcePtr ==
' ') {
541 if (!IsInvalid && *SourcePtr ==
' ') {
548 Diag(Tok, diag::err_expected)
550 Diag(OpToken, diag::note_matching) << tok::question;
568 bool RHSIsInitList =
false;
570 RHS = ParseBraceInitializer();
571 RHSIsInitList =
true;
575 RHS = ParseCastExpression(AnyCastExpr);
581 if (TernaryMiddle.isUsable())
598 if (ThisPrec < NextTokPrec ||
599 (ThisPrec == NextTokPrec && isRightAssoc)) {
601 Diag(Tok, diag::err_init_list_bin_op)
610 RHS = ParseRHSOfBinaryExpression(RHS,
611 static_cast<prec::Level>(ThisPrec + !isRightAssoc));
612 RHSIsInitList =
false;
618 if (TernaryMiddle.isUsable())
629 Diag(OpToken, diag::warn_cxx98_compat_generalized_initializer_lists)
631 }
else if (ColonLoc.
isValid()) {
632 Diag(ColonLoc, diag::err_init_list_bin_op)
637 Diag(OpToken, diag::err_init_list_bin_op)
647 if (TernaryMiddle.isInvalid()) {
651 if (!GreaterThanIsOperator && OpToken.
is(tok::greatergreater))
653 diag::warn_cxx11_right_shift_in_template_arg,
663 {LHS.get(), RHS.get()});
671 std::vector<clang::Expr *> Args;
673 if (TernaryMiddle.get())
674 Args = {LHS.
get(), TernaryMiddle.get(), RHS.
get()};
676 Args = {LHS.
get(), RHS.
get()};
704ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
705 bool isAddressOfOperand,
706 TypeCastState isTypeCast,
707 bool isVectorLiteral,
708 bool *NotPrimaryExpression) {
710 ExprResult Res = ParseCastExpression(ParseKind,
715 NotPrimaryExpression);
717 Diag(Tok, diag::err_expected_expression);
724 CastExpressionIdValidator(
Token Next,
bool AllowTypes,
bool AllowNonTypes)
725 : NextToken(Next), AllowNonTypes(AllowNonTypes) {
726 WantTypeSpecifiers = WantFunctionLikeCasts = AllowTypes;
729 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
734 if (isa<TypeDecl>(ND))
735 return WantTypeSpecifiers;
740 if (!NextToken.isOneOf(tok::equal, tok::arrow, tok::period))
743 for (
auto *
C : candidate) {
745 if (isa<ValueDecl>(ND) && !isa<FunctionDecl>(ND))
751 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
752 return std::make_unique<CastExpressionIdValidator>(*
this);
944ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
945 bool isAddressOfOperand,
947 TypeCastState isTypeCast,
948 bool isVectorLiteral,
949 bool *NotPrimaryExpression) {
952 auto SavedType = PreferredType;
958 bool AllowSuffix =
true;
974 ParenParseOption ParenExprType;
976 case CastParseKind::UnaryExprOnly:
979 case CastParseKind::AnyCastExpr:
980 ParenExprType = ParenParseOption::CastExpr;
982 case CastParseKind::PrimaryExprOnly:
983 ParenExprType = FoldExpr;
988 Res = ParseParenExpression(ParenExprType,
false,
997 switch (ParenExprType) {
998 case SimpleExpr:
break;
1000 case CompoundLiteral:
1018 case tok::numeric_constant:
1028 Res = ParseCXXBoolLiteral();
1031 case tok::kw___objc_yes:
1032 case tok::kw___objc_no:
1033 Res = ParseObjCBoolLiteral();
1036 case tok::kw_nullptr:
1038 Diag(Tok, diag::warn_cxx98_compat_nullptr);
1041 : diag::ext_c_nullptr) << Tok.
getName();
1046 case tok::annot_primary_expr:
1047 case tok::annot_overload_set:
1048 Res = getExprAnnotation(Tok);
1051 ConsumeAnnotationToken();
1053 checkPotentialAngleBracket(Res);
1056 case tok::annot_non_type:
1057 case tok::annot_non_type_dependent:
1058 case tok::annot_non_type_undeclared: {
1061 Res = tryParseCXXIdExpression(SS, isAddressOfOperand, Replacement);
1063 "should not perform typo correction on annotation token");
1067 case tok::kw___super:
1068 case tok::kw_decltype:
1072 assert(Tok.
isNot(tok::kw_decltype) && Tok.
isNot(tok::kw___super));
1073 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1074 isVectorLiteral, NotPrimaryExpression);
1076 case tok::identifier:
1087 if (Next.is(tok::ellipsis) && Tok.
is(tok::identifier) &&
1088 GetLookAheadToken(2).is(tok::l_square)) {
1093 Tok.
is(tok::annot_pack_indexing_type))
1094 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1095 isVectorLiteral, NotPrimaryExpression);
1101 else if (Next.is(tok::l_paren) && Tok.
is(tok::identifier) &&
1105 if (RevertibleTypeTraits.empty()) {
1106#define RTT_JOIN(X,Y) X##Y
1107#define REVERTIBLE_TYPE_TRAIT(Name) \
1108 RevertibleTypeTraits[PP.getIdentifierInfo(#Name)] \
1109 = RTT_JOIN(tok::kw_,Name)
1170#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
1171 REVERTIBLE_TYPE_TRAIT(RTT_JOIN(__, Trait));
1172#include "clang/Basic/TransformTypeTraits.def"
1173#undef REVERTIBLE_TYPE_TRAIT
1180 llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind>::iterator Known
1181 = RevertibleTypeTraits.find(II);
1182 if (Known != RevertibleTypeTraits.end()) {
1184 return ParseCastExpression(ParseKind, isAddressOfOperand,
1185 NotCastExpr, isTypeCast,
1186 isVectorLiteral, NotPrimaryExpression);
1190 else if ((!ColonIsSacred && Next.is(tok::colon)) ||
1191 Next.isOneOf(tok::coloncolon, tok::less, tok::l_paren,
1196 if (!Tok.
is(tok::identifier))
1197 return ParseCastExpression(ParseKind, isAddressOfOperand,
1198 NotCastExpr, isTypeCast,
1200 NotPrimaryExpression);
1213 (&II == Ident_super &&
getCurScope()->isInObjcMethodScope()))) {
1216 if (Tok.
is(tok::code_completion) && &II != Ident_super) {
1219 getCurScope(), II, ILoc, ExprStatementTokLoc == ILoc);
1223 if (Tok.
isNot(tok::identifier) &&
1225 Diag(Tok, diag::err_expected_property_name);
1240 if (
getLangOpts().
ObjC && &II == Ident_super && !InMessageExpression &&
1242 ((Tok.
is(tok::identifier) &&
1244 Tok.
is(tok::code_completion))) {
1245 Res = ParseObjCMessageExpressionBody(
SourceLocation(), ILoc,
nullptr,
1256 ((Tok.
is(tok::identifier) && !InMessageExpression) ||
1257 Tok.
is(tok::code_completion))) {
1259 if (Tok.
is(tok::code_completion) ||
1260 Next.is(tok::colon) || Next.is(tok::r_square))
1262 if (Typ.get()->isObjCObjectOrInterfaceType()) {
1265 DS.SetRangeStart(ILoc);
1266 DS.SetRangeEnd(ILoc);
1267 const char *PrevSpec =
nullptr;
1269 DS.SetTypeSpecType(
TST_typename, ILoc, PrevSpec, DiagID, Typ,
1286 if (isAddressOfOperand && isPostfixExpressionSuffixStart())
1287 isAddressOfOperand =
false;
1296 CastExpressionIdValidator Validator(
1300 Validator.IsAddressOfOperand = isAddressOfOperand;
1301 if (Tok.
isOneOf(tok::periodstar, tok::arrowstar)) {
1302 Validator.WantExpressionKeywords =
false;
1303 Validator.WantRemainingKeywords =
false;
1305 Validator.WantRemainingKeywords = Tok.
isNot(tok::r_paren);
1307 Name.setIdentifier(&II, ILoc);
1309 getCurScope(), ScopeSpec, TemplateKWLoc, Name, Tok.
is(tok::l_paren),
1310 isAddressOfOperand, &Validator,
1312 Tok.
is(tok::r_paren) ?
nullptr : &Replacement);
1314 UnconsumeToken(Replacement);
1315 return ParseCastExpression(ParseKind, isAddressOfOperand,
1316 NotCastExpr, isTypeCast,
1318 NotPrimaryExpression);
1320 Res = tryParseCXXPackIndexingExpression(Res);
1322 checkPotentialAngleBracket(Res);
1325 case tok::char_constant:
1326 case tok::wide_char_constant:
1327 case tok::utf8_char_constant:
1328 case tok::utf16_char_constant:
1329 case tok::utf32_char_constant:
1333 case tok::kw___func__:
1334 case tok::kw___FUNCTION__:
1335 case tok::kw___FUNCDNAME__:
1336 case tok::kw___FUNCSIG__:
1337 case tok::kw_L__FUNCTION__:
1338 case tok::kw_L__FUNCSIG__:
1339 case tok::kw___PRETTY_FUNCTION__:
1351 case tok::string_literal:
1352 case tok::wide_string_literal:
1353 case tok::utf8_string_literal:
1354 case tok::utf16_string_literal:
1355 case tok::utf32_string_literal:
1358 case tok::kw__Generic:
1359 Res = ParseGenericSelectionExpression();
1361 case tok::kw___builtin_available:
1362 Res = ParseAvailabilityCheckExpr(Tok.
getLocation());
1364 case tok::kw___builtin_va_arg:
1365 case tok::kw___builtin_offsetof:
1366 case tok::kw___builtin_choose_expr:
1367 case tok::kw___builtin_astype:
1368 case tok::kw___builtin_convertvector:
1369 case tok::kw___builtin_COLUMN:
1370 case tok::kw___builtin_FILE:
1371 case tok::kw___builtin_FILE_NAME:
1372 case tok::kw___builtin_FUNCTION:
1373 case tok::kw___builtin_FUNCSIG:
1374 case tok::kw___builtin_LINE:
1375 case tok::kw___builtin_source_location:
1376 if (NotPrimaryExpression)
1377 *NotPrimaryExpression =
true;
1379 return ParseBuiltinPrimaryExpression();
1380 case tok::kw___null:
1385 case tok::minusminus: {
1386 if (NotPrimaryExpression)
1387 *NotPrimaryExpression =
true;
1392 Token SavedTok = Tok;
1401 UnaryExprOnly : AnyCastExpr,
1408 UnconsumeToken(SavedTok);
1422 if (NotPrimaryExpression)
1423 *NotPrimaryExpression =
true;
1428 Res = ParseCastExpression(AnyCastExpr,
true);
1444 case tok::kw___real:
1445 case tok::kw___imag: {
1446 if (NotPrimaryExpression)
1447 *NotPrimaryExpression =
true;
1450 Res = ParseCastExpression(AnyCastExpr);
1454 isAddressOfOperand);
1461 case tok::kw_co_await: {
1462 if (NotPrimaryExpression)
1463 *NotPrimaryExpression =
true;
1465 Res = ParseCastExpression(AnyCastExpr);
1471 case tok::kw___extension__:{
1473 if (NotPrimaryExpression)
1474 *NotPrimaryExpression =
true;
1477 Res = ParseCastExpression(AnyCastExpr);
1482 case tok::kw__Alignof:
1483 diagnoseUseOfC11Keyword(Tok);
1485 case tok::kw_alignof:
1486 case tok::kw___alignof:
1488 case tok::kw_sizeof:
1492 case tok::kw___datasizeof:
1493 case tok::kw_vec_step:
1495 case tok::kw___builtin_omp_required_simd_align:
1496 case tok::kw___builtin_vectorelements:
1497 if (NotPrimaryExpression)
1498 *NotPrimaryExpression =
true;
1499 AllowSuffix =
false;
1500 Res = ParseUnaryExprOrTypeTraitExpression();
1503 if (NotPrimaryExpression)
1504 *NotPrimaryExpression =
true;
1506 if (Tok.
isNot(tok::identifier))
1507 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
1510 return ExprError(
Diag(Tok, diag::err_address_of_label_outside_fn));
1512 Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
1517 AllowSuffix =
false;
1520 case tok::kw_const_cast:
1521 case tok::kw_dynamic_cast:
1522 case tok::kw_reinterpret_cast:
1523 case tok::kw_static_cast:
1524 case tok::kw_addrspace_cast:
1525 if (NotPrimaryExpression)
1526 *NotPrimaryExpression =
true;
1527 Res = ParseCXXCasts();
1529 case tok::kw___builtin_bit_cast:
1530 if (NotPrimaryExpression)
1531 *NotPrimaryExpression =
true;
1532 Res = ParseBuiltinBitCast();
1534 case tok::kw_typeid:
1535 if (NotPrimaryExpression)
1536 *NotPrimaryExpression =
true;
1537 Res = ParseCXXTypeid();
1539 case tok::kw___uuidof:
1540 if (NotPrimaryExpression)
1541 *NotPrimaryExpression =
true;
1542 Res = ParseCXXUuidof();
1545 Res = ParseCXXThis();
1547 case tok::kw___builtin_sycl_unique_stable_name:
1548 Res = ParseSYCLUniqueStableNameExpression();
1551 case tok::annot_typename:
1552 if (isStartOfObjCClassMessageMissingOpenBracket()) {
1560 const char *PrevSpec =
nullptr;
1563 PrevSpec, DiagID,
Type,
1572 ConsumeAnnotationToken();
1579 case tok::annot_decltype:
1580 case tok::annot_pack_indexing_type:
1582 case tok::kw_wchar_t:
1583 case tok::kw_char8_t:
1584 case tok::kw_char16_t:
1585 case tok::kw_char32_t:
1590 case tok::kw___int64:
1591 case tok::kw___int128:
1592 case tok::kw__ExtInt:
1593 case tok::kw__BitInt:
1594 case tok::kw_signed:
1595 case tok::kw_unsigned:
1598 case tok::kw_double:
1599 case tok::kw___bf16:
1600 case tok::kw__Float16:
1601 case tok::kw___float128:
1602 case tok::kw___ibm128:
1605 case tok::kw_typename:
1606 case tok::kw_typeof:
1607 case tok::kw___vector:
1608 case tok::kw__Accum:
1609 case tok::kw__Fract:
1611#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:
1612#include "clang/Basic/OpenCLImageTypes.def"
1615 Diag(Tok, diag::err_expected_expression);
1620 if (NotPrimaryExpression)
1621 *NotPrimaryExpression =
true;
1623 if (SavedKind == tok::kw_typename) {
1640 ParseCXXSimpleTypeSpecifier(DS);
1641 if (Tok.
isNot(tok::l_paren) &&
1643 return ExprError(
Diag(Tok, diag::err_expected_lparen_after_type)
1644 << DS.getSourceRange());
1646 if (Tok.
is(tok::l_brace))
1647 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1649 Res = ParseCXXTypeConstructExpression(DS);
1653 case tok::annot_cxxscope: {
1658 if (!Tok.
is(tok::annot_cxxscope))
1659 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1660 isTypeCast, isVectorLiteral,
1661 NotPrimaryExpression);
1664 if (Next.is(tok::annot_template_id)) {
1671 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
1675 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1676 isTypeCast, isVectorLiteral,
1677 NotPrimaryExpression);
1682 Res = ParseCXXIdExpression(isAddressOfOperand);
1686 case tok::annot_template_id: {
1694 return ParseCastExpression(ParseKind, isAddressOfOperand,
1695 NotCastExpr, isTypeCast, isVectorLiteral,
1696 NotPrimaryExpression);
1703 case tok::kw_operator:
1704 Res = ParseCXXIdExpression(isAddressOfOperand);
1707 case tok::coloncolon: {
1712 if (!Tok.
is(tok::coloncolon))
1713 return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
1714 isVectorLiteral, NotPrimaryExpression);
1719 if (Tok.
is(tok::kw_new)) {
1720 if (NotPrimaryExpression)
1721 *NotPrimaryExpression =
true;
1722 Res = ParseCXXNewExpression(
true, CCLoc);
1723 AllowSuffix =
false;
1726 if (Tok.
is(tok::kw_delete)) {
1727 if (NotPrimaryExpression)
1728 *NotPrimaryExpression =
true;
1729 Res = ParseCXXDeleteExpression(
true, CCLoc);
1730 AllowSuffix =
false;
1735 Diag(CCLoc, diag::err_expected_expression);
1740 if (NotPrimaryExpression)
1741 *NotPrimaryExpression =
true;
1742 Res = ParseCXXNewExpression(
false, Tok.
getLocation());
1743 AllowSuffix =
false;
1746 case tok::kw_delete:
1747 if (NotPrimaryExpression)
1748 *NotPrimaryExpression =
true;
1749 Res = ParseCXXDeleteExpression(
false, Tok.
getLocation());
1750 AllowSuffix =
false;
1753 case tok::kw_requires:
1754 Res = ParseRequiresExpression();
1755 AllowSuffix =
false;
1758 case tok::kw_noexcept: {
1759 if (NotPrimaryExpression)
1760 *NotPrimaryExpression =
true;
1761 Diag(Tok, diag::warn_cxx98_compat_noexcept_expr);
1765 if (
T.expectAndConsume(diag::err_expected_lparen_after,
"noexcept"))
1778 T.getCloseLocation());
1779 AllowSuffix =
false;
1783#define TYPE_TRAIT(N,Spelling,K) \
1784 case tok::kw_##Spelling:
1785#include "clang/Basic/TokenKinds.def"
1786 Res = ParseTypeTrait();
1789 case tok::kw___array_rank:
1790 case tok::kw___array_extent:
1791 if (NotPrimaryExpression)
1792 *NotPrimaryExpression =
true;
1793 Res = ParseArrayTypeTrait();
1796 case tok::kw___is_lvalue_expr:
1797 case tok::kw___is_rvalue_expr:
1798 if (NotPrimaryExpression)
1799 *NotPrimaryExpression =
true;
1800 Res = ParseExpressionTrait();
1804 if (NotPrimaryExpression)
1805 *NotPrimaryExpression =
true;
1807 return ParseObjCAtExpression(AtLoc);
1810 Res = ParseBlockLiteralExpression();
1812 case tok::code_completion: {
1818#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait:
1819#include "clang/Basic/TransformTypeTraits.def"
1824 Diag(Tok, diag::ext_keyword_as_ident)
1826 goto ParseIdentifier;
1828 goto ExpectedExpression;
1837 Res = TryParseLambdaExpression();
1841 if (NotPrimaryExpression)
1842 *NotPrimaryExpression =
true;
1843 Res = ParseObjCMessageExpression();
1847 Res = ParseLambdaExpression();
1851 Res = ParseObjCMessageExpression();
1865 if (ParseKind == PrimaryExprOnly)
1880 case tok::minusminus:
1898 Diag(Tok.
getLocation(), diag::err_postfix_after_unary_requires_parens)
1906 PreferredType = SavedType;
1907 Res = ParsePostfixExpressionSuffix(Res);
1909 !
getActions().getOpenCLOptions().isAvailableOption(
1911 if (
Expr *PostfixExpr = Res.
get()) {
1912 QualType Ty = PostfixExpr->getType();
1914 Diag(PostfixExpr->getExprLoc(),
1915 diag::err_opencl_taking_function_address_parser);
1945Parser::ParsePostfixExpressionSuffix(
ExprResult LHS) {
1949 auto SavedType = PreferredType;
1952 PreferredType = SavedType;
1954 case tok::code_completion:
1955 if (InMessageExpression)
1963 case tok::identifier:
1970 nullptr, LHS.
get());
1978 case tok::l_square: {
1986 isSimpleObjCMessageExpression())
1991 if (CheckProhibitedCXX11Attribute()) {
1997 Loc =
T.getOpenLocation();
2000 ExprVector ArgExprs;
2001 bool HasError =
false;
2008 if ((!
getLangOpts().OpenMP && !AllowOpenACCArraySections) ||
2009 Tok.
isNot(tok::colon)) {
2013 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
2014 Idx = ParseBraceInitializer();
2023 ArgExprs.push_back(Idx.
get());
2025 }
else if (Tok.
isNot(tok::r_square)) {
2026 if (ParseExpressionList(ArgExprs)) {
2037 if (ArgExprs.size() <= 1 && AllowOpenACCArraySections) {
2039 if (Tok.
is(tok::colon)) {
2044 }
else if (ArgExprs.size() <= 1 &&
getLangOpts().OpenMP) {
2046 if (Tok.
is(tok::colon)) {
2049 if (Tok.
isNot(tok::r_square) &&
2057 (OMPClauseKind == llvm::omp::Clause::OMPC_to ||
2058 OMPClauseKind == llvm::omp::Clause::OMPC_from) &&
2059 Tok.
is(tok::colon)) {
2062 if (Tok.
isNot(tok::r_square)) {
2071 if (!LHS.
isInvalid() && !HasError && !Length.isInvalid() &&
2078 if (AllowOpenACCArraySections) {
2080 "Stride/second colon not allowed for OpenACC");
2082 LHS.
get(), Loc, ArgExprs.empty() ?
nullptr : ArgExprs[0],
2083 ColonLocFirst, Length.get(), RLoc);
2086 LHS.
get(), Loc, ArgExprs.empty() ?
nullptr : ArgExprs[0],
2087 ColonLocFirst, ColonLocSecond, Length.get(), Stride.
get(),
2104 case tok::lesslessless: {
2109 Expr *ExecConfig =
nullptr;
2113 if (OpKind == tok::lesslessless) {
2114 ExprVector ExecConfigExprs;
2117 if (ParseSimpleExpressionList(ExecConfigExprs)) {
2128 Diag(Tok, diag::err_expected) << tok::greatergreatergreater;
2129 Diag(OpenLoc, diag::note_matching) << tok::lesslessless;
2135 if (ExpectAndConsume(tok::l_paren))
2138 Loc = PrevTokLocation;
2143 getCurScope(), OpenLoc, ExecConfigExprs, CloseLoc);
2147 ExecConfig = ECResult.
get();
2151 Loc = PT.getOpenLocation();
2154 ExprVector ArgExprs;
2155 auto RunSignatureHelp = [&]() ->
QualType {
2157 LHS.
get(), ArgExprs, PT.getOpenLocation());
2158 CalledSignatureHelp =
true;
2159 return PreferredType;
2161 if (OpKind == tok::l_paren || !LHS.
isInvalid()) {
2162 if (Tok.
isNot(tok::r_paren)) {
2163 if (ParseExpressionList(ArgExprs, [&] {
2164 PreferredType.enterFunctionArgument(Tok.
getLocation(),
2176 for (
auto &E : ArgExprs)
2185 }
else if (Tok.
isNot(tok::r_paren)) {
2186 bool HadDelayedTypo =
false;
2188 HadDelayedTypo =
true;
2189 for (
auto &E : ArgExprs)
2191 HadDelayedTypo =
true;
2206 ArgExprs.insert(ArgExprs.begin(), Fn);
2224 bool MayBePseudoDestructor =
false;
2227 PreferredType.enterMemAccess(Actions, Tok.
getLocation(), OrigLHS);
2231 const Type* BaseType =
Base->getType().getTypePtrOrNull();
2232 if (BaseType && Tok.
is(tok::l_paren) &&
2235 Diag(OpLoc, diag::err_function_is_not_record)
2236 << OpKind <<
Base->getSourceRange()
2238 return ParsePostfixExpressionSuffix(
Base);
2243 MayBePseudoDestructor);
2248 if (Tok.
is(tok::code_completion)) {
2254 ParseOptionalCXXScopeSpecifier(
2256 false, &MayBePseudoDestructor);
2258 ObjectType =
nullptr;
2261 if (Tok.
is(tok::code_completion)) {
2263 OpKind == tok::arrow ? tok::period : tok::arrow;
2270 getCurScope(), OrigLHS, OpLoc, CorrectedOpKind, ObjectType,
2271 MayBePseudoDestructor);
2275 Expr *CorrectedBase = CorrectedLHS.get();
2277 CorrectedBase =
Base;
2283 Base && ExprStatementTokLoc ==
Base->getBeginLoc(),
2289 if (MayBePseudoDestructor && !LHS.
isInvalid()) {
2290 LHS = ParseCXXPseudoDestructor(LHS.
get(), OpLoc, OpKind, SS,
2305 Tok.
is(tok::kw_class)) {
2315 Name.setIdentifier(
Id, Loc);
2322 false, &TemplateKWLoc, Name)) {
2329 OpKind, SS, TemplateKWLoc, Name,
2330 CurParsedObjCImpl ? CurParsedObjCImpl->Dcl
2333 if (Tok.
is(tok::less))
2334 checkPotentialAngleBracket(LHS);
2335 }
else if (OrigLHS && Name.isValid()) {
2338 Name.getEndLoc(), {OrigLHS});
2343 case tok::minusminus:
2391Parser::ParseExprAfterUnaryExprOrTypeTrait(
const Token &OpTok,
2396 assert(OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual, tok::kw_sizeof,
2397 tok::kw___datasizeof, tok::kw___alignof, tok::kw_alignof,
2398 tok::kw__Alignof, tok::kw_vec_step,
2399 tok::kw___builtin_omp_required_simd_align,
2400 tok::kw___builtin_vectorelements) &&
2401 "Not a typeof/sizeof/alignof/vec_step expression!");
2406 if (Tok.
isNot(tok::l_paren)) {
2409 if (OpTok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2410 tok::kw_alignof, tok::kw__Alignof)) {
2411 if (isTypeIdUnambiguously()) {
2413 ParseSpecifierQualifierList(DS);
2416 ParseDeclarator(DeclaratorInfo);
2422 diag::err_expected_parentheses_around_typename)
2425 Diag(LParenLoc, diag::err_expected_parentheses_around_typename)
2435 if (OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual) &&
2442 Operand = ParseCastExpression(UnaryExprOnly);
2448 ParenParseOption ExprType =
CastExpr;
2451 Operand = ParseParenExpression(ExprType,
true,
2452 false, CastTy, RParenLoc);
2463 !OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual)) {
2480ExprResult Parser::ParseSYCLUniqueStableNameExpression() {
2481 assert(Tok.
is(tok::kw___builtin_sycl_unique_stable_name) &&
2482 "Not __builtin_sycl_unique_stable_name");
2488 if (
T.expectAndConsume(diag::err_expected_lparen_after,
2489 "__builtin_sycl_unique_stable_name"))
2499 if (
T.consumeClose())
2503 OpLoc,
T.getOpenLocation(),
T.getCloseLocation(), Ty.
get());
2520ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
2521 assert(Tok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2522 tok::kw_alignof, tok::kw__Alignof, tok::kw_vec_step,
2523 tok::kw___builtin_omp_required_simd_align,
2524 tok::kw___builtin_vectorelements) &&
2525 "Not a sizeof/alignof/vec_step expression!");
2530 if (Tok.
is(tok::ellipsis) && OpTok.
is(tok::kw_sizeof)) {
2535 if (Tok.
is(tok::l_paren)) {
2538 LParenLoc =
T.getOpenLocation();
2539 if (Tok.
is(tok::identifier)) {
2543 RParenLoc =
T.getCloseLocation();
2547 Diag(Tok, diag::err_expected_parameter_pack);
2550 }
else if (Tok.
is(tok::identifier)) {
2555 Diag(LParenLoc, diag::err_paren_sizeof_parameter_pack)
2560 Diag(Tok, diag::err_sizeof_parameter_pack);
2577 OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2578 Diag(OpTok, diag::warn_cxx98_compat_alignof);
2580 Diag(OpTok, diag::warn_c23_compat_keyword) << OpTok.
getName();
2596 case tok::kw_alignof:
2597 case tok::kw__Alignof:
2598 ExprKind = UETT_AlignOf;
2600 case tok::kw___alignof:
2601 ExprKind = UETT_PreferredAlignOf;
2603 case tok::kw_vec_step:
2604 ExprKind = UETT_VecStep;
2606 case tok::kw___builtin_omp_required_simd_align:
2607 ExprKind = UETT_OpenMPRequiredSimdAlign;
2609 case tok::kw___datasizeof:
2610 ExprKind = UETT_DataSizeOf;
2612 case tok::kw___builtin_vectorelements:
2613 ExprKind = UETT_VectorElements;
2626 if (OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2662ExprResult Parser::ParseBuiltinPrimaryExpression() {
2670 if (Tok.
isNot(tok::l_paren))
2671 return ExprError(
Diag(Tok, diag::err_expected_after) << BuiltinII
2680 default: llvm_unreachable(
"Not a builtin primary expression!");
2681 case tok::kw___builtin_va_arg: {
2684 if (ExpectAndConsume(tok::comma)) {
2691 if (Tok.
isNot(tok::r_paren)) {
2692 Diag(Tok, diag::err_expected) << tok::r_paren;
2702 case tok::kw___builtin_offsetof: {
2708 if (MacroName ==
"offsetof")
2721 if (ExpectAndConsume(tok::comma)) {
2727 if (Tok.
isNot(tok::identifier)) {
2728 Diag(Tok, diag::err_expected) << tok::identifier;
2737 Comps.back().isBrackets =
false;
2739 Comps.back().LocStart = Comps.back().LocEnd =
ConsumeToken();
2743 if (Tok.
is(tok::period)) {
2746 Comps.back().isBrackets =
false;
2749 if (Tok.
isNot(tok::identifier)) {
2750 Diag(Tok, diag::err_expected) << tok::identifier;
2756 }
else if (Tok.
is(tok::l_square)) {
2757 if (CheckProhibitedCXX11Attribute())
2762 Comps.back().isBrackets =
true;
2765 Comps.back().LocStart = ST.getOpenLocation();
2771 Comps.back().U.E = Res.
get();
2774 Comps.back().LocEnd = ST.getCloseLocation();
2776 if (Tok.
isNot(tok::r_paren)) {
2785 PT.getCloseLocation());
2792 case tok::kw___builtin_choose_expr: {
2794 if (Cond.isInvalid()) {
2798 if (ExpectAndConsume(tok::comma)) {
2804 if (Expr1.isInvalid()) {
2808 if (ExpectAndConsume(tok::comma)) {
2814 if (Expr2.isInvalid()) {
2818 if (Tok.
isNot(tok::r_paren)) {
2819 Diag(Tok, diag::err_expected) << tok::r_paren;
2823 Expr2.get(), ConsumeParen());
2826 case tok::kw___builtin_astype: {
2829 if (
Expr.isInvalid()) {
2834 if (ExpectAndConsume(tok::comma)) {
2845 if (Tok.
isNot(tok::r_paren)) {
2846 Diag(Tok, diag::err_expected) << tok::r_paren;
2855 case tok::kw___builtin_convertvector: {
2858 if (
Expr.isInvalid()) {
2863 if (ExpectAndConsume(tok::comma)) {
2874 if (Tok.
isNot(tok::r_paren)) {
2875 Diag(Tok, diag::err_expected) << tok::r_paren;
2884 case tok::kw___builtin_COLUMN:
2885 case tok::kw___builtin_FILE:
2886 case tok::kw___builtin_FILE_NAME:
2887 case tok::kw___builtin_FUNCTION:
2888 case tok::kw___builtin_FUNCSIG:
2889 case tok::kw___builtin_LINE:
2890 case tok::kw___builtin_source_location: {
2892 if (Tok.
isNot(tok::r_paren)) {
2893 Diag(Tok, diag::err_expected) << tok::r_paren;
2899 case tok::kw___builtin_FILE:
2901 case tok::kw___builtin_FILE_NAME:
2903 case tok::kw___builtin_FUNCTION:
2905 case tok::kw___builtin_FUNCSIG:
2907 case tok::kw___builtin_LINE:
2909 case tok::kw___builtin_COLUMN:
2911 case tok::kw___builtin_source_location:
2914 llvm_unreachable(
"invalid keyword");
2927 return ParsePostfixExpressionSuffix(Res.
get());
2930bool Parser::tryParseOpenMPArrayShapingCastPart() {
2931 assert(Tok.
is(tok::l_square) &&
"Expected open bracket");
2932 bool ErrorFound =
true;
2933 TentativeParsingAction TPA(*
this);
2935 if (Tok.
isNot(tok::l_square))
2940 while (!
SkipUntil(tok::r_square, tok::annot_pragma_openmp_end,
2943 if (Tok.
isNot(tok::r_square))
2948 if (Tok.
is(tok::r_paren)) {
2952 }
while (Tok.
isNot(tok::annot_pragma_openmp_end));
2985Parser::ParseParenExpression(ParenParseOption &ExprType,
bool stopIfCastExpr,
2988 assert(Tok.
is(tok::l_paren) &&
"Not a paren expr!");
2991 if (
T.consumeOpen())
2995 PreferredType.enterParenExpr(Tok.
getLocation(), OpenLoc);
2998 bool isAmbiguousTypeId;
3001 if (Tok.
is(tok::code_completion)) {
3005 ExprType >= CompoundLiteral);
3012 tok::kw___bridge_transfer,
3013 tok::kw___bridge_retained,
3014 tok::kw___bridge_retain));
3015 if (BridgeCast && !
getLangOpts().ObjCAutoRefCount) {
3017 StringRef BridgeCastName = Tok.
getName();
3020 Diag(BridgeKeywordLoc, diag::warn_arc_bridge_cast_nonarc)
3030 Diag(Tok, OpenLoc.
isMacroID() ? diag::ext_gnu_statement_expr_macro
3031 : diag::ext_gnu_statement_expr);
3033 checkCompoundToken(OpenLoc, tok::l_paren, CompoundToken::StmtExprBegin);
3042 while (CodeDC->
isRecord() || isa<EnumDecl>(CodeDC)) {
3045 "statement expr not in code context");
3055 if (!
Stmt.isInvalid()) {
3062 }
else if (ExprType >= CompoundLiteral && BridgeCast) {
3068 if (tokenKind == tok::kw___bridge)
3070 else if (tokenKind == tok::kw___bridge_transfer)
3072 else if (tokenKind == tok::kw___bridge_retained)
3077 assert(tokenKind == tok::kw___bridge_retain);
3080 Diag(BridgeKeywordLoc, diag::err_arc_bridge_retain)
3082 "__bridge_retained");
3087 ColonProtection.restore();
3088 RParenLoc =
T.getCloseLocation();
3091 ExprResult SubExpr = ParseCastExpression(AnyCastExpr);
3097 BridgeKeywordLoc, Ty.
get(),
3098 RParenLoc, SubExpr.
get());
3099 }
else if (ExprType >= CompoundLiteral &&
3100 isTypeIdInParens(isAmbiguousTypeId)) {
3109 if (isAmbiguousTypeId && !stopIfCastExpr) {
3110 ExprResult res = ParseCXXAmbiguousParenExpression(ExprType, CastTy,
T,
3112 RParenLoc =
T.getCloseLocation();
3118 ParseSpecifierQualifierList(DS);
3121 ParseDeclarator(DeclaratorInfo);
3126 if (!DeclaratorInfo.isInvalidType() && Tok.
is(tok::identifier) &&
3140 ColonProtection.restore();
3141 RParenLoc =
T.getCloseLocation();
3142 if (Tok.
is(tok::l_brace)) {
3143 ExprType = CompoundLiteral;
3149 return ParseCompoundLiteralExpression(Ty.
get(), OpenLoc, RParenLoc);
3152 if (Tok.
is(tok::l_paren)) {
3173 Result = ParseCastExpression(AnyCastExpr,
3178 if (!
Result.isInvalid()) {
3180 DeclaratorInfo, CastTy,
3181 RParenLoc,
Result.get());
3185 if (!
Result.isInvalid()) {
3197 if (DeclaratorInfo.isInvalidType())
3202 if (stopIfCastExpr) {
3216 GetLookAheadToken(1).isNot(tok::period)) {
3225 Result = ParseCastExpression(AnyCastExpr,
3228 if (!
Result.isInvalid()) {
3230 DeclaratorInfo, CastTy,
3231 RParenLoc,
Result.get());
3236 Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
3239 }
else if (ExprType >= FoldExpr && Tok.
is(tok::ellipsis) &&
3241 ExprType = FoldExpr;
3243 }
else if (isTypeCast) {
3246 ExprVector ArgExprs;
3248 if (!ParseSimpleExpressionList(ArgExprs)) {
3251 if (ExprType >= FoldExpr && ArgExprs.size() == 1 &&
3253 ExprType = FoldExpr;
3254 return ParseFoldExpression(ArgExprs[0],
T);
3257 ExprType = SimpleExpr;
3261 }
else if (
getLangOpts().OpenMP >= 50 && OpenMPDirectiveParsing &&
3262 ExprType ==
CastExpr && Tok.
is(tok::l_square) &&
3263 tryParseOpenMPArrayShapingCastPart()) {
3264 bool ErrorFound =
false;
3274 while (!
SkipUntil(tok::r_square, tok::r_paren,
3279 OMPDimensions.push_back(NumElements.
get());
3280 OMPBracketsRanges.push_back(TS.getRange());
3281 }
while (Tok.
isNot(tok::r_paren));
3284 RParenLoc =
T.getCloseLocation();
3288 }
else if (!
Result.isInvalid()) {
3290 Result.get(), OpenLoc, RParenLoc, OMPDimensions, OMPBracketsRanges);
3303 if (ExprType >= FoldExpr && isFoldOperator(Tok.
getKind()) &&
3305 ExprType = FoldExpr;
3306 return ParseFoldExpression(
Result,
T);
3308 ExprType = SimpleExpr;
3311 if (!
Result.isInvalid() && Tok.
is(tok::r_paren))
3317 if (
Result.isInvalid()) {
3323 RParenLoc =
T.getCloseLocation();
3336Parser::ParseCompoundLiteralExpression(
ParsedType Ty,
3339 assert(Tok.
is(tok::l_brace) &&
"Not a compound literal!");
3341 Diag(LParenLoc, diag::ext_c99_compound_literal);
3344 if (!
Result.isInvalid() && Ty)
3370 "Not a string-literal-like token!");
3378 StringToks.push_back(Tok);
3383 assert(!AllowUserDefinedLiteral &&
"UDL are always evaluated");
3412ExprResult Parser::ParseGenericSelectionExpression() {
3413 assert(Tok.
is(tok::kw__Generic) &&
"_Generic keyword expected");
3415 diagnoseUseOfC11Keyword(Tok);
3419 if (
T.expectAndConsume())
3426 if (isTypeIdForGenericSelection()) {
3432 const auto *LIT = cast<LocInfoType>(ControllingType.
get().get());
3433 SourceLocation Loc = LIT->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
3434 Diag(Loc, diag::ext_generic_with_type_arg);
3448 if (ExpectAndConsume(tok::comma)) {
3458 if (Tok.
is(tok::kw_default)) {
3462 Diag(Tok, diag::err_duplicate_default_assoc);
3463 Diag(DefaultLoc, diag::note_previous_default_assoc);
3478 Types.push_back(Ty);
3480 if (ExpectAndConsume(tok::colon)) {
3489 if (ER.isInvalid()) {
3493 Exprs.push_back(ER.get());
3497 if (
T.getCloseLocation().isInvalid())
3500 void *ExprOrTy = ControllingExpr.
isUsable()
3501 ? ControllingExpr.
get()
3502 : ControllingType.
get().getAsOpaquePtr();
3505 KeyLoc, DefaultLoc,
T.getCloseLocation(), ControllingExpr.
isUsable(),
3506 ExprOrTy, Types, Exprs);
3528 assert(isFoldOperator(Kind) &&
"missing fold-operator");
3532 assert(Tok.
is(tok::ellipsis) &&
"not a fold-expression");
3536 if (Tok.
isNot(tok::r_paren)) {
3537 if (!isFoldOperator(Tok.
getKind()))
3540 if (Kind != tok::unknown && Tok.
getKind() != Kind)
3554 ? diag::warn_cxx14_compat_fold_expression
3555 : diag::ext_fold_expression);
3559 Kind, EllipsisLoc, RHS.
get(),
3560 T.getCloseLocation());
3586 llvm::function_ref<
void()> ExpressionStarts,
3587 bool FailImmediatelyOnInvalidExpr,
3588 bool EarlyTypoCorrection) {
3589 bool SawError =
false;
3591 if (ExpressionStarts)
3596 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3597 Expr = ParseBraceInitializer();
3601 if (EarlyTypoCorrection)
3604 if (Tok.
is(tok::ellipsis))
3606 else if (Tok.
is(tok::code_completion)) {
3616 if (
Expr.isInvalid()) {
3618 if (FailImmediatelyOnInvalidExpr)
3622 Exprs.push_back(
Expr.get());
3625 if (Tok.
isNot(tok::comma))
3630 checkPotentialAngleBracketDelimiter(Comma);
3635 for (
auto &E : Exprs) {
3637 if (
Expr.isUsable()) E =
Expr.get();
3654 if (
Expr.isInvalid())
3657 Exprs.push_back(
Expr.get());
3667 checkPotentialAngleBracketDelimiter(Comma);
3678 if (Tok.
is(tok::code_completion)) {
3686 ParseSpecifierQualifierList(DS);
3692 ParseDeclarator(DeclaratorInfo);
3694 MaybeParseGNUAttributes(DeclaratorInfo);
3710ExprResult Parser::ParseBlockLiteralExpression() {
3711 assert(Tok.
is(tok::caret) &&
"block literal starts with ^");
3715 "block literal parsing");
3738 if (Tok.
is(tok::l_paren)) {
3739 ParseParenDeclarator(ParamInfo);
3744 ParamInfo.SetIdentifier(
nullptr, CaretLoc);
3745 ParamInfo.SetRangeEnd(Tmp);
3746 if (ParamInfo.isInvalidType()) {
3754 MaybeParseGNUAttributes(ParamInfo);
3758 }
else if (!Tok.
is(tok::l_brace)) {
3759 ParseBlockId(CaretLoc);
3763 ParamInfo.AddTypeInfo(
3781 CaretLoc, CaretLoc, ParamInfo),
3784 MaybeParseGNUAttributes(ParamInfo);
3792 if (!Tok.
is(tok::l_brace)) {
3794 Diag(Tok, diag::err_expected_expression);
3801 if (!
Stmt.isInvalid())
3821 llvm::SmallSet<StringRef, 4> Platforms;
3822 bool HasOtherPlatformSpec =
false;
3824 for (
const auto &Spec : AvailSpecs) {
3825 if (Spec.isOtherPlatformSpec()) {
3826 if (HasOtherPlatformSpec) {
3827 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_star);
3831 HasOtherPlatformSpec =
true;
3835 bool Inserted = Platforms.insert(Spec.getPlatform()).second;
3840 StringRef Platform = Spec.getPlatform();
3841 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_platform)
3842 << Spec.getEndLoc() << Platform;
3847 if (!HasOtherPlatformSpec) {
3848 SourceLocation InsertWildcardLoc = AvailSpecs.back().getEndLoc();
3849 P.Diag(InsertWildcardLoc, diag::err_availability_query_wildcard_required)
3862std::optional<AvailabilitySpec> Parser::ParseAvailabilitySpec() {
3863 if (Tok.
is(tok::star)) {
3867 if (Tok.
is(tok::code_completion)) {
3870 return std::nullopt;
3872 if (Tok.
isNot(tok::identifier)) {
3873 Diag(Tok, diag::err_avail_query_expected_platform_name);
3874 return std::nullopt;
3879 VersionTuple Version = ParseVersionTuple(VersionRange);
3881 if (Version.empty())
3882 return std::nullopt;
3884 StringRef GivenPlatform = PlatformIdentifier->
Ident->
getName();
3885 StringRef Platform =
3886 AvailabilityAttr::canonicalizePlatformName(GivenPlatform);
3888 if (AvailabilityAttr::getPrettyPlatformName(Platform).empty() ||
3889 (GivenPlatform.contains(
"xros") || GivenPlatform.contains(
"xrOS"))) {
3891 diag::err_avail_query_unrecognized_platform_name)
3893 return std::nullopt;
3902 assert(Tok.
is(tok::kw___builtin_available) ||
3909 if (
Parens.expectAndConsume())
3913 bool HasError =
false;
3915 std::optional<AvailabilitySpec> Spec = ParseAvailabilitySpec();
3919 AvailSpecs.push_back(*Spec);
3932 if (
Parens.consumeClose())
3936 Parens.getCloseLocation());
Defines the clang::ASTContext interface.
static Decl::Kind getKind(const Decl *D)
Defines the clang::Expr interface and subclasses for C++ expressions.
static bool CheckAvailabilitySpecList(Parser &P, ArrayRef< AvailabilitySpec > AvailSpecs)
Validate availability spec list, emitting diagnostics if necessary.
#define REVERTIBLE_TYPE_TRAIT(Name)
Defines the PrettyStackTraceEntry class, which is used to make crashes give more contextual informati...
This file declares semantic analysis for CUDA constructs.
This file declares semantic analysis for 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)
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 ActOnClassPropertyRefExpr(const IdentifierInfo &receiverName, const IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType)
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
void ActOnStartStmtExpr()
QualType ProduceCallSignatureHelp(Expr *Fn, ArrayRef< Expr * > Args, SourceLocation OpenParLoc)
Determines the preferred type of the current function argument, by examining the signatures of all po...
void ActOnStmtExprError()
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, const IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, QualType PreferredType)
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
void CodeCompleteAvailabilityPlatformName()
bool CheckConstraintExpression(const Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
ASTContext & getASTContext() const
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
ExprResult ActOnUnevaluatedStringLiteral(ArrayRef< Token > StringToks)
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for.
SourceRange getExprRange(Expr *E) const
ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E)
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
The main callback when the parser finds something like expression .
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
ControllingExprOrType is either an opaque pointer coming out of a ParsedType or an Expr *.
void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockError - If there is an error parsing a block, this callback is invoked to pop the informati...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
@ PCC_Type
Code completion occurs where only a type is permitted.
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
ExprResult ActOnSourceLocExpr(SourceLocIdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc)
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
TypeResult ActOnTypeName(Declarator &D)
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e....
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type.
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, IdentifierInfo &Name, SourceLocation NameLoc, SourceLocation RParenLoc)
Called when an expression computing the size of a parameter pack is parsed.
ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, SourceRange ArgRange)
ActOnUnaryExprOrTypeTraitExpr - Handle sizeof(type) and sizeof expr and the same for alignof and __al...
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
ExprResult ActOnNameClassifiedAsOverloadSet(Scope *S, Expr *OverloadSet)
Act on the result of classifying a name as an overload set.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
Token - This structure provides full information about a lexed token.
IdentifierInfo * getIdentifierInfo() const
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
const char * getName() const
void setKind(tok::TokenKind K)
SourceLocation getAnnotationEndLoc() const
bool is(tok::TokenKind K) const
is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {....
tok::TokenKind getKind() const
bool isAtStartOfLine() const
isAtStartOfLine - Return true if this token is at the start of a line.
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const
bool isNot(tok::TokenKind K) const
bool isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const
Return true if we have an ObjC keyword identifier.
bool isSimpleTypeSpecifier(const LangOptions &LangOpts) const
Determine whether the token kind starts a simple-type-specifier.
SourceLocation getLastLoc() const
Base wrapper for a particular "section" of type source info.
The base class of the type hierarchy.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
bool isFunctionType() const
bool isVectorType() const
Simple class containing the result of Sema::CorrectTypo.
NamedDecl * getCorrectionDecl() const
Gets the pointer to the declaration of the typo correction.
Represents a C++ unqualified-id that has been parsed.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
bool tokenIsLikeStringLiteral(const Token &Tok, const LangOptions &LO)
Return true if the token is a string literal, or a function local predefined macro,...
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
@ Result
The result type of a method or function.
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
@ OBC_Bridge
Bridging via __bridge, which does nothing but reinterpret the bits.
@ OBC_BridgeTransfer
Bridging via __bridge_transfer, which transfers ownership of an Objective-C pointer into ARC.
@ OBC_BridgeRetained
Bridging via __bridge_retain, which makes an ARC object available as a +1 C pointer.
ActionResult< Expr * > ExprResult
prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, bool CPlusPlus11)
Return the precedence of the specified binary operator token.
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
const FunctionProtoType * T
@ Parens
New-expression has a C++98 paren-delimited initializer.
@ EST_None
no exception specification
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, ArrayRef< NamedDecl * > DeclsInPrototype, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult(), SourceLocation TrailingReturnTypeLoc=SourceLocation(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
Wraps an identifier and optional source location for the identifier.
Information about a template-id annotation token.
TemplateNameKind Kind
The kind of template that Template refers to.