22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringExtras.h"
25 using namespace clang;
30 if (Tok.
is(tok::kw___attribute)) {
31 if (Kind == tok::objc_interface || Kind == tok::objc_protocol)
32 Diag(Tok, diag::err_objc_postfix_attribute_hint)
33 << (Kind == tok::objc_protocol);
35 Diag(Tok, diag::err_objc_postfix_attribute);
36 ParseGNUAttributes(attrs);
51 if (Tok.
is(tok::code_completion)) {
57 Decl *SingleDecl =
nullptr;
60 return ParseObjCAtClassDeclaration(AtLoc);
61 case tok::objc_interface: {
63 SingleDecl = ParseObjCAtInterfaceDeclaration(AtLoc, attrs);
66 case tok::objc_protocol: {
68 return ParseObjCAtProtocolDeclaration(AtLoc, attrs);
70 case tok::objc_implementation:
71 return ParseObjCAtImplementationDeclaration(AtLoc);
73 return ParseObjCAtEndDeclaration(AtLoc);
74 case tok::objc_compatibility_alias:
75 SingleDecl = ParseObjCAtAliasDeclaration(AtLoc);
77 case tok::objc_synthesize:
78 SingleDecl = ParseObjCPropertySynthesize(AtLoc);
80 case tok::objc_dynamic:
81 SingleDecl = ParseObjCPropertyDynamic(AtLoc);
83 case tok::objc_import:
85 return ParseModuleImport(AtLoc);
86 Diag(AtLoc, diag::err_atimport);
90 Diag(AtLoc, diag::err_unexpected_at);
106 : Actions(Actions), S(S), Params(nullptr) {}
119 Actions.popObjCTypeParamList(
S, Params);
139 MaybeSkipAttributes(tok::objc_class);
140 if (Tok.
isNot(tok::identifier)) {
141 Diag(Tok, diag::err_expected) << tok::identifier;
151 if (Tok.
is(tok::less))
152 TypeParams = parseObjCTypeParamList();
153 ClassTypeParams.push_back(TypeParams);
159 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
"@class"))
175 if (CurParsedObjCImpl) {
176 CurParsedObjCImpl->finish(AtLoc);
180 Diag(AtLoc, diag::err_objc_missing_end)
183 Diag(Decl->getLocStart(), diag::note_objc_container_start)
219 "ParseObjCAtInterfaceDeclaration(): Expected @interface");
220 CheckNestedObjCContexts(AtLoc);
224 if (Tok.
is(tok::code_completion)) {
230 MaybeSkipAttributes(tok::objc_interface);
232 if (Tok.
isNot(tok::identifier)) {
233 Diag(Tok, diag::err_expected)
248 ObjCTypeParamListScope typeParamScope(Actions,
getCurScope());
249 if (Tok.
is(tok::less))
250 typeParameterList = parseObjCTypeParamListOrProtocolRefs(
251 typeParamScope, LAngleLoc, ProtocolIdents, EndProtoLoc);
253 if (Tok.
is(tok::l_paren) &&
254 !isKnownToBeTypeSpecifier(GetLookAheadToken(1))) {
261 if (Tok.
is(tok::code_completion)) {
268 if (Tok.
is(tok::identifier)) {
273 Diag(Tok, diag::err_expected)
279 if (T.getCloseLocation().isInvalid())
282 if (!attrs.empty()) {
283 Diag(nameLoc, diag::err_objc_no_attributes_on_category);
288 assert(LAngleLoc.
isInvalid() &&
"Cannot have already parsed protocols");
291 if (Tok.
is(tok::less) &&
292 ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs,
true,
true,
293 LAngleLoc, EndProtoLoc,
301 categoryId, categoryLoc,
307 if (Tok.
is(tok::l_brace))
308 ParseObjCClassInstanceVariables(CategoryType, tok::objc_private, AtLoc);
310 ParseObjCInterfaceDeclList(tok::objc_not_keyword, CategoryType);
322 if (Tok.
is(tok::colon)) {
326 if (Tok.
is(tok::code_completion)) {
332 if (Tok.
isNot(tok::identifier)) {
333 Diag(Tok, diag::err_expected)
341 if (Tok.
is(tok::less)) {
342 parseObjCTypeArgsOrProtocolQualifiers(
343 nullptr, typeArgsLAngleLoc, typeArgs, typeArgsRAngleLoc, LAngleLoc,
344 protocols, protocolLocs, EndProtoLoc,
352 if (!ProtocolIdents.empty()) {
355 for (
const auto &pair : ProtocolIdents) {
356 protocolLocs.push_back(pair.second);
360 ProtocolIdents, protocols);
362 }
else if (protocols.empty() && Tok.
is(tok::less) &&
363 ParseObjCProtocolReferences(protocols, protocolLocs,
true,
true,
364 LAngleLoc, EndProtoLoc,
369 if (Tok.
isNot(tok::less))
374 typeParameterList, superClassId,
379 protocols.data(), protocols.size(),
381 EndProtoLoc, attrs.getList());
383 if (Tok.
is(tok::l_brace))
384 ParseObjCClassInstanceVariables(ClsType, tok::objc_protected, AtLoc);
386 ParseObjCInterfaceDeclList(tok::objc_interface, ClsType);
397 bool &addedToDeclSpec) {
410 auto nullabilityAttr = getNullabilityAttr();
414 }
else if (!addedToDeclSpec) {
418 addedToDeclSpec =
true;
450 assert(Tok.
is(tok::less) &&
"Not at the beginning of a type parameter list");
458 auto makeProtocolIdentsIntoTypeParameters = [&]() {
460 for (
const auto &pair : protocolIdents) {
465 typeParams.push_back(typeParam.
get());
468 protocolIdents.clear();
469 mayBeProtocolList =
false;
472 bool invalid =
false;
479 if (Tok.
is(tok::kw___covariant) || Tok.
is(tok::kw___contravariant)) {
480 variance = Tok.
is(tok::kw___covariant)
487 if (mayBeProtocolList) {
490 makeProtocolIdentsIntoTypeParameters();
495 if (!Tok.
is(tok::identifier)) {
497 if (Tok.
is(tok::code_completion)) {
507 Diag(Tok, diag::err_objc_expected_type_parameter);
521 if (mayBeProtocolList) {
524 makeProtocolIdentsIntoTypeParameters();
531 }
else if (mayBeProtocolList) {
534 protocolIdents.push_back(std::make_pair(paramName, paramLoc));
540 getCurScope(), variance, varianceLoc, typeParams.size(), paramName,
541 paramLoc, colonLoc, boundType.
isUsable() ? boundType.
get() :
nullptr);
543 typeParams.push_back(typeParam.
get());
549 if (Tok.
is(tok::greater))
551 }
else if (ParseGreaterThanInTemplateList(rAngleLoc,
554 Diag(lAngleLoc, diag::note_matching) <<
"'<'";
555 SkipUntil({tok::greater, tok::greaterequal, tok::at, tok::minus,
556 tok::minus, tok::plus, tok::colon, tok::l_paren, tok::l_brace,
557 tok::comma, tok::semi },
559 if (Tok.
is(tok::greater))
563 if (mayBeProtocolList) {
568 if (Tok.
isNot(tok::colon) && Tok.
isNot(tok::l_paren)) {
577 makeProtocolIdentsIntoTypeParameters();
592 return invalid ?
nullptr : list;
601 ObjCTypeParamListScope Scope(Actions,
getCurScope());
602 return parseObjCTypeParamListOrProtocolRefs(Scope, lAngleLoc, protocolIdents,
629 if (Tok.
isOneOf(tok::minus, tok::plus)) {
630 if (Decl *methodPrototype =
631 ParseObjCMethodPrototype(MethodImplKind,
false))
632 allMethods.push_back(methodPrototype);
635 if (ExpectAndConsumeSemi(diag::err_expected_semi_after_method_proto)) {
638 if (Tok.
is(tok::semi))
643 if (Tok.
is(tok::l_paren)) {
644 Diag(Tok, diag::err_expected_minus_or_plus);
647 MethodImplKind,
false);
651 if (Tok.
is(tok::semi)) {
661 if (Tok.
is(tok::code_completion)) {
665 return cutOffParsing();
669 if (Tok.
isNot(tok::at)) {
673 if (Tok.
is(tok::r_brace))
675 ParsedAttributesWithRange attrs(AttrFactory);
676 allTUVariables.push_back(ParseDeclarationOrFunctionDefinition(attrs));
682 if (Tok.
is(tok::code_completion)) {
684 return cutOffParsing();
689 if (DirectiveKind == tok::objc_end) {
693 }
else if (DirectiveKind == tok::objc_not_keyword) {
694 Diag(Tok, diag::err_objc_unknown_at);
702 switch (DirectiveKind) {
708 Diag(AtLoc, diag::err_objc_illegal_interface_qual);
713 case tok::objc_implementation:
714 case tok::objc_interface:
715 Diag(AtLoc, diag::err_objc_missing_end)
717 Diag(CDecl->getLocStart(), diag::note_objc_container_start)
718 << (
int) Actions.getObjCContainerKind();
722 case tok::objc_required:
723 case tok::objc_optional:
726 if (contextKey != tok::objc_protocol)
727 Diag(AtLoc, diag::err_objc_directive_only_in_protocol);
729 MethodImplKind = DirectiveKind;
732 case tok::objc_property:
734 Diag(AtLoc, diag::err_objc_properties_require_objc2);
739 if (Tok.is(tok::l_paren)) {
741 ParseObjCPropertyAttribute(OCDS);
744 bool addedToDeclSpec =
false;
746 if (FD.D.getIdentifier() ==
nullptr) {
747 Diag(AtLoc, diag::err_objc_property_requires_field_name)
748 << FD.D.getSourceRange();
751 if (FD.BitfieldSize) {
752 Diag(AtLoc, diag::err_objc_property_bitfield)
753 << FD.D.getSourceRange();
776 FD.D.getIdentifier());
778 getCurScope(), AtLoc, LParenLoc, FD, OCDS, GetterSel, SetterSel,
781 FD.complete(Property);
786 ParseStructDeclaration(DS, ObjCPropertyCallback);
788 ExpectAndConsume(tok::semi, diag::err_expected_semi_decl_list);
795 if (Tok.
is(tok::code_completion)) {
797 return cutOffParsing();
801 Diag(Tok, diag::err_objc_missing_end)
803 Diag(CDecl->getLocStart(), diag::note_objc_container_start)
804 << (
int) Actions.getObjCContainerKind();
805 AtEnd.setBegin(Tok.getLocation());
806 AtEnd.setEnd(Tok.getLocation());
811 Actions.ActOnAtEnd(
getCurScope(), AtEnd, allMethods, allTUVariables);
819 if (DS.getNullability() == nullability) {
820 P.Diag(nullabilityLoc, diag::warn_nullability_duplicate)
826 P.Diag(nullabilityLoc, diag::err_nullability_conflicting)
857 void Parser::ParseObjCPropertyAttribute(
ObjCDeclSpec &DS) {
858 assert(Tok.
getKind() == tok::l_paren);
863 if (Tok.
is(tok::code_completion)) {
865 return cutOffParsing();
877 if (II->
isStr(
"readonly"))
879 else if (II->
isStr(
"assign"))
881 else if (II->
isStr(
"unsafe_unretained"))
883 else if (II->
isStr(
"readwrite"))
885 else if (II->
isStr(
"retain"))
887 else if (II->
isStr(
"strong"))
889 else if (II->
isStr(
"copy"))
891 else if (II->
isStr(
"nonatomic"))
893 else if (II->
isStr(
"atomic"))
895 else if (II->
isStr(
"weak"))
897 else if (II->
isStr(
"getter") || II->
isStr(
"setter")) {
901 unsigned DiagID = IsSetter ? diag::err_objc_expected_equal_for_setter :
902 diag::err_objc_expected_equal_for_getter;
904 if (ExpectAndConsume(tok::equal, DiagID)) {
909 if (Tok.
is(tok::code_completion)) {
914 return cutOffParsing();
921 Diag(Tok, diag::err_objc_expected_selector_for_getter_setter)
931 if (ExpectAndConsume(tok::colon,
932 diag::err_expected_colon_after_setter_name)) {
940 }
else if (II->
isStr(
"nonnull")) {
947 }
else if (II->
isStr(
"nullable")) {
954 }
else if (II->
isStr(
"null_unspecified")) {
961 }
else if (II->
isStr(
"null_resettable")) {
971 }
else if (II->
isStr(
"class")) {
974 Diag(AttrName, diag::err_objc_expected_property_attr) << II;
979 if (Tok.
isNot(tok::comma))
999 bool MethodDefinition) {
1000 assert(Tok.
isOneOf(tok::minus, tok::plus) &&
"expected +/-");
1004 Decl *MDecl = ParseObjCMethodDecl(mLoc, methodType, MethodImplKind,
1030 case tok::exclaimequal:
1032 case tok::pipeequal:
1034 case tok::caretequal: {
1045 case tok::identifier:
1055 case tok::kw_const_cast:
1056 case tok::kw_continue:
1057 case tok::kw_default:
1058 case tok::kw_delete:
1060 case tok::kw_double:
1061 case tok::kw_dynamic_cast:
1064 case tok::kw_explicit:
1065 case tok::kw_export:
1066 case tok::kw_extern:
1070 case tok::kw_friend:
1073 case tok::kw_inline:
1076 case tok::kw_mutable:
1077 case tok::kw_namespace:
1079 case tok::kw_operator:
1080 case tok::kw_private:
1081 case tok::kw_protected:
1082 case tok::kw_public:
1083 case tok::kw_register:
1084 case tok::kw_reinterpret_cast:
1085 case tok::kw_restrict:
1086 case tok::kw_return:
1088 case tok::kw_signed:
1089 case tok::kw_sizeof:
1090 case tok::kw_static:
1091 case tok::kw_static_cast:
1092 case tok::kw_struct:
1093 case tok::kw_switch:
1094 case tok::kw_template:
1099 case tok::kw_typedef:
1100 case tok::kw_typeid:
1101 case tok::kw_typename:
1102 case tok::kw_typeof:
1104 case tok::kw_unsigned:
1106 case tok::kw_virtual:
1108 case tok::kw_volatile:
1109 case tok::kw_wchar_t:
1112 case tok::kw__Complex:
1113 case tok::kw___alignof:
1114 case tok::kw___auto_type:
1123 bool Parser::isTokIdentifier_in()
const {
1150 void Parser::ParseObjCTypeQualifierList(
ObjCDeclSpec &DS,
1156 if (Tok.
is(tok::code_completion)) {
1159 return cutOffParsing();
1162 if (Tok.
isNot(tok::identifier))
1166 for (
unsigned i = 0; i != objc_NumQuals; ++i) {
1167 if (II != ObjCTypeQuals[i] ||
1175 default: llvm_unreachable(
"Unknown decl qualifier");
1193 case objc_null_unspecified:
1257 assert((paramAttrs !=
nullptr) ==
1260 assert(Tok.
is(tok::l_paren) &&
"expected (");
1269 ParseObjCTypeQualifierList(DS, context);
1272 if (isTypeSpecifierQualifier() || isObjCInstancetype()) {
1275 declSpec.setObjCQualifiers(&DS);
1276 DeclSpecContext dsContext = DSC_normal;
1278 dsContext = DSC_objc_method_result;
1279 ParseSpecifierQualifierList(declSpec,
AS_none, dsContext);
1281 ParseDeclarator(declarator);
1284 if (!declarator.isInvalidType()) {
1286 bool addedToDeclSpec =
false;
1304 if (Tok.
is(tok::r_paren))
1308 Diag(Tok, diag::err_expected_type);
1349 bool MethodDefinition) {
1352 if (Tok.
is(tok::code_completion)) {
1362 if (Tok.
is(tok::l_paren))
1369 MaybeParseGNUAttributes(methodAttrs);
1371 if (Tok.
is(tok::code_completion)) {
1383 if (!SelIdent && Tok.
isNot(tok::colon)) {
1384 Diag(Tok, diag::err_expected_selector_for_method)
1392 if (Tok.
isNot(tok::colon)) {
1395 MaybeParseGNUAttributes(methodAttrs);
1400 mType, DSRet, ReturnType,
1401 selLoc, Sel,
nullptr,
1402 CParamInfo.data(), CParamInfo.size(),
1403 methodAttrs.getList(), MethodImplKind,
1404 false, MethodDefinition);
1405 PD.complete(Result);
1421 if (ExpectAndConsume(tok::colon))
1424 ArgInfo.
Type =
nullptr;
1425 if (Tok.
is(tok::l_paren))
1434 MaybeParseGNUAttributes(paramAttrs);
1439 if (Tok.
is(tok::code_completion)) {
1440 KeyIdents.push_back(SelIdent);
1442 mType == tok::minus,
1444 ReturnType, KeyIdents);
1449 if (Tok.
isNot(tok::identifier)) {
1450 Diag(Tok, diag::err_expected)
1459 ArgInfos.push_back(ArgInfo);
1460 KeyIdents.push_back(SelIdent);
1461 KeyLocs.push_back(selLoc);
1464 allParamAttrs.takeAllFrom(paramAttrs.
getPool());
1467 if (Tok.
is(tok::code_completion)) {
1469 mType == tok::minus,
1471 ReturnType, KeyIdents);
1477 SelIdent = ParseObjCSelectorPiece(selLoc);
1478 if (!SelIdent && Tok.
isNot(tok::colon))
1483 Diag(ArgInfo.
NameLoc, diag::warn_missing_selector_name) << ArgInfo.
Name;
1484 Diag(ArgInfo.
NameLoc, diag::note_missing_selector_name) << ArgInfo.
Name;
1485 Diag(ColonLoc, diag::note_force_empty_selector_name) << ArgInfo.
Name;
1491 bool isVariadic =
false;
1492 bool cStyleParamWarned =
false;
1494 while (Tok.
is(tok::comma)) {
1496 if (Tok.
is(tok::ellipsis)) {
1501 if (!cStyleParamWarned) {
1502 Diag(Tok, diag::warn_cstyle_param);
1503 cStyleParamWarned =
true;
1506 ParseDeclarationSpecifiers(DS);
1509 ParseDeclarator(ParmDecl);
1513 ParmDecl.getIdentifierLoc(),
1521 MaybeParseGNUAttributes(methodAttrs);
1523 if (KeyIdents.size() == 0)
1530 mType, DSRet, ReturnType,
1531 KeyLocs, Sel, &ArgInfos[0],
1532 CParamInfo.data(), CParamInfo.size(),
1533 methodAttrs.getList(),
1534 MethodImplKind, isVariadic, MethodDefinition);
1536 PD.complete(Result);
1546 bool WarnOnDeclarations,
bool ForObjCContainer,
1548 bool consumeLastToken) {
1549 assert(Tok.
is(tok::less) &&
"expected <");
1556 if (Tok.
is(tok::code_completion)) {
1562 if (Tok.
isNot(tok::identifier)) {
1563 Diag(Tok, diag::err_expected) << tok::identifier;
1577 if (ParseGreaterThanInTemplateList(EndLoc, consumeLastToken,
1583 ProtocolIdents, Protocols);
1588 assert(Tok.
is(tok::less) &&
"Protocol qualifiers start with '<'");
1589 assert(
getLangOpts().ObjC1 &&
"Protocol qualifiers only exist in Objective-C");
1594 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
false,
false,
1595 lAngleLoc, rAngleLoc,
1602 Diag(lAngleLoc, diag::warn_objc_protocol_qualifier_missing_id)
1615 void Parser::parseObjCTypeArgsOrProtocolQualifiers(
1624 bool consumeLastToken,
1625 bool warnOnIncompleteProtocols) {
1626 assert(Tok.
is(tok::less) &&
"Not at the start of type args or protocols");
1631 bool allSingleIdentifiers =
true;
1639 if (Tok.
is(tok::identifier) &&
1648 if (Tok.
is(tok::code_completion)) {
1651 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1653 identifierLocs[i]));
1666 allSingleIdentifiers =
false;
1672 if (allSingleIdentifiers) {
1675 (void)ParseGreaterThanInTemplateList(rAngleLoc, consumeLastToken,
1691 warnOnIncompleteProtocols);
1701 bool invalid =
false;
1702 IdentifierInfo *foundProtocolId =
nullptr, *foundValidTypeId =
nullptr;
1707 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1712 const char *prevSpec =
nullptr;
1714 DS.SetTypeSpecType(
TST_typename, identifierLocs[i], prevSpec, diagID,
1721 typeArgs.push_back(fullTypeArg.
get());
1722 if (!foundValidTypeId) {
1723 foundValidTypeId = identifiers[i];
1724 foundValidTypeSrcLoc = identifierLocs[i];
1728 unknownTypeArgs.push_back(identifiers[i]);
1729 unknownTypeArgsLoc.push_back(identifierLocs[i]);
1733 if (!Actions.
LookupProtocol(identifiers[i], identifierLocs[i])) {
1734 unknownTypeArgs.push_back(identifiers[i]);
1735 unknownTypeArgsLoc.push_back(identifierLocs[i]);
1736 }
else if (!foundProtocolId) {
1737 foundProtocolId = identifiers[i];
1738 foundProtocolSrcLoc = identifierLocs[i];
1745 Token CurTypeTok = Tok;
1756 typeArgs.push_back(typeArg.
get());
1757 if (!foundValidTypeId) {
1767 if (foundProtocolId && foundValidTypeId)
1770 foundValidTypeSrcLoc);
1774 if (unknownTypeArgs.size())
1775 for (
unsigned i = 0, e = unknownTypeArgsLoc.size(); i < e; ++i)
1781 (void)ParseGreaterThanInTemplateList(rAngleLoc, consumeLastToken,
1790 typeArgsLAngleLoc = lAngleLoc;
1791 typeArgsRAngleLoc = rAngleLoc;
1794 void Parser::parseObjCTypeArgsAndProtocolQualifiers(
1803 bool consumeLastToken) {
1804 assert(Tok.
is(tok::less));
1807 parseObjCTypeArgsOrProtocolQualifiers(baseType,
1821 if ((consumeLastToken && Tok.
is(tok::less)) ||
1822 (!consumeLastToken &&
NextToken().
is(tok::less))) {
1825 if (!consumeLastToken)
1828 if (!protocols.empty()) {
1830 if (!consumeLastToken)
1832 Diag(Tok, diag::err_objc_type_args_after_protocols)
1833 <<
SourceRange(protocolLAngleLoc, protocolRAngleLoc);
1834 SkipUntil(tok::greater, tok::greatergreater, skipFlags);
1836 ParseObjCProtocolReferences(protocols, protocolLocs,
1839 protocolLAngleLoc, protocolRAngleLoc,
1845 TypeResult Parser::parseObjCTypeArgsAndProtocolQualifiers(
1848 bool consumeLastToken,
1850 assert(Tok.
is(tok::less));
1860 parseObjCTypeArgsAndProtocolQualifiers(type, typeArgsLAngleLoc, typeArgs,
1861 typeArgsRAngleLoc, protocolLAngleLoc,
1862 protocols, protocolLocs,
1863 protocolRAngleLoc, consumeLastToken);
1866 if (consumeLastToken)
1867 endLoc = PrevTokLocation;
1884 void Parser::HelperActionsForIvarDeclarations(Decl *interfaceDecl,
SourceLocation atLoc,
1887 bool RBraceMissing) {
1921 void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl,
1924 assert(Tok.
is(tok::l_brace) &&
"expected {");
1933 while (Tok.
isNot(tok::r_brace) && !isEofOrEom()) {
1937 if (Tok.
is(tok::semi)) {
1938 ConsumeExtraSemi(InstanceVariableList);
1944 if (Tok.
is(tok::code_completion)) {
1946 return cutOffParsing();
1950 case tok::objc_private:
1951 case tok::objc_public:
1952 case tok::objc_protected:
1953 case tok::objc_package:
1959 Diag(Tok, diag::err_objc_unexpected_atend);
1964 HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
1965 T, AllIvarDecls,
true);
1969 Diag(Tok, diag::err_objc_illegal_visibility_spec);
1974 if (Tok.
is(tok::code_completion)) {
1977 return cutOffParsing();
1983 FD.D.setObjCIvar(
true);
1985 getCurScope(), FD.D.getDeclSpec().getSourceRange().getBegin(), FD.D,
1986 FD.BitfieldSize, visibility);
1989 AllIvarDecls.push_back(Field);
1995 ParseStructDeclaration(DS, ObjCIvarCallback);
1997 if (Tok.
is(tok::semi)) {
2000 Diag(Tok, diag::err_expected_semi_decl_list);
2005 HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
2006 T, AllIvarDecls,
false);
2029 "ParseObjCAtProtocolDeclaration(): Expected @protocol");
2032 if (Tok.
is(tok::code_completion)) {
2038 MaybeSkipAttributes(tok::objc_protocol);
2040 if (Tok.
isNot(tok::identifier)) {
2041 Diag(Tok, diag::err_expected) << tok::identifier;
2054 CheckNestedObjCContexts(AtLoc);
2056 if (Tok.
is(tok::comma)) {
2058 ProtocolRefs.push_back(std::make_pair(protocolName, nameLoc));
2063 if (Tok.
isNot(tok::identifier)) {
2064 Diag(Tok, diag::err_expected) << tok::identifier;
2072 if (Tok.
isNot(tok::comma))
2076 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
"@protocol"))
2088 if (Tok.
is(tok::less) &&
2089 ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs,
false,
true,
2090 LAngleLoc, EndProtoLoc,
2096 ProtocolRefs.data(),
2097 ProtocolRefs.size(),
2098 ProtocolLocs.data(),
2099 EndProtoLoc, attrs.
getList());
2101 ParseObjCInterfaceDeclList(tok::objc_protocol, ProtoType);
2116 Parser::ParseObjCAtImplementationDeclaration(
SourceLocation AtLoc) {
2118 "ParseObjCAtImplementationDeclaration(): Expected @implementation");
2119 CheckNestedObjCContexts(AtLoc);
2123 if (Tok.
is(tok::code_completion)) {
2129 MaybeSkipAttributes(tok::objc_implementation);
2131 if (Tok.
isNot(tok::identifier)) {
2132 Diag(Tok, diag::err_expected)
2139 Decl *ObjCImpDecl =
nullptr;
2143 if (Tok.
is(tok::less)) {
2147 ObjCTypeParamListScope typeParamScope(Actions,
getCurScope());
2148 if (parseObjCTypeParamListOrProtocolRefs(typeParamScope, lAngleLoc,
2149 protocolIdents, rAngleLoc)) {
2150 Diag(diagLoc, diag::err_objc_parameterized_implementation)
2152 }
else if (lAngleLoc.
isValid()) {
2153 Diag(lAngleLoc, diag::err_unexpected_protocol_qualifier)
2158 if (Tok.
is(tok::l_paren)) {
2164 if (Tok.
is(tok::code_completion)) {
2170 if (Tok.
is(tok::identifier)) {
2174 Diag(Tok, diag::err_expected)
2178 if (Tok.
isNot(tok::r_paren)) {
2179 Diag(Tok, diag::err_expected) << tok::r_paren;
2183 rparenLoc = ConsumeParen();
2184 if (Tok.
is(tok::less)) {
2185 Diag(Tok, diag::err_unexpected_protocol_qualifier);
2189 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
2192 protocolLAngleLoc, protocolRAngleLoc,
2196 AtLoc, nameId, nameLoc, categoryId,
2205 if (Tok.
isNot(tok::identifier)) {
2206 Diag(Tok, diag::err_expected)
2214 AtLoc, nameId, nameLoc,
2215 superClassId, superClassLoc);
2217 if (Tok.
is(tok::l_brace))
2218 ParseObjCClassInstanceVariables(ObjCImpDecl, tok::objc_private, AtLoc);
2219 else if (Tok.
is(tok::less)) {
2220 Diag(Tok, diag::err_unexpected_protocol_qualifier);
2225 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
2228 protocolLAngleLoc, protocolRAngleLoc,
2232 assert(ObjCImpDecl);
2237 ObjCImplParsingDataRAII ObjCImplParsing(*
this, ObjCImpDecl);
2238 while (!ObjCImplParsing.isFinished() && !isEofOrEom()) {
2239 ParsedAttributesWithRange attrs(AttrFactory);
2240 MaybeParseCXX11Attributes(attrs);
2241 MaybeParseMicrosoftAttributes(attrs);
2244 DeclsInGroup.append(DG.
begin(), DG.
end());
2253 Parser::ParseObjCAtEndDeclaration(
SourceRange atEnd) {
2255 "ParseObjCAtEndDeclaration(): Expected @end");
2257 if (CurParsedObjCImpl)
2258 CurParsedObjCImpl->finish(atEnd);
2261 Diag(atEnd.
getBegin(), diag::err_expected_objc_container);
2265 Parser::ObjCImplParsingDataRAII::~ObjCImplParsingDataRAII() {
2267 finish(
P.Tok.getLocation());
2268 if (
P.isEofOrEom()) {
2269 P.Diag(
P.Tok, diag::err_objc_missing_end)
2271 P.Diag(Dcl->getLocStart(), diag::note_objc_container_start)
2275 P.CurParsedObjCImpl =
nullptr;
2276 assert(LateParsedObjCMethods.empty());
2279 void Parser::ObjCImplParsingDataRAII::finish(
SourceRange AtEnd) {
2281 P.Actions.DefaultSynthesizeProperties(
P.getCurScope(), Dcl);
2282 for (
size_t i = 0; i < LateParsedObjCMethods.size(); ++i)
2283 P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
2286 P.Actions.ActOnAtEnd(
P.getCurScope(), AtEnd);
2289 for (
size_t i = 0; i < LateParsedObjCMethods.size(); ++i)
2290 P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
2295 I = LateParsedObjCMethods.begin(),
2296 E = LateParsedObjCMethods.end();
I !=
E; ++
I)
2298 LateParsedObjCMethods.clear();
2306 Decl *Parser::ParseObjCAtAliasDeclaration(
SourceLocation atLoc) {
2308 "ParseObjCAtAliasDeclaration(): Expected @compatibility_alias");
2310 if (Tok.
isNot(tok::identifier)) {
2311 Diag(Tok, diag::err_expected) << tok::identifier;
2316 if (Tok.
isNot(tok::identifier)) {
2317 Diag(Tok, diag::err_expected) << tok::identifier;
2322 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@compatibility_alias");
2338 Decl *Parser::ParseObjCPropertySynthesize(
SourceLocation atLoc) {
2340 "ParseObjCPropertySynthesize(): Expected '@synthesize'");
2344 if (Tok.
is(tok::code_completion)) {
2350 if (Tok.
isNot(tok::identifier)) {
2351 Diag(Tok, diag::err_synthesized_property_name);
2362 if (Tok.
is(tok::code_completion)) {
2368 if (Tok.
isNot(tok::identifier)) {
2369 Diag(Tok, diag::err_expected) << tok::identifier;
2377 propertyId, propertyIvar, propertyIvarLoc,
2379 if (Tok.
isNot(tok::comma))
2383 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@synthesize");
2396 "ParseObjCPropertyDynamic(): Expected '@dynamic'");
2399 bool isClassProperty =
false;
2400 if (Tok.
is(tok::l_paren)) {
2405 Diag(Tok, diag::err_objc_expected_property_attr) << II;
2409 if (II->
isStr(
"class")) {
2410 isClassProperty =
true;
2411 if (Tok.
isNot(tok::r_paren)) {
2412 Diag(Tok, diag::err_expected) << tok::r_paren;
2417 Diag(AttrName, diag::err_objc_expected_property_attr) << II;
2424 if (Tok.
is(tok::code_completion)) {
2430 if (Tok.
isNot(tok::identifier)) {
2431 Diag(Tok, diag::err_expected) << tok::identifier;
2444 if (Tok.
isNot(tok::comma))
2448 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@dynamic");
2458 if (Tok.
isNot(tok::semi)) {
2466 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@throw");
2476 if (Tok.
isNot(tok::l_paren)) {
2477 Diag(Tok, diag::err_expected_lparen_after) <<
"@synchronized";
2485 if (Tok.
is(tok::r_paren)) {
2488 if (!operand.isInvalid())
2489 Diag(Tok, diag::err_expected) << tok::r_paren;
2496 if (Tok.
isNot(tok::l_brace)) {
2497 if (!operand.isInvalid())
2498 Diag(Tok, diag::err_expected) << tok::l_brace;
2503 if (!operand.isInvalid())
2508 StmtResult body(ParseCompoundStatementBody());
2513 if (operand.isInvalid())
2516 if (body.isInvalid())
2534 bool catch_or_finally_seen =
false;
2537 if (Tok.
isNot(tok::l_brace)) {
2538 Diag(Tok, diag::err_expected) << tok::l_brace;
2541 StmtVector CatchStmts;
2544 StmtResult TryBody(ParseCompoundStatementBody());
2546 if (TryBody.isInvalid())
2549 while (Tok.
is(tok::at)) {
2553 Token AfterAt = GetLookAheadToken(1);
2560 Decl *FirstPart =
nullptr;
2562 if (Tok.
is(tok::l_paren)) {
2565 if (Tok.
isNot(tok::ellipsis)) {
2567 ParseDeclarationSpecifiers(DS);
2569 ParseDeclarator(ParmDecl);
2579 if (Tok.
is(tok::r_paren))
2580 RParenLoc = ConsumeParen();
2585 if (Tok.
is(tok::l_brace))
2586 CatchBody = ParseCompoundStatementBody();
2588 Diag(Tok, diag::err_expected) << tok::l_brace;
2589 if (CatchBody.isInvalid())
2596 if (!Catch.isInvalid())
2597 CatchStmts.push_back(Catch.get());
2600 Diag(AtCatchFinallyLoc, diag::err_expected_lparen_after)
2604 catch_or_finally_seen =
true;
2606 assert(Tok.
isObjCAtKeyword(tok::objc_finally) &&
"Lookahead confused?");
2611 if (Tok.
is(tok::l_brace))
2612 FinallyBody = ParseCompoundStatementBody();
2614 Diag(Tok, diag::err_expected) << tok::l_brace;
2615 if (FinallyBody.isInvalid())
2619 catch_or_finally_seen =
true;
2623 if (!catch_or_finally_seen) {
2624 Diag(atLoc, diag::err_missing_catch_finally);
2639 if (Tok.
isNot(tok::l_brace)) {
2640 Diag(Tok, diag::err_expected) << tok::l_brace;
2647 StmtResult AutoreleasePoolBody(ParseCompoundStatementBody());
2650 if (AutoreleasePoolBody.isInvalid())
2653 AutoreleasePoolBody.get());
2658 void Parser::StashAwayMethodOrFunctionBodyTokens(Decl *MDecl) {
2660 trySkippingFunctionBody()) {
2665 LexedMethod* LM =
new LexedMethod(
this, MDecl);
2666 CurParsedObjCImpl->LateParsedObjCMethods.push_back(LM);
2669 Toks.push_back(Tok);
2670 if (Tok.
is(tok::kw_try)) {
2672 if (Tok.
is(tok::colon)) {
2673 Toks.push_back(Tok);
2675 while (Tok.
isNot(tok::l_brace)) {
2676 ConsumeAndStoreUntil(tok::l_paren, Toks,
false);
2677 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
2680 Toks.push_back(Tok);
2682 else if (Tok.
is(tok::colon)) {
2685 while (Tok.
isNot(tok::l_brace)) {
2686 ConsumeAndStoreUntil(tok::l_paren, Toks,
false);
2687 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
2689 Toks.push_back(Tok);
2693 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
2694 while (Tok.
is(tok::kw_catch)) {
2695 ConsumeAndStoreUntil(tok::l_brace, Toks,
false);
2696 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
2702 Decl *Parser::ParseObjCMethodDefinition() {
2703 Decl *MDecl = ParseObjCMethodPrototype();
2706 "parsing Objective-C method");
2709 if (Tok.
is(tok::semi)) {
2710 if (CurParsedObjCImpl) {
2711 Diag(Tok, diag::warn_semicolon_before_method_body)
2718 if (Tok.
isNot(tok::l_brace)) {
2719 Diag(Tok, diag::err_expected_method_body);
2725 if (Tok.
isNot(tok::l_brace))
2737 assert (CurParsedObjCImpl
2738 &&
"ParseObjCMethodDefinition - Method out of @implementation");
2740 StashAwayMethodOrFunctionBodyTokens(MDecl);
2745 if (Tok.
is(tok::code_completion)) {
2752 return ParseObjCTryStmt(AtLoc);
2755 return ParseObjCThrowStmt(AtLoc);
2758 return ParseObjCSynchronizedStmt(AtLoc);
2761 return ParseObjCAutoreleasePoolStmt(AtLoc);
2769 ExprResult Res(ParseExpressionWithLeadingAt(AtLoc));
2779 ExpectAndConsumeSemi(diag::err_expected_semi_after_expr);
2785 case tok::code_completion:
2795 if (!Tok.
is(tok::numeric_constant)) {
2796 const char *Symbol =
nullptr;
2798 case tok::minus: Symbol =
"-";
break;
2799 case tok::plus: Symbol =
"+";
break;
2800 default: llvm_unreachable(
"missing unary operator case");
2802 Diag(Tok, diag::err_nsnumber_nonliteral_unary)
2808 if (Lit.isInvalid()) {
2814 if (Lit.isInvalid())
2817 return ParsePostfixExpressionSuffix(
2821 case tok::string_literal:
2822 case tok::wide_string_literal:
2823 return ParsePostfixExpressionSuffix(ParseObjCStringLiteral(AtLoc));
2825 case tok::char_constant:
2826 return ParsePostfixExpressionSuffix(ParseObjCCharacterLiteral(AtLoc));
2828 case tok::numeric_constant:
2829 return ParsePostfixExpressionSuffix(ParseObjCNumericLiteral(AtLoc));
2832 case tok::kw___objc_yes:
2833 return ParsePostfixExpressionSuffix(ParseObjCBooleanLiteral(AtLoc,
true));
2835 case tok::kw___objc_no:
2836 return ParsePostfixExpressionSuffix(ParseObjCBooleanLiteral(AtLoc,
false));
2840 return ParsePostfixExpressionSuffix(ParseObjCArrayLiteral(AtLoc));
2844 return ParsePostfixExpressionSuffix(ParseObjCDictionaryLiteral(AtLoc));
2848 return ParsePostfixExpressionSuffix(ParseObjCBoxedExpr(AtLoc));
2855 case tok::objc_encode:
2856 return ParsePostfixExpressionSuffix(ParseObjCEncodeExpression(AtLoc));
2857 case tok::objc_protocol:
2858 return ParsePostfixExpressionSuffix(ParseObjCProtocolExpression(AtLoc));
2859 case tok::objc_selector:
2860 return ParsePostfixExpressionSuffix(ParseObjCSelectorExpression(AtLoc));
2861 case tok::objc_available:
2862 return ParseAvailabilityCheckExpr(AtLoc);
2864 const char *str =
nullptr;
2865 if (GetLookAheadToken(1).is(tok::l_brace)) {
2869 : (ch ==
'f' ?
"finally"
2870 : (ch ==
'a' ?
"autoreleasepool" :
nullptr));
2906 bool Parser::ParseObjCXXMessageReceiver(
bool &IsExpr,
void *&TypeOrExpr) {
2909 if (Tok.
isOneOf(tok::identifier, tok::coloncolon, tok::kw_typename,
2910 tok::annot_cxxscope))
2924 TypeOrExpr = Receiver.
get();
2933 ParseCXXSimpleTypeSpecifier(DS);
2935 if (Tok.
is(tok::l_paren)) {
2948 ExprResult Receiver = ParseCXXTypeConstructExpression(DS);
2950 Receiver = ParsePostfixExpressionSuffix(Receiver.
get());
2952 Receiver = ParseRHSOfBinaryExpression(Receiver.
get(),
prec::Comma);
2957 TypeOrExpr = Receiver.
get();
2970 TypeOrExpr = Type.
get().getAsOpaquePtr();
2979 bool Parser::isSimpleObjCMessageExpression() {
2981 "Incorrect start for isSimpleObjCMessageExpression");
2982 return GetLookAheadToken(1).
is(tok::identifier) &&
2983 GetLookAheadToken(2).
is(tok::identifier);
2986 bool Parser::isStartOfObjCClassMessageMissingOpenBracket() {
2988 InMessageExpression)
2993 if (Tok.
is(tok::annot_typename))
2995 else if (Tok.
is(tok::identifier))
3001 if (!Type.
get().isNull() && Type.
get()->isObjCObjectOrInterfaceType()) {
3002 const Token &AfterNext = GetLookAheadToken(2);
3003 if (AfterNext.
isOneOf(tok::colon, tok::r_square)) {
3004 if (Tok.
is(tok::identifier))
3007 return Tok.
is(tok::annot_typename);
3023 ExprResult Parser::ParseObjCMessageExpression() {
3024 assert(Tok.
is(tok::l_square) &&
"'[' expected");
3027 if (Tok.
is(tok::code_completion)) {
3044 return ParseObjCMessageExpressionBody(LBracLoc,
ConsumeToken(),
nullptr,
3049 void *TypeOrExpr =
nullptr;
3050 if (ParseObjCXXMessageReceiver(IsExpr, TypeOrExpr)) {
3056 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
nullptr,
3057 static_cast<Expr *>(TypeOrExpr));
3059 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
3064 if (Tok.
is(tok::identifier)) {
3069 Name == Ident_super,
3073 return ParseObjCMessageExpressionBody(LBracLoc,
ConsumeToken(),
nullptr,
3077 if (!ReceiverType) {
3085 if (Tok.
is(tok::less)) {
3088 = parseObjCTypeArgsAndProtocolQualifiers(NameLoc, ReceiverType,
3096 ReceiverType = NewReceiverType.
get();
3099 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
3100 ReceiverType,
nullptr);
3115 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
nullptr,
3161 Expr *ReceiverExpr) {
3164 if (Tok.
is(tok::code_completion)) {
3168 else if (ReceiverType)
3184 ExprVector KeyExprs;
3186 if (Tok.
is(tok::colon)) {
3189 KeyIdents.push_back(selIdent);
3190 KeyLocs.push_back(Loc);
3192 if (ExpectAndConsume(tok::colon)) {
3202 if (Tok.
is(tok::code_completion)) {
3207 else if (ReceiverType)
3222 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3223 Expr = ParseBraceInitializer();
3237 KeyExprs.push_back(Res.
get());
3240 if (Tok.
is(tok::code_completion)) {
3245 else if (ReceiverType)
3258 selIdent = ParseObjCSelectorPiece(Loc);
3259 if (!selIdent && Tok.
isNot(tok::colon))
3264 while (Tok.
is(tok::comma)) {
3268 if (Tok.
is(tok::colon))
3271 if (Tok.
is(tok::colon)) {
3272 Diag(commaLoc, diag::note_extra_comma_message_arg) <<
3283 KeyExprs.push_back(Res.
get());
3285 }
else if (!selIdent) {
3286 Diag(Tok, diag::err_expected) << tok::identifier;
3295 if (Tok.
isNot(tok::r_square)) {
3296 Diag(Tok, diag::err_expected)
3297 << (Tok.
is(tok::identifier) ? tok::colon : tok::r_square);
3307 unsigned nKeys = KeyIdents.size();
3309 KeyIdents.push_back(selIdent);
3310 KeyLocs.push_back(Loc);
3316 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3317 else if (ReceiverType)
3319 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3321 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3325 ExprResult Res(ParseStringLiteralExpression());
3332 ExprVector AtStrings;
3333 AtLocs.push_back(AtLoc);
3334 AtStrings.push_back(Res.
get());
3336 while (Tok.
is(tok::at)) {
3340 if (!isTokenStringLiteral())
3343 ExprResult Lit(ParseStringLiteralExpression());
3344 if (Lit.isInvalid())
3347 AtStrings.push_back(Lit.get());
3369 if (Lit.isInvalid()) {
3383 if (Lit.isInvalid()) {
3395 if (Tok.
isNot(tok::l_paren))
3396 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@");
3404 if (ValueExpr.isInvalid())
3410 ValueExpr = Actions.
ActOnParenExpr(LPLoc, RPLoc, ValueExpr.get());
3416 ExprVector ElementExprs;
3419 while (Tok.
isNot(tok::r_square)) {
3431 if (Tok.
is(tok::ellipsis))
3436 ElementExprs.push_back(Res.
get());
3438 if (Tok.
is(tok::comma))
3440 else if (Tok.
isNot(tok::r_square))
3441 return ExprError(
Diag(Tok, diag::err_expected_either) << tok::r_square
3452 while (Tok.
isNot(tok::r_brace)) {
3467 if (ExpectAndConsume(tok::colon)) {
3473 if (ValueExpr.isInvalid()) {
3489 KeyExpr.
get(), ValueExpr.get(), EllipsisLoc,
None
3491 Elements.push_back(Element);
3494 return ExprError(
Diag(Tok, diag::err_expected_either) << tok::r_brace
3508 assert(Tok.
isObjCAtKeyword(tok::objc_encode) &&
"Not an @encode expression!");
3512 if (Tok.
isNot(tok::l_paren))
3513 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@encode");
3535 if (Tok.
isNot(tok::l_paren))
3536 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@protocol");
3541 if (Tok.
isNot(tok::identifier))
3542 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
3559 if (Tok.
isNot(tok::l_paren))
3560 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@selector");
3567 bool HasOptionalParen = Tok.
is(tok::l_paren);
3568 if (HasOptionalParen)
3571 if (Tok.
is(tok::code_completion)) {
3579 Tok.
isNot(tok::colon) && Tok.
isNot(tok::coloncolon))
3580 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
3582 KeyIdents.push_back(SelIdent);
3584 unsigned nColons = 0;
3585 if (Tok.
isNot(tok::r_paren)) {
3589 KeyIdents.push_back(
nullptr);
3590 }
else if (ExpectAndConsume(tok::colon))
3594 if (Tok.
is(tok::r_paren))
3597 if (Tok.
is(tok::code_completion)) {
3605 SelIdent = ParseObjCSelectorPiece(Loc);
3606 KeyIdents.push_back(SelIdent);
3607 if (!SelIdent && Tok.
isNot(tok::colon) && Tok.
isNot(tok::coloncolon))
3611 if (HasOptionalParen && Tok.
is(tok::r_paren))
3621 void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM,
bool parseMethod) {
3623 Decl *MCDecl = LM.D;
3624 bool skip = MCDecl &&
3633 assert(!LM.Toks.empty() &&
"ParseLexedObjCMethodDef - Empty body!");
3636 LM.Toks.push_back(Tok);
3637 PP.EnterTokenStream(LM.Toks,
true);
3640 ConsumeAnyToken(
true);
3642 assert(Tok.
isOneOf(tok::l_brace, tok::kw_try, tok::colon) &&
3643 "Inline objective-c method not starting with '{' or 'try' or ':'");
3645 ParseScope BodyScope(
this,
3656 if (Tok.
is(tok::kw_try))
3657 ParseFunctionTryBlock(MCDecl, BodyScope);
3659 if (Tok.
is(tok::colon))
3660 ParseConstructorInitializer(MCDecl);
3663 ParseFunctionStatementBody(MCDecl, BodyScope);
SourceManager & getSourceManager() const
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, ArrayRef< IdentifierLocPair > ProtocolId, SmallVectorImpl< Decl * > &Protocols)
FindProtocolDeclaration - This routine looks up protocols and issues an error if they are not declare...
tok::ObjCKeywordKind getObjCKeywordID() const
Return the ObjC keyword kind.
SourceLocation getCloseLocation() const
Defines the clang::ASTContext interface.
void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, IdentifierInfo *PropertyName)
AttributeList * ArgAttrs
ArgAttrs - Attribute list for this argument.
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the underscored keyword (_Nonnull, _Nullable) that corresponds to the given nullability kind...
Smart pointer class that efficiently represents Objective-C method names.
SelectorTable & getSelectorTable()
ExprResult ParseExpression(TypeCastState isTypeCast=NotTypeCast)
Simple precedence-based parser for binary/ternary operators.
A (possibly-)qualified type.
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, tok::ObjCKeywordKind visibility)
ActOnIvar - Each ivar field of an objective-c class is passed into this in order to create an IvarDec...
This is a scope that corresponds to the parameters within a function prototype.
const AttributeList * getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
static void takeDeclAttributes(ParsedAttributes &attrs, AttributeList *list)
Take all the decl attributes out of the given list and add them to the given attribute set...
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
Class to handle popping type parameters when leaving the scope.
const LangOptions & getLangOpts() const
NullabilityKind
Describes the nullability of a particular type.
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
StmtResult ActOnExprStmt(ExprResult Arg)
void setPropertyAttributes(ObjCPropertyAttributeKind PRVal)
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
static LLVM_READONLY bool isLetter(unsigned char c)
Return true if this character is an ASCII letter: [a-zA-Z].
RAII object used to inform the actions that we're currently parsing a declaration.
Captures information about "declaration specifiers" specific to Objective-C.
AttributePool & getAttributePool() const
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, AttributeList *attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
The base class of the type hierarchy.
This indicates that the scope corresponds to a function, which means that labels are set here...
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
One instance of this struct is used for each type in a declarator that is parsed. ...
std::pair< IdentifierInfo *, SourceLocation > IdentifierLocPair
A simple pair of identifier info and location.
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
Wrapper for void* pointer.
Parser - This implements a parser for the C family of languages.
void CodeCompleteObjCMessageReceiver(Scope *S)
void CodeCompleteObjCPropertyGetter(Scope *S)
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc, ObjCPropertyQueryKind QueryKind)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
~ObjCTypeParamListScope()
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
void EnterToken(const Token &Tok)
Enters a token in the token stream to be lexed next.
Information about one declarator, including the parsed type information and the identifier.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
bool isUsedAsTypeAttr() const
void setBegin(SourceLocation b)
Code completion occurs within an Objective-C implementation or category implementation.
Decl * ActOnParamDeclarator(Scope *S, Declarator &D)
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
bool canSkipFunctionBody(Decl *D)
Determine whether we can skip parsing the body of a function definition, assuming we don't care about...
friend class ObjCDeclContextSwitch
ColonProtectionRAIIObject - This sets the Parser::ColonIsSacred bool and restores it when destroyed...
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 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 ...
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=None, ArrayRef< DeclGroupPtrTy > allTUVars=None)
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
const Token & NextToken()
NextToken - This peeks ahead one token and returns it without consuming it.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Computes the source location just past the end of the token at this source location.
bool TryConsumeToken(tok::TokenKind Expected)
The message is a class message, and the identifier is a type name.
One of these records is kept for each identifier that is lexed.
An element in an Objective-C dictionary literal.
void CodeCompleteObjCInterfaceDecl(Scope *S)
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
AttributeList * getList() const
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
void CodeCompleteObjCInterfaceCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
void CodeCompleteObjCProtocolReferences(ArrayRef< IdentifierLocPair > Protocols)
Token - This structure provides full information about a lexed token.
void setKind(tok::TokenKind K)
RAII class that helps handle the parsing of an open/close delimiter pair, such as braces { ...
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword...
Code completion occurs where only a type is permitted.
Values of this type can be null.
static Selector constructSetterSelector(IdentifierTable &Idents, SelectorTable &SelTable, const IdentifierInfo *Name)
Return the default setter selector for the given identifier.
Selector getNullarySelector(IdentifierInfo *ID)
void addAttributes(AttributeList *AL)
Concatenates two attribute lists.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
bool isObjCMethodDecl(Decl *D)
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression...
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS)
Whether values of this type can be null is (explicitly) unspecified.
Decl * ActOnObjCContainerStartDefinition(Decl *IDecl)
Values of this type can never be null.
void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
Scope - A scope is a transient data structure that is used while parsing the program.
const IdentifierInfo * getSetterName() const
Decl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, AttributeList *AttrList)
tok::TokenKind getKind() const
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
detail::InMemoryDirectory::const_iterator I
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool AllowClassTemplates=false)
void CodeCompleteObjCMethodDecl(Scope *S, bool IsInstanceMethod, ParsedType ReturnType)
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
Sema - This implements semantic analysis and AST building for C.
void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression)
ObjCPropertyAttributeKind getPropertyAttributes() const
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
TypeResult ParseTypeName(SourceRange *Range=nullptr, Declarator::TheContext Context=Declarator::TypeNameContext, AccessSpecifier AS=AS_none, Decl **OwnedType=nullptr, ParsedAttributes *Attrs=nullptr)
ParseTypeName type-name: [C99 6.7.6] specifier-qualifier-list abstract-declarator[opt].
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
Expr - This represents one expression.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
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, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type...
The message is an instance message.
void CodeCompleteObjCPropertyDefinition(Scope *S)
This file defines the classes used to store parsed information about declaration-specifiers and decla...
TypeResult ActOnTypeName(Scope *S, Declarator &D)
ObjCTypeParamListScope(Sema &Actions, Scope *S)
Code completion occurs within an Objective-C interface, protocol, or category.
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared, in the method definition's AST.
void CodeCompleteObjCAtVisibility(Scope *S)
void CodeCompleteObjCImplementationCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
void actOnObjCTypeArgsOrProtocolQualifiers(Scope *S, ParsedType baseType, SourceLocation lAngleLoc, ArrayRef< IdentifierInfo * > identifiers, ArrayRef< SourceLocation > identifierLocs, SourceLocation rAngleLoc, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl< ParsedType > &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl< Decl * > &protocols, SourceLocation &protocolRAngleLoc, bool warnOnIncompleteProtocols)
Given a list of identifiers (and their locations), resolve the names to either Objective-C protocol q...
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file. ...
A class for parsing a field declarator.
bool isNot(tok::TokenKind K) const
Decl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc)
static void diagnoseRedundantPropertyNullability(Parser &P, ObjCDeclSpec &DS, NullabilityKind nullability, SourceLocation nullabilityLoc)
Diagnose redundant or conflicting nullability information.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
The result type of a method or function.
Code completion occurs within the list of instance variables in an Objective-C interface, protocol, category, or implementation.
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
AttributeList * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ArgsUnion *args, unsigned numArgs, AttributeList::Syntax syntax, SourceLocation ellipsisLoc=SourceLocation())
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion...
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
SourceLocation getNullabilityLoc() const
RAII object that makes '>' behave either as an operator or as the closing angle bracket for a temp...
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
const clang::PrintingPolicy & getPrintingPolicy() const
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
void CodeCompleteObjCPropertySetter(Scope *S)
void CodeCompleteObjCAtExpression(Scope *S)
This is a scope that corresponds to the parameters within a function prototype for a function declara...
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
AttributePool & getAttributePool() const
Decl * ActOnSkippedFunctionBody(Decl *Decl)
A class for parsing a DeclSpec.
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
Context-sensitive version of a keyword attribute.
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super=nullptr)
void CodeCompleteObjCAtDirective(Scope *S)
Stop skipping at semicolon.
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
const TemplateArgument * iterator
void setLength(unsigned Len)
bool isValid() const
Return true if this is a valid SourceLocation object.
This is a scope that corresponds to the Objective-C @catch statement.
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
ASTContext & getASTContext() const
IdentifierTable & getIdentifierTable()
Scope * getCurScope() const
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, bool IsSuper=false)
bool isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const
Return true if we have an ObjC keyword identifier.
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
The message is sent to 'super'.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
bool acceptsObjCTypeParams() const
Determines if this is an ObjC interface type that may accept type parameters.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
SourceLocation getBegin() const
AttributeList *& getAttrListRef()
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 ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions...
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, AttributeList *AttrList)
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
SourceLocation getOpenLocation() const
The scope of a struct/union/class definition.
ObjCDeclQualifier getObjCDeclQualifier() const
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
ObjCContainerKind getObjCContainerKind() const
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Decl * ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, AttributeList *AttrList)
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
SkipUntilFlags
Control flags for SkipUntil functions.
void setObjCDeclQualifier(ObjCDeclQualifier DQVal)
detail::InMemoryDirectory::const_iterator E
bool isSimpleTypeSpecifier(tok::TokenKind Kind) const
Determine whether the token kind starts a simple-type-specifier.
void add(AttributeList *newAttr)
TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl * > protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)
Build a an Objective-C protocol-qualified 'id' type where no base type was specified.
bool isInObjcMethodScope() const
isInObjcMethodScope - Return true if this scope is, or is contained in, an Objective-C method body...
bool isOneOf(tok::TokenKind K1, tok::TokenKind K2) const
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
void setNullability(SourceLocation loc, NullabilityKind kind)
void CodeCompleteObjCSelector(Scope *S, ArrayRef< IdentifierInfo * > SelIdents)
void setSetterName(IdentifierInfo *name)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression...
void setNext(AttributeList *N)
tok::ObjCKeywordKind getObjCKeywordID() const
Return the Objective-C keyword ID for the this identifier.
ActionResult< Stmt * > StmtResult
void CodeCompleteObjCAtStatement(Scope *S)
ExprResult ParseAssignmentExpression(TypeCastState isTypeCast=NotTypeCast)
Parse an expr that doesn't include (top-level) commas.
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
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.
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
This is a scope that can contain a declaration.
static ParsedType getTypeAnnotation(Token &Tok)
getTypeAnnotation - Read a parsed type out of an annotation token.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
AttributePool & getPool() const
Captures information about "declaration specifiers".
void setEnd(SourceLocation e)
SourceLocation ConsumeToken()
ConsumeToken - Consume the current 'peek token' and lex the next one.
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< IdentifierInfo * > SelIdents)
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, 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...
bool TryAnnotateTypeOrScopeToken(bool EnteringContext=false, bool NeedType=false)
TryAnnotateTypeOrScopeToken - If the current token position is on a typename (possibly qualified in C...
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
void setGetterName(IdentifierInfo *name)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
void ActOnObjCContainerFinishDefinition()
void CodeCompleteObjCImplementationDecl(Scope *S)
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed...
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
void setLocation(SourceLocation L)
AttributeList * getNext() const
static void addContextSensitiveTypeNullability(Parser &P, Declarator &D, NullabilityKind nullability, SourceLocation nullabilityLoc, bool &addedToDeclSpec)
Add an attribute for a context-sensitive type nullability to the given declarator.
A trivial tuple used to represent a source range.
NullabilityKind getNullability() const
Decl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
void enter(ObjCTypeParamList *P)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
Decl * getObjCDeclContext() const
const IdentifierInfo * getGetterName() const
static OpaquePtr getFromOpaquePtr(void *P)
ParsedAttributes - A collection of parsed attributes.
SourceLocation ColonLoc
Location of ':'.
This scope corresponds to an Objective-C method body.
The parameter is invariant: must match exactly.
void CodeCompleteObjCProtocolDecl(Scope *S)
Decl * ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc, IdentifierInfo *AliasName, SourceLocation AliasLocation, IdentifierInfo *ClassName, SourceLocation ClassLocation)
ActOnCompatibilityAlias - this action is called after complete parsing of a @compatibility_alias decl...
ParsedAttributes & getAttributes()
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
AttributeList - Represents a syntactic attribute.
Decl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc)
Stop skipping at specified token, but don't skip the token itself.
IdentifierInfo * getIdentifierInfo() const
const AttributeList * getAttributes() const