42#include "llvm/ADT/SmallVector.h"
49 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
55 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
59Parser::ParseExpressionWithLeadingExtension(
SourceLocation ExtLoc) {
72 return ParseRHSOfBinaryExpression(LHS,
prec::Comma);
77 if (Tok.
is(tok::code_completion)) {
84 if (Tok.
is(tok::kw_throw))
85 return ParseThrowExpression();
86 if (Tok.
is(tok::kw_co_yield))
87 return ParseCoyieldExpression();
91 false, CorrectionBehavior);
96 if (Tok.
is(tok::code_completion)) {
110Parser::ParseAssignmentExprWithObjCMessageExprStart(
SourceLocation LBracLoc,
113 Expr *ReceiverExpr) {
115 = ParseObjCMessageExpressionBody(LBracLoc, SuperLoc,
116 ReceiverType, ReceiverExpr);
117 R = ParsePostfixExpressionSuffix(R);
125 "Call this function only if your ExpressionEvaluationContext is "
126 "already ConstantEvaluated");
128 CorrectionBehavior));
149 Actions.
ExprEvalContexts.back().InConditionallyConstantEvaluateContext =
true;
165 if (!
Iter->isUnevaluated())
167 Iter->InConditionallyConstantEvaluateContext =
true;
200 bool NotPrimaryExpression =
false;
201 auto ParsePrimary = [&]() {
205 false, &NotPrimaryExpression);
209 E = ParsePostfixExpressionSuffix(
E);
216 ? diag::note_unparenthesized_non_primary_expr_in_requires_clause
217 : diag::err_unparenthesized_non_primary_expr_in_requires_clause)
225 if (NotPrimaryExpression ||
232 Tok.
isOneOf(tok::period, tok::plusplus, tok::minusminus) ||
233 (Tok.
is(tok::l_square) && !
NextToken().is(tok::l_square))) {
234 E = RecoverFromNonPrimary(
E,
false);
237 NotPrimaryExpression =
false;
239 bool PossibleNonPrimary;
240 bool IsConstraintExpr =
242 IsTrailingRequiresClause);
243 if (!IsConstraintExpr || PossibleNonPrimary) {
248 if (PossibleNonPrimary)
249 E = RecoverFromNonPrimary(
E, !IsConstraintExpr);
257 while (Tok.
is(tok::ampamp)) {
264 tok::ampamp, LHS.
get(), RHS.
get());
278 while (Tok.
is(tok::pipepipe)) {
286 tok::pipepipe, LHS.
get(), RHS.
get());
295bool Parser::isNotExpressionStart() {
297 if (K == tok::l_brace || K == tok::r_brace ||
298 K == tok::kw_for || K == tok::kw_while ||
299 K == tok::kw_if || K == tok::kw_else ||
300 K == tok::kw_goto || K == tok::kw_try)
303 return isKnownToBeDeclarationSpecifier();
306bool Parser::isFoldOperator(
prec::Level Level)
const {
318 GreaterThanIsOperator,
322 auto SavedType = PreferredType;
325 PreferredType = SavedType;
329 if (NextTokPrec < MinPrec)
338 if (OpToken.
isOneOf(tok::comma, tok::greater, tok::greatergreater,
339 tok::greatergreatergreater) &&
340 checkPotentialAngleBracketDelimiter(OpToken))
348 if (OpToken.
is(tok::comma) && isNotExpressionStart()) {
356 if (isFoldOperator(NextTokPrec) && Tok.
is(tok::ellipsis)) {
370 Tok.
isOneOf(tok::colon, tok::r_square) &&
383 TernaryMiddle = ParseBraceInitializer();
384 if (!TernaryMiddle.isInvalid()) {
385 Diag(BraceLoc, diag::err_init_list_bin_op)
390 }
else if (Tok.
isNot(tok::colon)) {
402 TernaryMiddle =
nullptr;
403 Diag(Tok, diag::ext_gnu_conditional_expr);
406 if (TernaryMiddle.isInvalid()) {
408 TernaryMiddle =
nullptr;
417 const char *FIText =
": ";
421 bool IsInvalid =
false;
422 const char *SourcePtr =
424 if (!IsInvalid && *SourcePtr ==
' ') {
427 if (!IsInvalid && *SourcePtr ==
' ') {
434 Diag(Tok, diag::err_expected)
436 Diag(OpToken, diag::note_matching) << tok::question;
454 bool RHSIsInitList =
false;
456 RHS = ParseBraceInitializer();
457 RHSIsInitList =
true;
479 if (ThisPrec < NextTokPrec ||
480 (ThisPrec == NextTokPrec && isRightAssoc)) {
482 Diag(Tok, diag::err_init_list_bin_op)
491 RHS = ParseRHSOfBinaryExpression(RHS,
492 static_cast<prec::Level>(ThisPrec + !isRightAssoc));
493 RHSIsInitList =
false;
505 Diag(OpToken, diag::warn_cxx98_compat_generalized_initializer_lists)
507 }
else if (ColonLoc.
isValid()) {
508 Diag(ColonLoc, diag::err_init_list_bin_op)
513 Diag(OpToken, diag::err_init_list_bin_op)
522 if (TernaryMiddle.isInvalid()) {
526 if (!GreaterThanIsOperator && OpToken.
is(tok::greatergreater))
528 diag::warn_cxx11_right_shift_in_template_arg,
538 {LHS.get(), RHS.get()});
546 std::vector<clang::Expr *> Args;
548 if (TernaryMiddle.get())
549 Args = {LHS.
get(), TernaryMiddle.get(), RHS.
get()};
551 Args = {LHS.
get(), RHS.
get()};
563Parser::ParseCastExpression(
CastParseKind ParseKind,
bool isAddressOfOperand,
565 bool isVectorLiteral,
bool *NotPrimaryExpression) {
567 ExprResult Res = ParseCastExpression(ParseKind, isAddressOfOperand,
568 NotCastExpr, CorrectionBehavior,
569 isVectorLiteral, NotPrimaryExpression);
571 Diag(Tok, diag::err_expected_expression);
578 CastExpressionIdValidator(
Token Next,
581 WantTypeSpecifiers = WantFunctionLikeCasts =
582 (CorrectionBehavior != TypoCorrectionTypeBehavior::AllowNonTypes);
584 (CorrectionBehavior != TypoCorrectionTypeBehavior::AllowTypes);
587 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
592 if (isa<TypeDecl>(ND))
593 return WantTypeSpecifiers;
598 if (!NextToken.isOneOf(tok::equal, tok::arrow, tok::period))
601 for (
auto *
C : candidate) {
603 if (isa<ValueDecl>(ND) && !isa<FunctionDecl>(ND))
609 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
610 return std::make_unique<CastExpressionIdValidator>(*
this);
621 if (RevertibleTypeTraits.empty()) {
625#define RTT_JOIN(X, Y) X##Y
626#define REVERTIBLE_TYPE_TRAIT(Name) \
627 RevertibleTypeTraits[PP.getIdentifierInfo(#Name)] = RTT_JOIN(tok::kw_, Name)
684#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
685 REVERTIBLE_TYPE_TRAIT(RTT_JOIN(__, Trait));
686#include "clang/Basic/TransformTypeTraits.def"
687#undef REVERTIBLE_TYPE_TRAIT
690 llvm::SmallDenseMap<IdentifierInfo *, tok::TokenKind>::iterator Known =
691 RevertibleTypeTraits.find(II);
692 if (Known != RevertibleTypeTraits.end()) {
694 *
Kind = Known->second;
700ExprResult Parser::ParseBuiltinPtrauthTypeDiscriminator() {
704 if (
T.expectAndConsume())
716 Loc, UETT_PtrAuthTypeDiscriminator,
721Parser::ParseCastExpression(
CastParseKind ParseKind,
bool isAddressOfOperand,
724 bool isVectorLiteral,
bool *NotPrimaryExpression) {
727 auto SavedType = PreferredType;
733 bool AllowSuffix =
true;
763 Res = ParseParenExpression(ParenExprType,
false,
773 switch (ParenExprType) {
796 case tok::numeric_constant:
797 case tok::binary_data:
807 Res = ParseCXXBoolLiteral();
810 case tok::kw___objc_yes:
811 case tok::kw___objc_no:
812 Res = ParseObjCBoolLiteral();
815 case tok::kw_nullptr:
817 Diag(Tok, diag::warn_cxx98_compat_nullptr);
820 : diag::ext_c_nullptr) << Tok.
getName();
825 case tok::annot_primary_expr:
826 case tok::annot_overload_set:
827 Res = getExprAnnotation(Tok);
830 ConsumeAnnotationToken();
832 checkPotentialAngleBracket(Res);
835 case tok::annot_non_type:
836 case tok::annot_non_type_dependent:
837 case tok::annot_non_type_undeclared: {
840 Res = tryParseCXXIdExpression(SS, isAddressOfOperand, Replacement);
842 "should not perform typo correction on annotation token");
846 case tok::annot_embed: {
848 return ParseCastExpression(ParseKind, isAddressOfOperand,
849 CorrectionBehavior, isVectorLiteral,
850 NotPrimaryExpression);
853 case tok::kw___super:
854 case tok::kw_decltype:
858 assert(Tok.
isNot(tok::kw_decltype) && Tok.
isNot(tok::kw___super));
859 return ParseCastExpression(ParseKind, isAddressOfOperand,
860 CorrectionBehavior, isVectorLiteral,
861 NotPrimaryExpression);
863 case tok::identifier:
874 if (Next.is(tok::ellipsis) && Tok.
is(tok::identifier) &&
880 Tok.
isOneOf(tok::annot_pack_indexing_type, tok::annot_cxxscope))
881 return ParseCastExpression(ParseKind, isAddressOfOperand,
882 CorrectionBehavior, isVectorLiteral,
883 NotPrimaryExpression);
889 else if (Next.is(tok::l_paren) && Tok.
is(tok::identifier) &&
893 if (isRevertibleTypeTrait(II, &Kind)) {
895 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
896 CorrectionBehavior, isVectorLiteral,
897 NotPrimaryExpression);
901 else if ((!ColonIsSacred && Next.is(tok::colon)) ||
902 Next.isOneOf(tok::coloncolon, tok::less, tok::l_paren,
907 if (!Tok.
is(tok::identifier))
908 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
909 CorrectionBehavior, isVectorLiteral,
910 NotPrimaryExpression);
923 (&II == Ident_super &&
getCurScope()->isInObjcMethodScope()))) {
926 if (Tok.
is(tok::code_completion) && &II != Ident_super) {
929 getCurScope(), II, ILoc, ExprStatementTokLoc == ILoc);
933 if (Tok.
isNot(tok::identifier) &&
935 Diag(Tok, diag::err_expected_property_name);
950 if (
getLangOpts().
ObjC && &II == Ident_super && !InMessageExpression &&
952 ((Tok.
is(tok::identifier) &&
954 Tok.
is(tok::code_completion))) {
955 Res = ParseObjCMessageExpressionBody(
SourceLocation(), ILoc,
nullptr,
966 ((Tok.
is(tok::identifier) && !InMessageExpression) ||
967 Tok.
is(tok::code_completion))) {
969 if (Tok.
is(tok::code_completion) ||
970 Next.is(tok::colon) || Next.is(tok::r_square))
972 if (Typ.get()->isObjCObjectOrInterfaceType()) {
975 DS.SetRangeStart(ILoc);
976 DS.SetRangeEnd(ILoc);
977 const char *PrevSpec =
nullptr;
979 DS.SetTypeSpecType(
TST_typename, ILoc, PrevSpec, DiagID, Typ,
996 if (isAddressOfOperand && isPostfixExpressionSuffixStart())
997 isAddressOfOperand =
false;
1006 CastExpressionIdValidator Validator(Tok, CorrectionBehavior);
1007 Validator.IsAddressOfOperand = isAddressOfOperand;
1008 if (Tok.
isOneOf(tok::periodstar, tok::arrowstar)) {
1009 Validator.WantExpressionKeywords =
false;
1010 Validator.WantRemainingKeywords =
false;
1012 Validator.WantRemainingKeywords = Tok.
isNot(tok::r_paren);
1014 Name.setIdentifier(&II, ILoc);
1016 getCurScope(), ScopeSpec, TemplateKWLoc, Name, Tok.
is(tok::l_paren),
1017 isAddressOfOperand, &Validator,
1019 Tok.
is(tok::r_paren) ?
nullptr : &Replacement);
1021 UnconsumeToken(Replacement);
1022 return ParseCastExpression(
1023 ParseKind, isAddressOfOperand, NotCastExpr, CorrectionBehavior,
1024 false, NotPrimaryExpression);
1026 Res = tryParseCXXPackIndexingExpression(Res);
1028 checkPotentialAngleBracket(Res);
1031 case tok::char_constant:
1032 case tok::wide_char_constant:
1033 case tok::utf8_char_constant:
1034 case tok::utf16_char_constant:
1035 case tok::utf32_char_constant:
1039 case tok::kw___func__:
1040 case tok::kw___FUNCTION__:
1041 case tok::kw___FUNCDNAME__:
1042 case tok::kw___FUNCSIG__:
1043 case tok::kw_L__FUNCTION__:
1044 case tok::kw_L__FUNCSIG__:
1045 case tok::kw___PRETTY_FUNCTION__:
1057 case tok::string_literal:
1058 case tok::wide_string_literal:
1059 case tok::utf8_string_literal:
1060 case tok::utf16_string_literal:
1061 case tok::utf32_string_literal:
1064 case tok::kw__Generic:
1065 Res = ParseGenericSelectionExpression();
1067 case tok::kw___builtin_available:
1068 Res = ParseAvailabilityCheckExpr(Tok.
getLocation());
1070 case tok::kw___builtin_va_arg:
1071 case tok::kw___builtin_offsetof:
1072 case tok::kw___builtin_choose_expr:
1073 case tok::kw___builtin_astype:
1074 case tok::kw___builtin_convertvector:
1075 case tok::kw___builtin_COLUMN:
1076 case tok::kw___builtin_FILE:
1077 case tok::kw___builtin_FILE_NAME:
1078 case tok::kw___builtin_FUNCTION:
1079 case tok::kw___builtin_FUNCSIG:
1080 case tok::kw___builtin_LINE:
1081 case tok::kw___builtin_source_location:
1082 if (NotPrimaryExpression)
1083 *NotPrimaryExpression =
true;
1085 return ParseBuiltinPrimaryExpression();
1086 case tok::kw___null:
1091 case tok::minusminus: {
1092 if (NotPrimaryExpression)
1093 *NotPrimaryExpression =
true;
1098 Token SavedTok = Tok;
1115 UnconsumeToken(SavedTok);
1129 if (NotPrimaryExpression)
1130 *NotPrimaryExpression =
true;
1152 case tok::kw___real:
1153 case tok::kw___imag: {
1154 if (NotPrimaryExpression)
1155 *NotPrimaryExpression =
true;
1162 isAddressOfOperand);
1169 case tok::kw_co_await: {
1170 if (NotPrimaryExpression)
1171 *NotPrimaryExpression =
true;
1179 case tok::kw___extension__:{
1181 if (NotPrimaryExpression)
1182 *NotPrimaryExpression =
true;
1190 case tok::kw__Alignof:
1191 diagnoseUseOfC11Keyword(Tok);
1193 case tok::kw_alignof:
1194 case tok::kw___alignof:
1196 case tok::kw_sizeof:
1200 case tok::kw___datasizeof:
1201 case tok::kw_vec_step:
1203 case tok::kw___builtin_omp_required_simd_align:
1204 case tok::kw___builtin_vectorelements:
1205 case tok::kw__Countof:
1206 if (NotPrimaryExpression)
1207 *NotPrimaryExpression =
true;
1208 AllowSuffix =
false;
1209 Res = ParseUnaryExprOrTypeTraitExpression();
1212 if (NotPrimaryExpression)
1213 *NotPrimaryExpression =
true;
1215 if (Tok.
isNot(tok::identifier))
1216 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
1219 return ExprError(
Diag(Tok, diag::err_address_of_label_outside_fn));
1221 Diag(AmpAmpLoc, diag::ext_gnu_address_of_label);
1226 AllowSuffix =
false;
1229 case tok::kw_const_cast:
1230 case tok::kw_dynamic_cast:
1231 case tok::kw_reinterpret_cast:
1232 case tok::kw_static_cast:
1233 case tok::kw_addrspace_cast:
1234 if (NotPrimaryExpression)
1235 *NotPrimaryExpression =
true;
1236 Res = ParseCXXCasts();
1238 case tok::kw___builtin_bit_cast:
1239 if (NotPrimaryExpression)
1240 *NotPrimaryExpression =
true;
1241 Res = ParseBuiltinBitCast();
1243 case tok::kw_typeid:
1244 if (NotPrimaryExpression)
1245 *NotPrimaryExpression =
true;
1246 Res = ParseCXXTypeid();
1248 case tok::kw___uuidof:
1249 if (NotPrimaryExpression)
1250 *NotPrimaryExpression =
true;
1251 Res = ParseCXXUuidof();
1254 Res = ParseCXXThis();
1256 case tok::kw___builtin_sycl_unique_stable_name:
1257 Res = ParseSYCLUniqueStableNameExpression();
1260 case tok::annot_typename:
1261 if (isStartOfObjCClassMessageMissingOpenBracket()) {
1269 const char *PrevSpec =
nullptr;
1272 PrevSpec, DiagID,
Type,
1281 ConsumeAnnotationToken();
1288 case tok::annot_decltype:
1289 case tok::annot_pack_indexing_type:
1291 case tok::kw_wchar_t:
1292 case tok::kw_char8_t:
1293 case tok::kw_char16_t:
1294 case tok::kw_char32_t:
1299 case tok::kw___int64:
1300 case tok::kw___int128:
1301 case tok::kw__ExtInt:
1302 case tok::kw__BitInt:
1303 case tok::kw_signed:
1304 case tok::kw_unsigned:
1307 case tok::kw_double:
1308 case tok::kw___bf16:
1309 case tok::kw__Float16:
1310 case tok::kw___float128:
1311 case tok::kw___ibm128:
1314 case tok::kw_typename:
1315 case tok::kw_typeof:
1316 case tok::kw___vector:
1317 case tok::kw__Accum:
1318 case tok::kw__Fract:
1320#define GENERIC_IMAGE_TYPE(ImgType, Id) case tok::kw_##ImgType##_t:
1321#include "clang/Basic/OpenCLImageTypes.def"
1322#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case tok::kw_##Name:
1323#include "clang/Basic/HLSLIntangibleTypes.def"
1326 Diag(Tok, diag::err_expected_expression);
1331 if (NotPrimaryExpression)
1332 *NotPrimaryExpression =
true;
1334 if (SavedKind == tok::kw_typename) {
1351 ParseCXXSimpleTypeSpecifier(DS);
1352 if (Tok.
isNot(tok::l_paren) &&
1354 return ExprError(
Diag(Tok, diag::err_expected_lparen_after_type)
1355 << DS.getSourceRange());
1357 if (Tok.
is(tok::l_brace))
1358 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1360 Res = ParseCXXTypeConstructExpression(DS);
1364 case tok::annot_cxxscope: {
1369 if (!Tok.
is(tok::annot_cxxscope))
1370 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1371 CorrectionBehavior, isVectorLiteral,
1372 NotPrimaryExpression);
1375 if (Next.is(tok::annot_template_id)) {
1382 ParseOptionalCXXScopeSpecifier(SS,
nullptr,
1386 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1387 CorrectionBehavior, isVectorLiteral,
1388 NotPrimaryExpression);
1393 Res = ParseCXXIdExpression(isAddressOfOperand);
1397 case tok::annot_template_id: {
1405 return ParseCastExpression(ParseKind, isAddressOfOperand, NotCastExpr,
1406 CorrectionBehavior, isVectorLiteral,
1407 NotPrimaryExpression);
1414 case tok::kw_operator:
1415 Res = ParseCXXIdExpression(isAddressOfOperand);
1418 case tok::coloncolon: {
1423 if (!Tok.
is(tok::coloncolon))
1424 return ParseCastExpression(ParseKind, isAddressOfOperand,
1425 CorrectionBehavior, isVectorLiteral,
1426 NotPrimaryExpression);
1431 if (Tok.
is(tok::kw_new)) {
1432 if (NotPrimaryExpression)
1433 *NotPrimaryExpression =
true;
1434 Res = ParseCXXNewExpression(
true, CCLoc);
1435 AllowSuffix =
false;
1438 if (Tok.
is(tok::kw_delete)) {
1439 if (NotPrimaryExpression)
1440 *NotPrimaryExpression =
true;
1441 Res = ParseCXXDeleteExpression(
true, CCLoc);
1442 AllowSuffix =
false;
1447 Diag(CCLoc, diag::err_expected_expression);
1452 if (NotPrimaryExpression)
1453 *NotPrimaryExpression =
true;
1454 Res = ParseCXXNewExpression(
false, Tok.
getLocation());
1455 AllowSuffix =
false;
1458 case tok::kw_delete:
1459 if (NotPrimaryExpression)
1460 *NotPrimaryExpression =
true;
1461 Res = ParseCXXDeleteExpression(
false, Tok.
getLocation());
1462 AllowSuffix =
false;
1465 case tok::kw_requires:
1466 Res = ParseRequiresExpression();
1467 AllowSuffix =
false;
1470 case tok::kw_noexcept: {
1471 if (NotPrimaryExpression)
1472 *NotPrimaryExpression =
true;
1473 Diag(Tok, diag::warn_cxx98_compat_noexcept_expr);
1477 if (
T.expectAndConsume(diag::err_expected_lparen_after,
"noexcept"))
1490 T.getCloseLocation());
1491 AllowSuffix =
false;
1495#define TYPE_TRAIT(N,Spelling,K) \
1496 case tok::kw_##Spelling:
1497#include "clang/Basic/TokenKinds.def"
1498 Res = ParseTypeTrait();
1501 case tok::kw___array_rank:
1502 case tok::kw___array_extent:
1503 if (NotPrimaryExpression)
1504 *NotPrimaryExpression =
true;
1505 Res = ParseArrayTypeTrait();
1508 case tok::kw___builtin_ptrauth_type_discriminator:
1509 return ParseBuiltinPtrauthTypeDiscriminator();
1511 case tok::kw___is_lvalue_expr:
1512 case tok::kw___is_rvalue_expr:
1513 if (NotPrimaryExpression)
1514 *NotPrimaryExpression =
true;
1515 Res = ParseExpressionTrait();
1519 if (NotPrimaryExpression)
1520 *NotPrimaryExpression =
true;
1522 return ParseObjCAtExpression(AtLoc);
1525 Res = ParseBlockLiteralExpression();
1527 case tok::code_completion: {
1533#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) case tok::kw___##Trait:
1534#include "clang/Basic/TransformTypeTraits.def"
1539 Diag(Tok, diag::ext_keyword_as_ident)
1541 goto ParseIdentifier;
1543 goto ExpectedExpression;
1552 Res = TryParseLambdaExpression();
1556 if (NotPrimaryExpression)
1557 *NotPrimaryExpression =
true;
1558 Res = ParseObjCMessageExpression();
1562 Res = ParseLambdaExpression();
1566 Res = ParseObjCMessageExpression();
1595 case tok::minusminus:
1613 Diag(Tok.
getLocation(), diag::err_postfix_after_unary_requires_parens)
1621 PreferredType = SavedType;
1622 Res = ParsePostfixExpressionSuffix(Res);
1624 !
getActions().getOpenCLOptions().isAvailableOption(
1626 if (
Expr *PostfixExpr = Res.
get()) {
1627 QualType Ty = PostfixExpr->getType();
1629 Diag(PostfixExpr->getExprLoc(),
1630 diag::err_opencl_taking_function_address_parser);
1639Parser::ParsePostfixExpressionSuffix(
ExprResult LHS) {
1643 auto SavedType = PreferredType;
1646 PreferredType = SavedType;
1648 case tok::code_completion:
1649 if (InMessageExpression)
1657 case tok::identifier:
1664 nullptr, LHS.
get());
1672 case tok::l_square: {
1680 isSimpleObjCMessageExpression())
1685 if (CheckProhibitedCXX11Attribute()) {
1690 Loc =
T.getOpenLocation();
1693 ExprVector ArgExprs;
1694 bool HasError =
false;
1701 if ((!
getLangOpts().OpenMP && !AllowOpenACCArraySections) ||
1702 Tok.
isNot(tok::colon)) {
1706 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
1707 Idx = ParseBraceInitializer();
1714 ArgExprs.push_back(Idx.
get());
1716 }
else if (Tok.
isNot(tok::r_square)) {
1717 if (ParseExpressionList(ArgExprs)) {
1727 if (ArgExprs.size() <= 1 && AllowOpenACCArraySections) {
1729 if (Tok.
is(tok::colon)) {
1732 if (Tok.
isNot(tok::r_square))
1735 }
else if (ArgExprs.size() <= 1 &&
getLangOpts().OpenMP) {
1737 if (Tok.
is(tok::colon)) {
1740 if (Tok.
isNot(tok::r_square) &&
1747 (OMPClauseKind == llvm::omp::Clause::OMPC_to ||
1748 OMPClauseKind == llvm::omp::Clause::OMPC_from) &&
1749 Tok.
is(tok::colon)) {
1752 if (Tok.
isNot(tok::r_square)) {
1759 if (!LHS.
isInvalid() && !HasError && !Length.isInvalid() &&
1766 if (AllowOpenACCArraySections) {
1768 "Stride/second colon not allowed for OpenACC");
1770 LHS.
get(),
Loc, ArgExprs.empty() ?
nullptr : ArgExprs[0],
1771 ColonLocFirst, Length.get(), RLoc);
1774 LHS.
get(),
Loc, ArgExprs.empty() ?
nullptr : ArgExprs[0],
1775 ColonLocFirst, ColonLocSecond, Length.get(), Stride.
get(),
1792 case tok::lesslessless: {
1797 Expr *ExecConfig =
nullptr;
1801 if (OpKind == tok::lesslessless) {
1802 ExprVector ExecConfigExprs;
1805 if (ParseSimpleExpressionList(ExecConfigExprs)) {
1815 Diag(Tok, diag::err_expected) << tok::greatergreatergreater;
1816 Diag(OpenLoc, diag::note_matching) << tok::lesslessless;
1822 if (ExpectAndConsume(tok::l_paren))
1825 Loc = PrevTokLocation;
1830 getCurScope(), OpenLoc, ExecConfigExprs, CloseLoc);
1834 ExecConfig = ECResult.
get();
1838 Loc = PT.getOpenLocation();
1841 ExprVector ArgExprs;
1842 auto RunSignatureHelp = [&]() ->
QualType {
1845 LHS.
get(), ArgExprs, PT.getOpenLocation());
1846 CalledSignatureHelp =
true;
1847 return PreferredType;
1849 bool ExpressionListIsInvalid =
false;
1850 if (OpKind == tok::l_paren || !LHS.
isInvalid()) {
1851 if (Tok.
isNot(tok::r_paren)) {
1852 if ((ExpressionListIsInvalid = ParseExpressionList(ArgExprs, [&] {
1853 PreferredType.enterFunctionArgument(Tok.
getLocation(),
1869 }
else if (ExpressionListIsInvalid) {
1871 ArgExprs.insert(ArgExprs.begin(), Fn);
1875 }
else if (Tok.
isNot(tok::r_paren)) {
1876 bool HadErrors =
false;
1879 for (
auto &
E : ArgExprs)
1896 ArgExprs.insert(ArgExprs.begin(), Fn);
1914 bool MayBePseudoDestructor =
false;
1917 PreferredType.enterMemAccess(Actions, Tok.
getLocation(), OrigLHS);
1921 const Type* BaseType =
Base->getType().getTypePtrOrNull();
1922 if (BaseType && Tok.
is(tok::l_paren) &&
1925 Diag(OpLoc, diag::err_function_is_not_record)
1926 << OpKind <<
Base->getSourceRange()
1928 return ParsePostfixExpressionSuffix(
Base);
1933 MayBePseudoDestructor);
1938 if (Tok.
is(tok::code_completion)) {
1944 ParseOptionalCXXScopeSpecifier(
1946 false, &MayBePseudoDestructor);
1948 ObjectType =
nullptr;
1951 if (Tok.
is(tok::code_completion)) {
1953 OpKind == tok::arrow ? tok::period : tok::arrow;
1960 getCurScope(), OrigLHS, OpLoc, CorrectedOpKind, ObjectType,
1961 MayBePseudoDestructor);
1965 Expr *CorrectedBase = CorrectedLHS.get();
1967 CorrectedBase =
Base;
1973 Base && ExprStatementTokLoc ==
Base->getBeginLoc(),
1979 if (MayBePseudoDestructor && !LHS.
isInvalid()) {
1980 LHS = ParseCXXPseudoDestructor(LHS.
get(), OpLoc, OpKind, SS,
1995 Tok.
is(tok::kw_class)) {
2005 Name.setIdentifier(
Id,
Loc);
2012 false, &TemplateKWLoc, Name)) {
2018 OpKind, SS, TemplateKWLoc, Name,
2019 CurParsedObjCImpl ? CurParsedObjCImpl->Dcl
2022 if (Tok.
is(tok::less))
2023 checkPotentialAngleBracket(LHS);
2024 }
else if (OrigLHS && Name.isValid()) {
2027 Name.getEndLoc(), {OrigLHS});
2032 case tok::minusminus:
2048Parser::ParseExprAfterUnaryExprOrTypeTrait(
const Token &OpTok,
2053 assert(OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual, tok::kw_sizeof,
2054 tok::kw___datasizeof, tok::kw___alignof, tok::kw_alignof,
2055 tok::kw__Alignof, tok::kw_vec_step,
2056 tok::kw___builtin_omp_required_simd_align,
2057 tok::kw___builtin_vectorelements, tok::kw__Countof) &&
2058 "Not a typeof/sizeof/alignof/vec_step expression!");
2063 if (Tok.
isNot(tok::l_paren)) {
2066 if (OpTok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2067 tok::kw_alignof, tok::kw__Alignof)) {
2068 if (isTypeIdUnambiguously()) {
2070 ParseSpecifierQualifierList(DS);
2073 ParseDeclarator(DeclaratorInfo);
2079 diag::err_expected_parentheses_around_typename)
2082 Diag(LParenLoc, diag::err_expected_parentheses_around_typename)
2092 if (OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual) &&
2103 if (OpTok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2104 tok::kw_alignof, tok::kw__Alignof, tok::kw__Countof) &&
2105 Tok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2106 tok::kw_alignof, tok::kw__Alignof, tok::kw__Countof))
2108 Operand = ParseCastExpression(CastParseKind::UnaryExprOnly);
2127 bool ParenKnownToBeNonCast =
2128 OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual);
2132 Operand = ParseParenExpression(
2147 !OpTok.
isOneOf(tok::kw_typeof, tok::kw_typeof_unqual)) {
2162ExprResult Parser::ParseSYCLUniqueStableNameExpression() {
2163 assert(Tok.
is(tok::kw___builtin_sycl_unique_stable_name) &&
2164 "Not __builtin_sycl_unique_stable_name");
2170 if (
T.expectAndConsume(diag::err_expected_lparen_after,
2171 "__builtin_sycl_unique_stable_name"))
2181 if (
T.consumeClose())
2185 OpLoc,
T.getOpenLocation(),
T.getCloseLocation(), Ty.
get());
2188ExprResult Parser::ParseUnaryExprOrTypeTraitExpression() {
2189 assert(Tok.
isOneOf(tok::kw_sizeof, tok::kw___datasizeof, tok::kw___alignof,
2190 tok::kw_alignof, tok::kw__Alignof, tok::kw_vec_step,
2191 tok::kw___builtin_omp_required_simd_align,
2192 tok::kw___builtin_vectorelements, tok::kw__Countof) &&
2193 "Not a sizeof/alignof/vec_step expression!");
2198 if (Tok.
is(tok::ellipsis) && OpTok.
is(tok::kw_sizeof)) {
2203 if (Tok.
is(tok::l_paren)) {
2206 LParenLoc =
T.getOpenLocation();
2207 if (Tok.
is(tok::identifier)) {
2211 RParenLoc =
T.getCloseLocation();
2215 Diag(Tok, diag::err_expected_parameter_pack);
2218 }
else if (Tok.
is(tok::identifier)) {
2223 Diag(LParenLoc, diag::err_paren_sizeof_parameter_pack)
2228 Diag(Tok, diag::err_sizeof_parameter_pack);
2245 OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2246 Diag(OpTok, diag::warn_cxx98_compat_alignof);
2248 Diag(OpTok, diag::warn_c23_compat_keyword) << OpTok.
getName();
2250 Diag(OpTok, diag::warn_c2y_compat_keyword) << OpTok.
getName();
2266 case tok::kw_alignof:
2267 case tok::kw__Alignof:
2268 ExprKind = UETT_AlignOf;
2270 case tok::kw___alignof:
2271 ExprKind = UETT_PreferredAlignOf;
2273 case tok::kw_vec_step:
2274 ExprKind = UETT_VecStep;
2276 case tok::kw___builtin_omp_required_simd_align:
2277 ExprKind = UETT_OpenMPRequiredSimdAlign;
2279 case tok::kw___datasizeof:
2280 ExprKind = UETT_DataSizeOf;
2282 case tok::kw___builtin_vectorelements:
2283 ExprKind = UETT_VectorElements;
2285 case tok::kw__Countof:
2286 ExprKind = UETT_CountOf;
2289 Diag(OpTok, diag::ext_c2y_feature) << OpTok.
getName();
2302 if (OpTok.
isOneOf(tok::kw_alignof, tok::kw__Alignof))
2315ExprResult Parser::ParseBuiltinPrimaryExpression() {
2323 if (Tok.
isNot(tok::l_paren))
2324 return ExprError(
Diag(Tok, diag::err_expected_after) << BuiltinII
2333 default: llvm_unreachable(
"Not a builtin primary expression!");
2334 case tok::kw___builtin_va_arg: {
2337 if (ExpectAndConsume(tok::comma)) {
2344 if (Tok.
isNot(tok::r_paren)) {
2345 Diag(Tok, diag::err_expected) << tok::r_paren;
2355 case tok::kw___builtin_offsetof: {
2361 if (MacroName ==
"offsetof")
2374 if (ExpectAndConsume(tok::comma)) {
2380 if (Tok.
isNot(tok::identifier)) {
2381 Diag(Tok, diag::err_expected) << tok::identifier;
2390 Comps.back().isBrackets =
false;
2392 Comps.back().LocStart = Comps.back().LocEnd =
ConsumeToken();
2396 if (Tok.
is(tok::period)) {
2399 Comps.back().isBrackets =
false;
2402 if (Tok.
isNot(tok::identifier)) {
2403 Diag(Tok, diag::err_expected) << tok::identifier;
2409 }
else if (Tok.
is(tok::l_square)) {
2410 if (CheckProhibitedCXX11Attribute())
2415 Comps.back().isBrackets =
true;
2418 Comps.back().LocStart = ST.getOpenLocation();
2424 Comps.back().U.E = Res.
get();
2427 Comps.back().LocEnd = ST.getCloseLocation();
2429 if (Tok.
isNot(tok::r_paren)) {
2438 PT.getCloseLocation());
2445 case tok::kw___builtin_choose_expr: {
2447 if (Cond.isInvalid()) {
2451 if (ExpectAndConsume(tok::comma)) {
2457 if (Expr1.isInvalid()) {
2461 if (ExpectAndConsume(tok::comma)) {
2467 if (Expr2.isInvalid()) {
2471 if (Tok.
isNot(tok::r_paren)) {
2472 Diag(Tok, diag::err_expected) << tok::r_paren;
2476 Expr2.get(), ConsumeParen());
2479 case tok::kw___builtin_astype: {
2482 if (
Expr.isInvalid()) {
2487 if (ExpectAndConsume(tok::comma)) {
2498 if (Tok.
isNot(tok::r_paren)) {
2499 Diag(Tok, diag::err_expected) << tok::r_paren;
2508 case tok::kw___builtin_convertvector: {
2511 if (
Expr.isInvalid()) {
2516 if (ExpectAndConsume(tok::comma)) {
2527 if (Tok.
isNot(tok::r_paren)) {
2528 Diag(Tok, diag::err_expected) << tok::r_paren;
2537 case tok::kw___builtin_COLUMN:
2538 case tok::kw___builtin_FILE:
2539 case tok::kw___builtin_FILE_NAME:
2540 case tok::kw___builtin_FUNCTION:
2541 case tok::kw___builtin_FUNCSIG:
2542 case tok::kw___builtin_LINE:
2543 case tok::kw___builtin_source_location: {
2545 if (Tok.
isNot(tok::r_paren)) {
2546 Diag(Tok, diag::err_expected) << tok::r_paren;
2552 case tok::kw___builtin_FILE:
2554 case tok::kw___builtin_FILE_NAME:
2556 case tok::kw___builtin_FUNCTION:
2558 case tok::kw___builtin_FUNCSIG:
2560 case tok::kw___builtin_LINE:
2562 case tok::kw___builtin_COLUMN:
2564 case tok::kw___builtin_source_location:
2567 llvm_unreachable(
"invalid keyword");
2580 return ParsePostfixExpressionSuffix(Res.
get());
2583bool Parser::tryParseOpenMPArrayShapingCastPart() {
2584 assert(Tok.
is(tok::l_square) &&
"Expected open bracket");
2585 bool ErrorFound =
true;
2586 TentativeParsingAction TPA(*
this);
2588 if (Tok.
isNot(tok::l_square))
2593 while (!
SkipUntil(tok::r_square, tok::annot_pragma_openmp_end,
2596 if (Tok.
isNot(tok::r_square))
2601 if (Tok.
is(tok::r_paren)) {
2605 }
while (Tok.
isNot(tok::annot_pragma_openmp_end));
2611Parser::ParseParenExpression(
ParenParseOption &ExprType,
bool StopIfCastExpr,
2615 assert(Tok.
is(tok::l_paren) &&
"Not a paren expr!");
2618 if (
T.consumeOpen())
2622 PreferredType.enterParenExpr(Tok.
getLocation(), OpenLoc);
2625 bool isAmbiguousTypeId;
2628 if (Tok.
is(tok::code_completion)) {
2639 tok::kw___bridge_transfer,
2640 tok::kw___bridge_retained,
2641 tok::kw___bridge_retain));
2642 if (BridgeCast && !
getLangOpts().ObjCAutoRefCount) {
2644 StringRef BridgeCastName = Tok.
getName();
2647 Diag(BridgeKeywordLoc, diag::warn_arc_bridge_cast_nonarc)
2657 Diag(Tok, OpenLoc.
isMacroID() ? diag::ext_gnu_statement_expr_macro
2658 : diag::ext_gnu_statement_expr);
2660 checkCompoundToken(OpenLoc, tok::l_paren, CompoundToken::StmtExprBegin);
2669 while (CodeDC->
isRecord() || isa<EnumDecl>(CodeDC)) {
2672 "statement expr not in code context");
2682 if (!
Stmt.isInvalid()) {
2695 if (tokenKind == tok::kw___bridge)
2697 else if (tokenKind == tok::kw___bridge_transfer)
2699 else if (tokenKind == tok::kw___bridge_retained)
2704 assert(tokenKind == tok::kw___bridge_retain);
2707 Diag(BridgeKeywordLoc, diag::err_arc_bridge_retain)
2709 "__bridge_retained");
2714 ColonProtection.restore();
2715 RParenLoc =
T.getCloseLocation();
2724 BridgeKeywordLoc, Ty.
get(),
2725 RParenLoc, SubExpr.
get());
2727 isTypeIdInParens(isAmbiguousTypeId)) {
2736 if (isAmbiguousTypeId && !StopIfCastExpr) {
2737 ExprResult res = ParseCXXAmbiguousParenExpression(ExprType, CastTy,
T,
2739 RParenLoc =
T.getCloseLocation();
2745 ParseSpecifierQualifierList(DS);
2748 ParseDeclarator(DeclaratorInfo);
2753 if (!DeclaratorInfo.isInvalidType() && Tok.
is(tok::identifier) &&
2767 ColonProtection.restore();
2768 RParenLoc =
T.getCloseLocation();
2776 return ParseCompoundLiteralExpression(Ty.
get(), OpenLoc, RParenLoc);
2800 Result = ParseCastExpression(
2806 if (!
Result.isInvalid()) {
2808 DeclaratorInfo, CastTy,
2809 RParenLoc,
Result.get());
2813 if (!
Result.isInvalid()) {
2825 if (DeclaratorInfo.isInvalidType())
2830 if (StopIfCastExpr) {
2853 Result = ParseCastExpression(
2857 if (!
Result.isInvalid()) {
2859 DeclaratorInfo, CastTy,
2860 RParenLoc,
Result.get());
2865 Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
2876 ExprVector ArgExprs;
2878 if (!ParseSimpleExpressionList(ArgExprs)) {
2884 return ParseFoldExpression(ArgExprs[0],
T);
2891 }
else if (
getLangOpts().OpenMP >= 50 && OpenMPDirectiveParsing &&
2893 tryParseOpenMPArrayShapingCastPart()) {
2894 bool ErrorFound =
false;
2903 while (!
SkipUntil(tok::r_square, tok::r_paren,
2908 OMPDimensions.push_back(NumElements.
get());
2909 OMPBracketsRanges.push_back(TS.getRange());
2910 }
while (Tok.
isNot(tok::r_paren));
2913 RParenLoc =
T.getCloseLocation();
2917 }
else if (!
Result.isInvalid()) {
2919 Result.get(), OpenLoc, RParenLoc, OMPDimensions, OMPBracketsRanges);
2929 return ParseFoldExpression(
Result,
T);
2934 if (!
Result.isInvalid() && Tok.
is(tok::r_paren))
2940 if (
Result.isInvalid()) {
2946 RParenLoc =
T.getCloseLocation();
2951Parser::ParseCompoundLiteralExpression(
ParsedType Ty,
2954 assert(Tok.
is(tok::l_brace) &&
"Not a compound literal!");
2956 Diag(LParenLoc, diag::ext_c99_compound_literal);
2959 if (!
Result.isInvalid() && Ty)
2977 "Not a string-literal-like token!");
2985 StringToks.push_back(Tok);
2990 assert(!AllowUserDefinedLiteral &&
"UDL are always evaluated");
3000ExprResult Parser::ParseGenericSelectionExpression() {
3001 assert(Tok.
is(tok::kw__Generic) &&
"_Generic keyword expected");
3003 diagnoseUseOfC11Keyword(Tok);
3007 if (
T.expectAndConsume())
3014 if (isTypeIdForGenericSelection()) {
3020 const auto *LIT = cast<LocInfoType>(ControllingType.
get().get());
3023 : diag::ext_c2y_generic_with_type_arg);
3036 if (ExpectAndConsume(tok::comma)) {
3046 if (Tok.
is(tok::kw_default)) {
3050 Diag(Tok, diag::err_duplicate_default_assoc);
3051 Diag(DefaultLoc, diag::note_previous_default_assoc);
3066 Types.push_back(Ty);
3068 if (ExpectAndConsume(tok::colon)) {
3080 Exprs.push_back(ER.
get());
3084 if (
T.getCloseLocation().isInvalid())
3087 void *ExprOrTy = ControllingExpr.
isUsable()
3088 ? ControllingExpr.
get()
3089 : ControllingType.
get().getAsOpaquePtr();
3092 KeyLoc, DefaultLoc,
T.getCloseLocation(), ControllingExpr.
isUsable(),
3093 ExprOrTy, Types, Exprs);
3107 assert(isFoldOperator(Kind) &&
"missing fold-operator");
3111 assert(Tok.
is(tok::ellipsis) &&
"not a fold-expression");
3115 if (Tok.
isNot(tok::r_paren)) {
3116 if (!isFoldOperator(Tok.
getKind()))
3119 if (Kind != tok::unknown && Tok.
getKind() != Kind)
3133 ? diag::warn_cxx14_compat_fold_expression
3134 : diag::ext_fold_expression);
3138 Kind, EllipsisLoc, RHS.
get(),
3139 T.getCloseLocation());
3142void Parser::injectEmbedTokens() {
3146 Data->BinaryData.size() * 2 - 1),
3147 Data->BinaryData.size() * 2 - 1);
3149 for (
auto &Byte :
Data->BinaryData) {
3150 Toks[I].startToken();
3151 Toks[I].setKind(tok::binary_data);
3153 Toks[I].setLength(1);
3154 Toks[I].setLiteralData(&Byte);
3155 if (I != ((
Data->BinaryData.size() - 1) * 2)) {
3156 Toks[I + 1].startToken();
3157 Toks[I + 1].setKind(tok::comma);
3162 PP.EnterTokenStream(std::move(Toks),
true,
3168 llvm::function_ref<
void()> ExpressionStarts,
3169 bool FailImmediatelyOnInvalidExpr) {
3170 bool SawError =
false;
3172 if (ExpressionStarts)
3177 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3178 Expr = ParseBraceInitializer();
3182 if (Tok.
is(tok::ellipsis))
3184 else if (Tok.
is(tok::code_completion)) {
3194 if (
Expr.isInvalid()) {
3196 if (FailImmediatelyOnInvalidExpr)
3200 Exprs.push_back(
Expr.get());
3203 if (Tok.
isNot(tok::comma))
3208 checkPotentialAngleBracketDelimiter(Comma);
3216 if (
Expr.isInvalid())
3219 Exprs.push_back(
Expr.get());
3229 checkPotentialAngleBracketDelimiter(Comma);
3234 if (Tok.
is(tok::code_completion)) {
3243 ParseSpecifierQualifierList(DS);
3249 ParseDeclarator(DeclaratorInfo);
3251 MaybeParseGNUAttributes(DeclaratorInfo);
3257ExprResult Parser::ParseBlockLiteralExpression() {
3258 assert(Tok.
is(tok::caret) &&
"block literal starts with ^");
3262 "block literal parsing");
3285 if (Tok.
is(tok::l_paren)) {
3286 ParseParenDeclarator(ParamInfo);
3291 ParamInfo.SetIdentifier(
nullptr, CaretLoc);
3292 ParamInfo.SetRangeEnd(Tmp);
3293 if (ParamInfo.isInvalidType()) {
3301 MaybeParseGNUAttributes(ParamInfo);
3305 }
else if (!Tok.
is(tok::l_brace)) {
3306 ParseBlockId(CaretLoc);
3310 ParamInfo.AddTypeInfo(
3328 CaretLoc, ParamInfo),
3331 MaybeParseGNUAttributes(ParamInfo);
3339 if (!Tok.
is(tok::l_brace)) {
3341 Diag(Tok, diag::err_expected_expression);
3349 if (!
Stmt.isInvalid())
3365 llvm::SmallSet<StringRef, 4> Platforms;
3366 bool HasOtherPlatformSpec =
false;
3368 for (
const auto &Spec : AvailSpecs) {
3369 if (Spec.isOtherPlatformSpec()) {
3370 if (HasOtherPlatformSpec) {
3371 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_star);
3375 HasOtherPlatformSpec =
true;
3379 bool Inserted = Platforms.insert(Spec.getPlatform()).second;
3384 StringRef Platform = Spec.getPlatform();
3385 P.Diag(Spec.getBeginLoc(), diag::err_availability_query_repeated_platform)
3386 << Spec.getEndLoc() << Platform;
3391 if (!HasOtherPlatformSpec) {
3392 SourceLocation InsertWildcardLoc = AvailSpecs.back().getEndLoc();
3393 P.Diag(InsertWildcardLoc, diag::err_availability_query_wildcard_required)
3401std::optional<AvailabilitySpec> Parser::ParseAvailabilitySpec() {
3402 if (Tok.
is(tok::star)) {
3406 if (Tok.
is(tok::code_completion)) {
3409 return std::nullopt;
3411 if (Tok.
isNot(tok::identifier)) {
3412 Diag(Tok, diag::err_avail_query_expected_platform_name);
3413 return std::nullopt;
3418 VersionTuple Version = ParseVersionTuple(VersionRange);
3420 if (Version.empty())
3421 return std::nullopt;
3423 StringRef GivenPlatform =
3425 StringRef Platform =
3426 AvailabilityAttr::canonicalizePlatformName(GivenPlatform);
3428 if (AvailabilityAttr::getPrettyPlatformName(Platform).empty() ||
3429 (GivenPlatform.contains(
"xros") || GivenPlatform.contains(
"xrOS"))) {
3431 diag::err_avail_query_unrecognized_platform_name)
3433 return std::nullopt;
3442 assert(Tok.
is(tok::kw___builtin_available) ||
3449 if (
Parens.expectAndConsume())
3453 bool HasError =
false;
3455 std::optional<AvailabilitySpec> Spec = ParseAvailabilitySpec();
3459 AvailSpecs.push_back(*Spec);
3472 if (
Parens.consumeClose())
3476 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.
ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and restores it when destroyed.
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 function expression evaluation context.
RAII object that enters a new expression evaluation context.
This represents one expression.
bool containsErrors() const
Whether this expression contains subexpressions which had errors.
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.
A simple pair of identifier info and location.
SourceLocation getLoc() const
IdentifierInfo * getIdentifierInfo() const
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.
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
ExprResult ParseStringLiteralExpression(bool AllowUserDefinedLiteral=false)
ParseStringLiteralExpression - This handles the various token types that form string literals,...
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.
ExprResult ParseConstantExpressionInExprEvalContext(TypoCorrectionTypeBehavior CorrectionBehavior=TypoCorrectionTypeBehavior::AllowNonTypes)
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.
const Token & GetLookAheadToken(unsigned N)
GetLookAheadToken - This peeks ahead N tokens and returns that token without consuming any tokens.
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 ...
const LangOptions & getLangOpts() const
ExprResult ParseExpression(TypoCorrectionTypeBehavior CorrectionBehavior=TypoCorrectionTypeBehavior::AllowNonTypes)
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...
ExprResult ParseUnevaluatedStringLiteralExpression()
const Token & NextToken()
NextToken - This peeks ahead one token and returns it without consuming it.
ExprResult ParseAssignmentExpression(TypoCorrectionTypeBehavior CorrectionBehavior=TypoCorrectionTypeBehavior::AllowNonTypes)
Parse an expr that doesn't include (top-level) commas.
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
llvm::BumpPtrAllocator & getPreprocessorAllocator()
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)
Unary Operators. 'Tok' is the token for the operator.
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)
const ExpressionEvaluationContextRecord & currentEvaluationContext() const
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)
Binary Operators. 'Tok' is the token for the operator.
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...
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Parse a __builtin_astype expression.
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...
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
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)
ActOnConvertVectorExpr - create a new convert-vector expression from the provided arguments.
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
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)) {....
void * getAnnotationValue() const
tok::TokenKind getKind() const
bool isAtStartOfLine() const
isAtStartOfLine - Return true if this token is at the start of a line.
bool isOneOf(Ts... Ks) 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.
TypoCorrectionTypeBehavior
If a typo should be encountered, should typo correction suggest type names, non type names,...
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
ParenExprKind
In a call to ParseParenExpression, are the initial parentheses part of an operator that requires the ...
CastParseKind
Control what ParseCastExpression will parse.
ParenParseOption
ParenParseOption - Control what ParseParenExpression will parse.
@ 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.
Helper class to shuttle information about #embed directives from the preprocessor to the parser throu...
bool IsCaseExpr
Whether evaluating an expression for a switch case label.
Information about a template-id annotation token.
TemplateNameKind Kind
The kind of template that Template refers to.