22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringExtras.h"
24 using namespace clang;
29 if (Tok.
is(tok::kw___attribute)) {
30 if (Kind == tok::objc_interface || Kind == tok::objc_protocol)
31 Diag(Tok, diag::err_objc_postfix_attribute_hint)
32 << (Kind == tok::objc_protocol);
34 Diag(Tok, diag::err_objc_postfix_attribute);
35 ParseGNUAttributes(attrs);
50 if (Tok.
is(tok::code_completion)) {
56 Decl *SingleDecl =
nullptr;
59 return ParseObjCAtClassDeclaration(AtLoc);
60 case tok::objc_interface: {
62 SingleDecl = ParseObjCAtInterfaceDeclaration(AtLoc, attrs);
65 case tok::objc_protocol: {
67 return ParseObjCAtProtocolDeclaration(AtLoc, attrs);
69 case tok::objc_implementation:
70 return ParseObjCAtImplementationDeclaration(AtLoc);
72 return ParseObjCAtEndDeclaration(AtLoc);
73 case tok::objc_compatibility_alias:
74 SingleDecl = ParseObjCAtAliasDeclaration(AtLoc);
76 case tok::objc_synthesize:
77 SingleDecl = ParseObjCPropertySynthesize(AtLoc);
79 case tok::objc_dynamic:
80 SingleDecl = ParseObjCPropertyDynamic(AtLoc);
82 case tok::objc_import:
84 return ParseModuleImport(AtLoc);
85 Diag(AtLoc, diag::err_atimport);
89 Diag(AtLoc, diag::err_unexpected_at);
104 : Actions(Actions), S(S), Params(nullptr) {}
114 Actions.popObjCTypeParamList(
S, Params);
134 MaybeSkipAttributes(tok::objc_class);
135 if (Tok.
isNot(tok::identifier)) {
136 Diag(Tok, diag::err_expected) << tok::identifier;
146 if (Tok.
is(tok::less))
147 TypeParams = parseObjCTypeParamList();
148 ClassTypeParams.push_back(TypeParams);
154 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
"@class"))
170 if (CurParsedObjCImpl) {
171 CurParsedObjCImpl->finish(AtLoc);
175 Diag(AtLoc, diag::err_objc_missing_end)
214 "ParseObjCAtInterfaceDeclaration(): Expected @interface");
215 CheckNestedObjCContexts(AtLoc);
219 if (Tok.
is(tok::code_completion)) {
225 MaybeSkipAttributes(tok::objc_interface);
227 if (Tok.
isNot(tok::identifier)) {
228 Diag(Tok, diag::err_expected)
243 ObjCTypeParamListScope typeParamScope(Actions,
getCurScope());
244 if (Tok.
is(tok::less))
245 typeParameterList = parseObjCTypeParamListOrProtocolRefs(
246 typeParamScope, LAngleLoc, ProtocolIdents, EndProtoLoc);
248 if (Tok.
is(tok::l_paren) &&
249 !isKnownToBeTypeSpecifier(GetLookAheadToken(1))) {
256 if (Tok.
is(tok::code_completion)) {
263 if (Tok.
is(tok::identifier)) {
268 Diag(Tok, diag::err_expected)
274 if (T.getCloseLocation().isInvalid())
277 if (!attrs.empty()) {
278 Diag(nameLoc, diag::err_objc_no_attributes_on_category);
283 assert(LAngleLoc.
isInvalid() &&
"Cannot have already parsed protocols");
286 if (Tok.
is(tok::less) &&
287 ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs,
true,
true,
288 LAngleLoc, EndProtoLoc,
296 categoryId, categoryLoc,
302 if (Tok.
is(tok::l_brace))
303 ParseObjCClassInstanceVariables(CategoryType, tok::objc_private, AtLoc);
305 ParseObjCInterfaceDeclList(tok::objc_not_keyword, CategoryType);
317 if (Tok.
is(tok::colon)) {
321 if (Tok.
is(tok::code_completion)) {
327 if (Tok.
isNot(tok::identifier)) {
328 Diag(Tok, diag::err_expected)
336 if (Tok.
is(tok::less)) {
337 parseObjCTypeArgsOrProtocolQualifiers(
ParsedType(),
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) {
471 typeParams.push_back(typeParam.
get());
474 protocolIdents.clear();
475 mayBeProtocolList =
false;
478 bool invalid =
false;
485 if (Tok.
is(tok::kw___covariant) || Tok.
is(tok::kw___contravariant)) {
486 variance = Tok.
is(tok::kw___covariant)
493 if (mayBeProtocolList) {
496 makeProtocolIdentsIntoTypeParameters();
501 if (!Tok.
is(tok::identifier)) {
503 if (Tok.
is(tok::code_completion)) {
513 Diag(Tok, diag::err_objc_expected_type_parameter);
527 if (mayBeProtocolList) {
530 makeProtocolIdentsIntoTypeParameters();
537 }
else if (mayBeProtocolList) {
540 protocolIdents.push_back(std::make_pair(paramName, paramLoc));
556 typeParams.push_back(typeParam.
get());
562 if (Tok.
is(tok::greater))
564 }
else if (ParseGreaterThanInTemplateList(rAngleLoc,
567 Diag(lAngleLoc, diag::note_matching) <<
"'<'";
568 SkipUntil({tok::greater, tok::greaterequal, tok::at, tok::minus,
569 tok::minus, tok::plus, tok::colon, tok::l_paren, tok::l_brace,
570 tok::comma, tok::semi },
572 if (Tok.
is(tok::greater))
576 if (mayBeProtocolList) {
581 if (Tok.
isNot(tok::colon) && Tok.
isNot(tok::l_paren)) {
590 makeProtocolIdentsIntoTypeParameters();
605 return invalid ?
nullptr : list;
614 ObjCTypeParamListScope Scope(Actions,
getCurScope());
615 return parseObjCTypeParamListOrProtocolRefs(Scope, lAngleLoc, protocolIdents,
642 if (Tok.
isOneOf(tok::minus, tok::plus)) {
643 if (Decl *methodPrototype =
644 ParseObjCMethodPrototype(MethodImplKind,
false))
645 allMethods.push_back(methodPrototype);
648 if (ExpectAndConsumeSemi(diag::err_expected_semi_after_method_proto)) {
651 if (Tok.
is(tok::semi))
656 if (Tok.
is(tok::l_paren)) {
657 Diag(Tok, diag::err_expected_minus_or_plus);
660 MethodImplKind,
false);
664 if (Tok.
is(tok::semi)) {
674 if (Tok.
is(tok::code_completion)) {
678 return cutOffParsing();
682 if (Tok.
isNot(tok::at)) {
686 if (Tok.
is(tok::r_brace))
688 ParsedAttributesWithRange attrs(AttrFactory);
689 allTUVariables.push_back(ParseDeclarationOrFunctionDefinition(attrs));
695 if (Tok.
is(tok::code_completion)) {
697 return cutOffParsing();
702 if (DirectiveKind == tok::objc_end) {
706 }
else if (DirectiveKind == tok::objc_not_keyword) {
707 Diag(Tok, diag::err_objc_unknown_at);
715 switch (DirectiveKind) {
721 Diag(AtLoc, diag::err_objc_illegal_interface_qual);
726 case tok::objc_implementation:
727 case tok::objc_interface:
728 Diag(AtLoc, diag::err_objc_missing_end)
731 << (
int) Actions.getObjCContainerKind();
735 case tok::objc_required:
736 case tok::objc_optional:
739 if (contextKey != tok::objc_protocol)
740 Diag(AtLoc, diag::err_objc_directive_only_in_protocol);
742 MethodImplKind = DirectiveKind;
745 case tok::objc_property:
747 Diag(AtLoc, diag::err_objc_properties_require_objc2);
752 if (Tok.is(tok::l_paren)) {
754 ParseObjCPropertyAttribute(OCDS);
757 bool addedToDeclSpec =
false;
759 if (FD.D.getIdentifier() ==
nullptr) {
760 Diag(AtLoc, diag::err_objc_property_requires_field_name)
761 << FD.D.getSourceRange();
764 if (FD.BitfieldSize) {
765 Diag(AtLoc, diag::err_objc_property_bitfield)
766 << FD.D.getSourceRange();
789 FD.D.getIdentifier());
791 getCurScope(), AtLoc, LParenLoc, FD, OCDS, GetterSel, SetterSel,
794 FD.complete(Property);
799 ParseStructDeclaration(DS, ObjCPropertyCallback);
801 ExpectAndConsume(tok::semi, diag::err_expected_semi_decl_list);
808 if (Tok.
is(tok::code_completion)) {
810 return cutOffParsing();
814 Diag(Tok, diag::err_objc_missing_end)
817 << (
int) Actions.getObjCContainerKind();
818 AtEnd.setBegin(Tok.getLocation());
819 AtEnd.setEnd(Tok.getLocation());
824 Actions.ActOnAtEnd(
getCurScope(), AtEnd, allMethods, allTUVariables);
832 if (DS.getNullability() == nullability) {
833 P.Diag(nullabilityLoc, diag::warn_nullability_duplicate)
839 P.Diag(nullabilityLoc, diag::err_nullability_conflicting)
869 void Parser::ParseObjCPropertyAttribute(
ObjCDeclSpec &DS) {
870 assert(Tok.
getKind() == tok::l_paren);
875 if (Tok.
is(tok::code_completion)) {
877 return cutOffParsing();
889 if (II->
isStr(
"readonly"))
891 else if (II->
isStr(
"assign"))
893 else if (II->
isStr(
"unsafe_unretained"))
895 else if (II->
isStr(
"readwrite"))
897 else if (II->
isStr(
"retain"))
899 else if (II->
isStr(
"strong"))
901 else if (II->
isStr(
"copy"))
903 else if (II->
isStr(
"nonatomic"))
905 else if (II->
isStr(
"atomic"))
907 else if (II->
isStr(
"weak"))
909 else if (II->
isStr(
"getter") || II->
isStr(
"setter")) {
913 unsigned DiagID = IsSetter ? diag::err_objc_expected_equal_for_setter :
914 diag::err_objc_expected_equal_for_getter;
916 if (ExpectAndConsume(tok::equal, DiagID)) {
921 if (Tok.
is(tok::code_completion)) {
926 return cutOffParsing();
933 Diag(Tok, diag::err_objc_expected_selector_for_getter_setter)
943 if (ExpectAndConsume(tok::colon,
944 diag::err_expected_colon_after_setter_name)) {
952 }
else if (II->
isStr(
"nonnull")) {
959 }
else if (II->
isStr(
"nullable")) {
966 }
else if (II->
isStr(
"null_unspecified")) {
973 }
else if (II->
isStr(
"null_resettable")) {
984 Diag(AttrName, diag::err_objc_expected_property_attr) << II;
989 if (Tok.
isNot(tok::comma))
1009 bool MethodDefinition) {
1010 assert(Tok.
isOneOf(tok::minus, tok::plus) &&
"expected +/-");
1014 Decl *MDecl = ParseObjCMethodDecl(mLoc, methodType, MethodImplKind,
1040 case tok::exclaimequal:
1042 case tok::pipeequal:
1044 case tok::caretequal: {
1055 case tok::identifier:
1065 case tok::kw_const_cast:
1066 case tok::kw_continue:
1067 case tok::kw_default:
1068 case tok::kw_delete:
1070 case tok::kw_double:
1071 case tok::kw_dynamic_cast:
1074 case tok::kw_explicit:
1075 case tok::kw_export:
1076 case tok::kw_extern:
1080 case tok::kw_friend:
1083 case tok::kw_inline:
1086 case tok::kw_mutable:
1087 case tok::kw_namespace:
1089 case tok::kw_operator:
1090 case tok::kw_private:
1091 case tok::kw_protected:
1092 case tok::kw_public:
1093 case tok::kw_register:
1094 case tok::kw_reinterpret_cast:
1095 case tok::kw_restrict:
1096 case tok::kw_return:
1098 case tok::kw_signed:
1099 case tok::kw_sizeof:
1100 case tok::kw_static:
1101 case tok::kw_static_cast:
1102 case tok::kw_struct:
1103 case tok::kw_switch:
1104 case tok::kw_template:
1109 case tok::kw_typedef:
1110 case tok::kw_typeid:
1111 case tok::kw_typename:
1112 case tok::kw_typeof:
1114 case tok::kw_unsigned:
1116 case tok::kw_virtual:
1118 case tok::kw_volatile:
1119 case tok::kw_wchar_t:
1122 case tok::kw__Complex:
1123 case tok::kw___alignof:
1124 case tok::kw___auto_type:
1133 bool Parser::isTokIdentifier_in()
const {
1160 void Parser::ParseObjCTypeQualifierList(
ObjCDeclSpec &DS,
1166 if (Tok.
is(tok::code_completion)) {
1169 return cutOffParsing();
1172 if (Tok.
isNot(tok::identifier))
1176 for (
unsigned i = 0; i != objc_NumQuals; ++i) {
1177 if (II != ObjCTypeQuals[i] ||
1185 default: llvm_unreachable(
"Unknown decl qualifier");
1203 case objc_null_unspecified:
1267 assert((paramAttrs !=
nullptr) ==
1270 assert(Tok.
is(tok::l_paren) &&
"expected (");
1279 ParseObjCTypeQualifierList(DS, context);
1282 if (isTypeSpecifierQualifier() || isObjCInstancetype()) {
1285 declSpec.setObjCQualifiers(&DS);
1286 DeclSpecContext dsContext = DSC_normal;
1288 dsContext = DSC_objc_method_result;
1289 ParseSpecifierQualifierList(declSpec,
AS_none, dsContext);
1292 ParseDeclarator(declarator);
1295 if (!declarator.isInvalidType()) {
1297 bool addedToDeclSpec =
false;
1315 if (Tok.
is(tok::r_paren))
1319 Diag(Tok, diag::err_expected_type);
1360 bool MethodDefinition) {
1363 if (Tok.
is(tok::code_completion)) {
1373 if (Tok.
is(tok::l_paren))
1380 MaybeParseGNUAttributes(methodAttrs);
1382 if (Tok.
is(tok::code_completion)) {
1394 if (!SelIdent && Tok.
isNot(tok::colon)) {
1395 Diag(Tok, diag::err_expected_selector_for_method)
1403 if (Tok.
isNot(tok::colon)) {
1406 MaybeParseGNUAttributes(methodAttrs);
1411 mType, DSRet, ReturnType,
1412 selLoc, Sel,
nullptr,
1413 CParamInfo.data(), CParamInfo.size(),
1414 methodAttrs.getList(), MethodImplKind,
1415 false, MethodDefinition);
1416 PD.complete(Result);
1432 if (ExpectAndConsume(tok::colon))
1436 if (Tok.
is(tok::l_paren))
1445 MaybeParseGNUAttributes(paramAttrs);
1450 if (Tok.
is(tok::code_completion)) {
1451 KeyIdents.push_back(SelIdent);
1453 mType == tok::minus,
1455 ReturnType, KeyIdents);
1460 if (Tok.
isNot(tok::identifier)) {
1461 Diag(Tok, diag::err_expected)
1470 ArgInfos.push_back(ArgInfo);
1471 KeyIdents.push_back(SelIdent);
1472 KeyLocs.push_back(selLoc);
1475 allParamAttrs.takeAllFrom(paramAttrs.
getPool());
1478 if (Tok.
is(tok::code_completion)) {
1480 mType == tok::minus,
1482 ReturnType, KeyIdents);
1488 SelIdent = ParseObjCSelectorPiece(selLoc);
1489 if (!SelIdent && Tok.
isNot(tok::colon))
1494 Diag(ArgInfo.
NameLoc, diag::warn_missing_selector_name) << ArgInfo.
Name;
1495 Diag(ArgInfo.
NameLoc, diag::note_missing_selector_name) << ArgInfo.
Name;
1496 Diag(ColonLoc, diag::note_force_empty_selector_name) << ArgInfo.
Name;
1502 bool isVariadic =
false;
1503 bool cStyleParamWarned =
false;
1505 while (Tok.
is(tok::comma)) {
1507 if (Tok.
is(tok::ellipsis)) {
1512 if (!cStyleParamWarned) {
1513 Diag(Tok, diag::warn_cstyle_param);
1514 cStyleParamWarned =
true;
1517 ParseDeclarationSpecifiers(DS);
1520 ParseDeclarator(ParmDecl);
1524 ParmDecl.getIdentifierLoc(),
1532 MaybeParseGNUAttributes(methodAttrs);
1534 if (KeyIdents.size() == 0)
1541 mType, DSRet, ReturnType,
1542 KeyLocs, Sel, &ArgInfos[0],
1543 CParamInfo.data(), CParamInfo.size(),
1544 methodAttrs.getList(),
1545 MethodImplKind, isVariadic, MethodDefinition);
1547 PD.complete(Result);
1557 bool WarnOnDeclarations,
bool ForObjCContainer,
1559 bool consumeLastToken) {
1560 assert(Tok.
is(tok::less) &&
"expected <");
1567 if (Tok.
is(tok::code_completion)) {
1573 if (Tok.
isNot(tok::identifier)) {
1574 Diag(Tok, diag::err_expected) << tok::identifier;
1588 if (ParseGreaterThanInTemplateList(EndLoc, consumeLastToken,
1594 ProtocolIdents, Protocols);
1599 assert(Tok.
is(tok::less) &&
"Protocol qualifiers start with '<'");
1600 assert(
getLangOpts().ObjC1 &&
"Protocol qualifiers only exist in Objective-C");
1605 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
false,
false,
1606 lAngleLoc, rAngleLoc,
1613 Diag(lAngleLoc, diag::warn_objc_protocol_qualifier_missing_id)
1626 void Parser::parseObjCTypeArgsOrProtocolQualifiers(
1635 bool consumeLastToken,
1636 bool warnOnIncompleteProtocols) {
1637 assert(Tok.
is(tok::less) &&
"Not at the start of type args or protocols");
1642 bool allSingleIdentifiers =
true;
1650 if (Tok.
is(tok::identifier) &&
1659 if (Tok.
is(tok::code_completion)) {
1662 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1664 identifierLocs[i]));
1677 allSingleIdentifiers =
false;
1683 if (allSingleIdentifiers) {
1686 (void)ParseGreaterThanInTemplateList(rAngleLoc, consumeLastToken,
1702 warnOnIncompleteProtocols);
1710 bool invalid =
false;
1711 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1716 const char *prevSpec =
nullptr;
1718 DS.SetTypeSpecType(
TST_typename, identifierLocs[i], prevSpec, diagID,
1725 typeArgs.push_back(fullTypeArg.
get());
1745 typeArgs.push_back(typeArg.
get());
1753 (void)ParseGreaterThanInTemplateList(rAngleLoc, consumeLastToken,
1762 typeArgsLAngleLoc = lAngleLoc;
1763 typeArgsRAngleLoc = rAngleLoc;
1766 void Parser::parseObjCTypeArgsAndProtocolQualifiers(
1775 bool consumeLastToken) {
1776 assert(Tok.
is(tok::less));
1779 parseObjCTypeArgsOrProtocolQualifiers(baseType,
1793 if ((consumeLastToken && Tok.
is(tok::less)) ||
1794 (!consumeLastToken &&
NextToken().
is(tok::less))) {
1797 if (!consumeLastToken)
1800 if (!protocols.empty()) {
1802 if (!consumeLastToken)
1804 Diag(Tok, diag::err_objc_type_args_after_protocols)
1805 <<
SourceRange(protocolLAngleLoc, protocolRAngleLoc);
1806 SkipUntil(tok::greater, tok::greatergreater, skipFlags);
1808 ParseObjCProtocolReferences(protocols, protocolLocs,
1811 protocolLAngleLoc, protocolRAngleLoc,
1817 TypeResult Parser::parseObjCTypeArgsAndProtocolQualifiers(
1820 bool consumeLastToken,
1822 assert(Tok.
is(tok::less));
1832 parseObjCTypeArgsAndProtocolQualifiers(type, typeArgsLAngleLoc, typeArgs,
1833 typeArgsRAngleLoc, protocolLAngleLoc,
1834 protocols, protocolLocs,
1835 protocolRAngleLoc, consumeLastToken);
1838 if (consumeLastToken)
1839 endLoc = PrevTokLocation;
1856 void Parser::HelperActionsForIvarDeclarations(Decl *interfaceDecl,
SourceLocation atLoc,
1859 bool RBraceMissing) {
1893 void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl,
1896 assert(Tok.
is(tok::l_brace) &&
"expected {");
1905 while (Tok.
isNot(tok::r_brace) && !isEofOrEom()) {
1909 if (Tok.
is(tok::semi)) {
1910 ConsumeExtraSemi(InstanceVariableList);
1916 if (Tok.
is(tok::code_completion)) {
1918 return cutOffParsing();
1922 case tok::objc_private:
1923 case tok::objc_public:
1924 case tok::objc_protected:
1925 case tok::objc_package:
1931 Diag(Tok, diag::err_objc_unexpected_atend);
1936 HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
1937 T, AllIvarDecls,
true);
1941 Diag(Tok, diag::err_objc_illegal_visibility_spec);
1946 if (Tok.
is(tok::code_completion)) {
1949 return cutOffParsing();
1955 FD.D.setObjCIvar(
true);
1957 getCurScope(), FD.D.getDeclSpec().getSourceRange().getBegin(), FD.D,
1958 FD.BitfieldSize, visibility);
1961 AllIvarDecls.push_back(Field);
1967 ParseStructDeclaration(DS, ObjCIvarCallback);
1969 if (Tok.
is(tok::semi)) {
1972 Diag(Tok, diag::err_expected_semi_decl_list);
1977 HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
1978 T, AllIvarDecls,
false);
2002 "ParseObjCAtProtocolDeclaration(): Expected @protocol");
2005 if (Tok.
is(tok::code_completion)) {
2011 MaybeSkipAttributes(tok::objc_protocol);
2013 if (Tok.
isNot(tok::identifier)) {
2014 Diag(Tok, diag::err_expected) << tok::identifier;
2027 CheckNestedObjCContexts(AtLoc);
2029 if (Tok.
is(tok::comma)) {
2031 ProtocolRefs.push_back(std::make_pair(protocolName, nameLoc));
2036 if (Tok.
isNot(tok::identifier)) {
2037 Diag(Tok, diag::err_expected) << tok::identifier;
2045 if (Tok.
isNot(tok::comma))
2049 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
"@protocol"))
2061 if (Tok.
is(tok::less) &&
2062 ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs,
false,
true,
2063 LAngleLoc, EndProtoLoc,
2069 ProtocolRefs.data(),
2070 ProtocolRefs.size(),
2071 ProtocolLocs.data(),
2072 EndProtoLoc, attrs.
getList());
2074 ParseObjCInterfaceDeclList(tok::objc_protocol, ProtoType);
2089 Parser::ParseObjCAtImplementationDeclaration(
SourceLocation AtLoc) {
2091 "ParseObjCAtImplementationDeclaration(): Expected @implementation");
2092 CheckNestedObjCContexts(AtLoc);
2096 if (Tok.
is(tok::code_completion)) {
2102 MaybeSkipAttributes(tok::objc_implementation);
2104 if (Tok.
isNot(tok::identifier)) {
2105 Diag(Tok, diag::err_expected)
2112 Decl *ObjCImpDecl =
nullptr;
2116 if (Tok.
is(tok::less)) {
2120 ObjCTypeParamListScope typeParamScope(Actions,
getCurScope());
2121 if (parseObjCTypeParamListOrProtocolRefs(typeParamScope, lAngleLoc,
2122 protocolIdents, rAngleLoc)) {
2123 Diag(diagLoc, diag::err_objc_parameterized_implementation)
2125 }
else if (lAngleLoc.
isValid()) {
2126 Diag(lAngleLoc, diag::err_unexpected_protocol_qualifier)
2131 if (Tok.
is(tok::l_paren)) {
2137 if (Tok.
is(tok::code_completion)) {
2143 if (Tok.
is(tok::identifier)) {
2147 Diag(Tok, diag::err_expected)
2151 if (Tok.
isNot(tok::r_paren)) {
2152 Diag(Tok, diag::err_expected) << tok::r_paren;
2156 rparenLoc = ConsumeParen();
2157 if (Tok.
is(tok::less)) {
2158 Diag(Tok, diag::err_unexpected_protocol_qualifier);
2162 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
2165 protocolLAngleLoc, protocolRAngleLoc,
2169 AtLoc, nameId, nameLoc, categoryId,
2178 if (Tok.
isNot(tok::identifier)) {
2179 Diag(Tok, diag::err_expected)
2187 AtLoc, nameId, nameLoc,
2188 superClassId, superClassLoc);
2190 if (Tok.
is(tok::l_brace))
2191 ParseObjCClassInstanceVariables(ObjCImpDecl, tok::objc_private, AtLoc);
2192 else if (Tok.
is(tok::less)) {
2193 Diag(Tok, diag::err_unexpected_protocol_qualifier);
2198 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
2201 protocolLAngleLoc, protocolRAngleLoc,
2205 assert(ObjCImpDecl);
2210 ObjCImplParsingDataRAII ObjCImplParsing(*
this, ObjCImpDecl);
2211 while (!ObjCImplParsing.isFinished() && !isEofOrEom()) {
2212 ParsedAttributesWithRange attrs(AttrFactory);
2213 MaybeParseCXX11Attributes(attrs);
2214 MaybeParseMicrosoftAttributes(attrs);
2217 DeclsInGroup.append(DG.
begin(), DG.
end());
2226 Parser::ParseObjCAtEndDeclaration(
SourceRange atEnd) {
2228 "ParseObjCAtEndDeclaration(): Expected @end");
2230 if (CurParsedObjCImpl)
2231 CurParsedObjCImpl->finish(atEnd);
2234 Diag(atEnd.
getBegin(), diag::err_expected_objc_container);
2238 Parser::ObjCImplParsingDataRAII::~ObjCImplParsingDataRAII() {
2240 finish(
P.Tok.getLocation());
2241 if (
P.isEofOrEom()) {
2242 P.Diag(
P.Tok, diag::err_objc_missing_end)
2244 P.Diag(Dcl->getLocStart(), diag::note_objc_container_start)
2248 P.CurParsedObjCImpl =
nullptr;
2249 assert(LateParsedObjCMethods.empty());
2252 void Parser::ObjCImplParsingDataRAII::finish(
SourceRange AtEnd) {
2254 P.Actions.DefaultSynthesizeProperties(
P.getCurScope(), Dcl);
2255 for (
size_t i = 0; i < LateParsedObjCMethods.size(); ++i)
2256 P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
2259 P.Actions.ActOnAtEnd(
P.getCurScope(), AtEnd);
2262 for (
size_t i = 0; i < LateParsedObjCMethods.size(); ++i)
2263 P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
2268 I = LateParsedObjCMethods.begin(),
2269 E = LateParsedObjCMethods.end();
I !=
E; ++
I)
2271 LateParsedObjCMethods.clear();
2279 Decl *Parser::ParseObjCAtAliasDeclaration(
SourceLocation atLoc) {
2281 "ParseObjCAtAliasDeclaration(): Expected @compatibility_alias");
2283 if (Tok.
isNot(tok::identifier)) {
2284 Diag(Tok, diag::err_expected) << tok::identifier;
2289 if (Tok.
isNot(tok::identifier)) {
2290 Diag(Tok, diag::err_expected) << tok::identifier;
2295 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@compatibility_alias");
2311 Decl *Parser::ParseObjCPropertySynthesize(
SourceLocation atLoc) {
2313 "ParseObjCPropertySynthesize(): Expected '@synthesize'");
2317 if (Tok.
is(tok::code_completion)) {
2323 if (Tok.
isNot(tok::identifier)) {
2324 Diag(Tok, diag::err_synthesized_property_name);
2335 if (Tok.
is(tok::code_completion)) {
2341 if (Tok.
isNot(tok::identifier)) {
2342 Diag(Tok, diag::err_expected) << tok::identifier;
2349 propertyId, propertyIvar, propertyIvarLoc);
2350 if (Tok.
isNot(tok::comma))
2354 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@synthesize");
2367 "ParseObjCPropertyDynamic(): Expected '@dynamic'");
2370 if (Tok.
is(tok::code_completion)) {
2376 if (Tok.
isNot(tok::identifier)) {
2377 Diag(Tok, diag::err_expected) << tok::identifier;
2387 if (Tok.
isNot(tok::comma))
2391 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@dynamic");
2401 if (Tok.
isNot(tok::semi)) {
2409 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@throw");
2419 if (Tok.
isNot(tok::l_paren)) {
2420 Diag(Tok, diag::err_expected_lparen_after) <<
"@synchronized";
2428 if (Tok.
is(tok::r_paren)) {
2431 if (!operand.isInvalid())
2432 Diag(Tok, diag::err_expected) << tok::r_paren;
2439 if (Tok.
isNot(tok::l_brace)) {
2440 if (!operand.isInvalid())
2441 Diag(Tok, diag::err_expected) << tok::l_brace;
2446 if (!operand.isInvalid())
2451 StmtResult body(ParseCompoundStatementBody());
2456 if (operand.isInvalid())
2459 if (body.isInvalid())
2477 bool catch_or_finally_seen =
false;
2480 if (Tok.
isNot(tok::l_brace)) {
2481 Diag(Tok, diag::err_expected) << tok::l_brace;
2484 StmtVector CatchStmts;
2487 StmtResult TryBody(ParseCompoundStatementBody());
2489 if (TryBody.isInvalid())
2492 while (Tok.
is(tok::at)) {
2496 Token AfterAt = GetLookAheadToken(1);
2503 Decl *FirstPart =
nullptr;
2505 if (Tok.
is(tok::l_paren)) {
2508 if (Tok.
isNot(tok::ellipsis)) {
2510 ParseDeclarationSpecifiers(DS);
2512 ParseDeclarator(ParmDecl);
2522 if (Tok.
is(tok::r_paren))
2523 RParenLoc = ConsumeParen();
2528 if (Tok.
is(tok::l_brace))
2529 CatchBody = ParseCompoundStatementBody();
2531 Diag(Tok, diag::err_expected) << tok::l_brace;
2532 if (CatchBody.isInvalid())
2539 if (!Catch.isInvalid())
2540 CatchStmts.push_back(Catch.get());
2543 Diag(AtCatchFinallyLoc, diag::err_expected_lparen_after)
2547 catch_or_finally_seen =
true;
2549 assert(Tok.
isObjCAtKeyword(tok::objc_finally) &&
"Lookahead confused?");
2554 if (Tok.
is(tok::l_brace))
2555 FinallyBody = ParseCompoundStatementBody();
2557 Diag(Tok, diag::err_expected) << tok::l_brace;
2558 if (FinallyBody.isInvalid())
2562 catch_or_finally_seen =
true;
2566 if (!catch_or_finally_seen) {
2567 Diag(atLoc, diag::err_missing_catch_finally);
2582 if (Tok.
isNot(tok::l_brace)) {
2583 Diag(Tok, diag::err_expected) << tok::l_brace;
2590 StmtResult AutoreleasePoolBody(ParseCompoundStatementBody());
2593 if (AutoreleasePoolBody.isInvalid())
2596 AutoreleasePoolBody.get());
2601 void Parser::StashAwayMethodOrFunctionBodyTokens(Decl *MDecl) {
2602 LexedMethod* LM =
new LexedMethod(
this, MDecl);
2603 CurParsedObjCImpl->LateParsedObjCMethods.push_back(LM);
2606 Toks.push_back(Tok);
2607 if (Tok.
is(tok::kw_try)) {
2609 if (Tok.
is(tok::colon)) {
2610 Toks.push_back(Tok);
2612 while (Tok.
isNot(tok::l_brace)) {
2613 ConsumeAndStoreUntil(tok::l_paren, Toks,
false);
2614 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
2617 Toks.push_back(Tok);
2619 else if (Tok.
is(tok::colon)) {
2622 while (Tok.
isNot(tok::l_brace)) {
2623 ConsumeAndStoreUntil(tok::l_paren, Toks,
false);
2624 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
2626 Toks.push_back(Tok);
2630 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
2631 while (Tok.
is(tok::kw_catch)) {
2632 ConsumeAndStoreUntil(tok::l_brace, Toks,
false);
2633 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
2639 Decl *Parser::ParseObjCMethodDefinition() {
2640 Decl *MDecl = ParseObjCMethodPrototype();
2643 "parsing Objective-C method");
2646 if (Tok.
is(tok::semi)) {
2647 if (CurParsedObjCImpl) {
2648 Diag(Tok, diag::warn_semicolon_before_method_body)
2655 if (Tok.
isNot(tok::l_brace)) {
2656 Diag(Tok, diag::err_expected_method_body);
2662 if (Tok.
isNot(tok::l_brace))
2674 assert (CurParsedObjCImpl
2675 &&
"ParseObjCMethodDefinition - Method out of @implementation");
2677 StashAwayMethodOrFunctionBodyTokens(MDecl);
2682 if (Tok.
is(tok::code_completion)) {
2689 return ParseObjCTryStmt(AtLoc);
2692 return ParseObjCThrowStmt(AtLoc);
2695 return ParseObjCSynchronizedStmt(AtLoc);
2698 return ParseObjCAutoreleasePoolStmt(AtLoc);
2706 ExprResult Res(ParseExpressionWithLeadingAt(AtLoc));
2716 ExpectAndConsumeSemi(diag::err_expected_semi_after_expr);
2722 case tok::code_completion:
2732 if (!Tok.
is(tok::numeric_constant)) {
2733 const char *Symbol =
nullptr;
2735 case tok::minus: Symbol =
"-";
break;
2736 case tok::plus: Symbol =
"+";
break;
2737 default: llvm_unreachable(
"missing unary operator case");
2739 Diag(Tok, diag::err_nsnumber_nonliteral_unary)
2745 if (Lit.isInvalid()) {
2751 if (Lit.isInvalid())
2754 return ParsePostfixExpressionSuffix(
2758 case tok::string_literal:
2759 case tok::wide_string_literal:
2760 return ParsePostfixExpressionSuffix(ParseObjCStringLiteral(AtLoc));
2762 case tok::char_constant:
2763 return ParsePostfixExpressionSuffix(ParseObjCCharacterLiteral(AtLoc));
2765 case tok::numeric_constant:
2766 return ParsePostfixExpressionSuffix(ParseObjCNumericLiteral(AtLoc));
2769 case tok::kw___objc_yes:
2770 return ParsePostfixExpressionSuffix(ParseObjCBooleanLiteral(AtLoc,
true));
2772 case tok::kw___objc_no:
2773 return ParsePostfixExpressionSuffix(ParseObjCBooleanLiteral(AtLoc,
false));
2777 return ParsePostfixExpressionSuffix(ParseObjCArrayLiteral(AtLoc));
2781 return ParsePostfixExpressionSuffix(ParseObjCDictionaryLiteral(AtLoc));
2785 return ParsePostfixExpressionSuffix(ParseObjCBoxedExpr(AtLoc));
2792 case tok::objc_encode:
2793 return ParsePostfixExpressionSuffix(ParseObjCEncodeExpression(AtLoc));
2794 case tok::objc_protocol:
2795 return ParsePostfixExpressionSuffix(ParseObjCProtocolExpression(AtLoc));
2796 case tok::objc_selector:
2797 return ParsePostfixExpressionSuffix(ParseObjCSelectorExpression(AtLoc));
2799 const char *str =
nullptr;
2800 if (GetLookAheadToken(1).is(tok::l_brace)) {
2804 : (ch ==
'f' ?
"finally"
2805 : (ch ==
'a' ?
"autoreleasepool" :
nullptr));
2841 bool Parser::ParseObjCXXMessageReceiver(
bool &IsExpr,
void *&TypeOrExpr) {
2844 if (Tok.
isOneOf(tok::identifier, tok::coloncolon, tok::kw_typename,
2845 tok::annot_cxxscope))
2859 TypeOrExpr = Receiver.
get();
2868 ParseCXXSimpleTypeSpecifier(DS);
2870 if (Tok.
is(tok::l_paren)) {
2883 ExprResult Receiver = ParseCXXTypeConstructExpression(DS);
2885 Receiver = ParsePostfixExpressionSuffix(Receiver.
get());
2887 Receiver = ParseRHSOfBinaryExpression(Receiver.
get(),
prec::Comma);
2892 TypeOrExpr = Receiver.
get();
2905 TypeOrExpr = Type.
get().getAsOpaquePtr();
2914 bool Parser::isSimpleObjCMessageExpression() {
2916 "Incorrect start for isSimpleObjCMessageExpression");
2917 return GetLookAheadToken(1).
is(tok::identifier) &&
2918 GetLookAheadToken(2).
is(tok::identifier);
2921 bool Parser::isStartOfObjCClassMessageMissingOpenBracket() {
2923 InMessageExpression)
2929 if (Tok.
is(tok::annot_typename))
2931 else if (Tok.
is(tok::identifier))
2937 if (!Type.
get().isNull() && Type.
get()->isObjCObjectOrInterfaceType()) {
2938 const Token &AfterNext = GetLookAheadToken(2);
2939 if (AfterNext.
isOneOf(tok::colon, tok::r_square)) {
2940 if (Tok.
is(tok::identifier))
2943 return Tok.
is(tok::annot_typename);
2959 ExprResult Parser::ParseObjCMessageExpression() {
2960 assert(Tok.
is(tok::l_square) &&
"'[' expected");
2963 if (Tok.
is(tok::code_completion)) {
2980 return ParseObjCMessageExpressionBody(LBracLoc,
ConsumeToken(),
2985 void *TypeOrExpr =
nullptr;
2986 if (ParseObjCXXMessageReceiver(IsExpr, TypeOrExpr)) {
2992 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
2994 static_cast<Expr*>(TypeOrExpr));
2996 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
3001 if (Tok.
is(tok::identifier)) {
3006 Name == Ident_super,
3010 return ParseObjCMessageExpressionBody(LBracLoc,
ConsumeToken(),
3014 if (!ReceiverType) {
3022 if (Tok.
is(tok::less)) {
3025 = parseObjCTypeArgsAndProtocolQualifiers(NameLoc, ReceiverType,
3033 ReceiverType = NewReceiverType.
get();
3036 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
3037 ReceiverType,
nullptr);
3052 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
3098 Expr *ReceiverExpr) {
3101 if (Tok.
is(tok::code_completion)) {
3105 else if (ReceiverType)
3121 ExprVector KeyExprs;
3123 if (Tok.
is(tok::colon)) {
3126 KeyIdents.push_back(selIdent);
3127 KeyLocs.push_back(Loc);
3129 if (ExpectAndConsume(tok::colon)) {
3139 if (Tok.
is(tok::code_completion)) {
3144 else if (ReceiverType)
3159 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3160 Expr = ParseBraceInitializer();
3174 KeyExprs.push_back(Res.
get());
3177 if (Tok.
is(tok::code_completion)) {
3182 else if (ReceiverType)
3195 selIdent = ParseObjCSelectorPiece(Loc);
3196 if (!selIdent && Tok.
isNot(tok::colon))
3201 while (Tok.
is(tok::comma)) {
3205 if (Tok.
is(tok::colon))
3208 if (Tok.
is(tok::colon)) {
3209 Diag(commaLoc, diag::note_extra_comma_message_arg) <<
3220 KeyExprs.push_back(Res.
get());
3222 }
else if (!selIdent) {
3223 Diag(Tok, diag::err_expected) << tok::identifier;
3232 if (Tok.
isNot(tok::r_square)) {
3233 Diag(Tok, diag::err_expected)
3234 << (Tok.
is(tok::identifier) ? tok::colon : tok::r_square);
3244 unsigned nKeys = KeyIdents.size();
3246 KeyIdents.push_back(selIdent);
3247 KeyLocs.push_back(Loc);
3253 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3254 else if (ReceiverType)
3256 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3258 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3262 ExprResult Res(ParseStringLiteralExpression());
3269 ExprVector AtStrings;
3270 AtLocs.push_back(AtLoc);
3271 AtStrings.push_back(Res.
get());
3273 while (Tok.
is(tok::at)) {
3277 if (!isTokenStringLiteral())
3280 ExprResult Lit(ParseStringLiteralExpression());
3281 if (Lit.isInvalid())
3284 AtStrings.push_back(Lit.get());
3306 if (Lit.isInvalid()) {
3320 if (Lit.isInvalid()) {
3332 if (Tok.
isNot(tok::l_paren))
3333 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@");
3341 if (ValueExpr.isInvalid())
3347 ValueExpr = Actions.
ActOnParenExpr(LPLoc, RPLoc, ValueExpr.get());
3353 ExprVector ElementExprs;
3356 while (Tok.
isNot(tok::r_square)) {
3368 if (Tok.
is(tok::ellipsis))
3373 ElementExprs.push_back(Res.
get());
3375 if (Tok.
is(tok::comma))
3377 else if (Tok.
isNot(tok::r_square))
3378 return ExprError(
Diag(Tok, diag::err_expected_either) << tok::r_square
3389 while (Tok.
isNot(tok::r_brace)) {
3404 if (ExpectAndConsume(tok::colon)) {
3410 if (ValueExpr.isInvalid()) {
3426 KeyExpr.
get(), ValueExpr.get(), EllipsisLoc,
None
3428 Elements.push_back(Element);
3431 return ExprError(
Diag(Tok, diag::err_expected_either) << tok::r_brace
3445 assert(Tok.
isObjCAtKeyword(tok::objc_encode) &&
"Not an @encode expression!");
3449 if (Tok.
isNot(tok::l_paren))
3450 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@encode");
3472 if (Tok.
isNot(tok::l_paren))
3473 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@protocol");
3478 if (Tok.
isNot(tok::identifier))
3479 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
3496 if (Tok.
isNot(tok::l_paren))
3497 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@selector");
3504 bool HasOptionalParen = Tok.
is(tok::l_paren);
3505 if (HasOptionalParen)
3508 if (Tok.
is(tok::code_completion)) {
3516 Tok.
isNot(tok::colon) && Tok.
isNot(tok::coloncolon))
3517 return ExprError(
Diag(Tok, diag::err_expected) << tok::identifier);
3519 KeyIdents.push_back(SelIdent);
3521 unsigned nColons = 0;
3522 if (Tok.
isNot(tok::r_paren)) {
3526 KeyIdents.push_back(
nullptr);
3527 }
else if (ExpectAndConsume(tok::colon))
3531 if (Tok.
is(tok::r_paren))
3534 if (Tok.
is(tok::code_completion)) {
3542 SelIdent = ParseObjCSelectorPiece(Loc);
3543 KeyIdents.push_back(SelIdent);
3544 if (!SelIdent && Tok.
isNot(tok::colon) && Tok.
isNot(tok::coloncolon))
3548 if (HasOptionalParen && Tok.
is(tok::r_paren))
3558 void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM,
bool parseMethod) {
3560 Decl *MCDecl = LM.D;
3561 bool skip = MCDecl &&
3570 assert(!LM.Toks.empty() &&
"ParseLexedObjCMethodDef - Empty body!");
3573 LM.Toks.push_back(Tok);
3577 ConsumeAnyToken(
true);
3579 assert(Tok.
isOneOf(tok::l_brace, tok::kw_try, tok::colon) &&
3580 "Inline objective-c method not starting with '{' or 'try' or ':'");
3582 ParseScope BodyScope(
this,
3593 if (Tok.
is(tok::kw_try))
3594 ParseFunctionTryBlock(MCDecl, BodyScope);
3596 if (Tok.
is(tok::colon))
3597 ParseConstructorInitializer(MCDecl);
3598 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)
Decl - This represents one declaration (or definition), e.g.
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)
~ObjCTypeParamListScope()
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...
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.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
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.
A location where the result (returned value) of evaluating a statement should be stored.
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.
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=ParsedType(), 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...
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 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.
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)
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
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.
SourceLocation getLocStart() const LLVM_READONLY
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
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
void EnterTokenStream(const Token *Toks, unsigned NumToks, bool DisableMacroExpansion, bool OwnsTokens)
Add a "macro" context to the top of the include stack, which will cause the lexer to start returning ...
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.
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.
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