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 (expectIdentifier()) {
150 if (Tok.
is(tok::less))
151 TypeParams = parseObjCTypeParamList();
152 ClassTypeParams.push_back(TypeParams);
158 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
"@class"))
174 if (CurParsedObjCImpl) {
175 CurParsedObjCImpl->finish(AtLoc);
179 Diag(AtLoc, diag::err_objc_missing_end)
218 "ParseObjCAtInterfaceDeclaration(): Expected @interface");
219 CheckNestedObjCContexts(AtLoc);
223 if (Tok.
is(tok::code_completion)) {
229 MaybeSkipAttributes(tok::objc_interface);
231 if (expectIdentifier())
244 ObjCTypeParamListScope typeParamScope(Actions,
getCurScope());
245 if (Tok.
is(tok::less))
246 typeParameterList = parseObjCTypeParamListOrProtocolRefs(
247 typeParamScope, LAngleLoc, ProtocolIdents, EndProtoLoc);
249 if (Tok.
is(tok::l_paren) &&
250 !isKnownToBeTypeSpecifier(GetLookAheadToken(1))) {
257 if (Tok.
is(tok::code_completion)) {
264 if (Tok.
is(tok::identifier)) {
269 Diag(Tok, diag::err_expected)
275 if (T.getCloseLocation().isInvalid())
279 assert(LAngleLoc.
isInvalid() &&
"Cannot have already parsed protocols");
282 if (Tok.
is(tok::less) &&
283 ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs,
true,
true,
284 LAngleLoc, EndProtoLoc,
289 AtLoc, nameId, nameLoc, typeParameterList, categoryId, categoryLoc,
290 ProtocolRefs.data(), ProtocolRefs.size(), ProtocolLocs.data(),
291 EndProtoLoc, attrs.getList());
293 if (Tok.
is(tok::l_brace))
294 ParseObjCClassInstanceVariables(CategoryType, tok::objc_private, AtLoc);
296 ParseObjCInterfaceDeclList(tok::objc_not_keyword, CategoryType);
308 if (Tok.
is(tok::colon)) {
312 if (Tok.
is(tok::code_completion)) {
318 if (expectIdentifier())
324 if (Tok.
is(tok::less)) {
325 parseObjCTypeArgsOrProtocolQualifiers(
326 nullptr, typeArgsLAngleLoc, typeArgs, typeArgsRAngleLoc, LAngleLoc,
327 protocols, protocolLocs, EndProtoLoc,
337 if (!ProtocolIdents.empty()) {
340 for (
const auto &pair : ProtocolIdents) {
341 protocolLocs.push_back(pair.second);
345 ProtocolIdents, protocols);
347 }
else if (protocols.empty() && Tok.
is(tok::less) &&
348 ParseObjCProtocolReferences(protocols, protocolLocs,
true,
true,
349 LAngleLoc, EndProtoLoc,
354 if (Tok.
isNot(tok::less))
356 superClassId, superClassLoc);
360 typeParameterList, superClassId,
365 protocols.data(), protocols.size(),
367 EndProtoLoc, attrs.getList());
369 if (Tok.
is(tok::l_brace))
370 ParseObjCClassInstanceVariables(ClsType, tok::objc_protected, AtLoc);
372 ParseObjCInterfaceDeclList(tok::objc_interface, ClsType);
383 bool &addedToDeclSpec) {
396 auto nullabilityAttr = getNullabilityAttr();
400 }
else if (!addedToDeclSpec) {
404 addedToDeclSpec =
true;
436 assert(Tok.
is(tok::less) &&
"Not at the beginning of a type parameter list");
444 auto makeProtocolIdentsIntoTypeParameters = [&]() {
446 for (
const auto &pair : protocolIdents) {
451 typeParams.push_back(typeParam.
get());
454 protocolIdents.clear();
455 mayBeProtocolList =
false;
458 bool invalid =
false;
465 if (Tok.
is(tok::kw___covariant) || Tok.
is(tok::kw___contravariant)) {
466 variance = Tok.
is(tok::kw___covariant)
473 if (mayBeProtocolList) {
476 makeProtocolIdentsIntoTypeParameters();
481 if (!Tok.
is(tok::identifier)) {
483 if (Tok.
is(tok::code_completion)) {
493 Diag(Tok, diag::err_objc_expected_type_parameter);
507 if (mayBeProtocolList) {
510 makeProtocolIdentsIntoTypeParameters();
517 }
else if (mayBeProtocolList) {
520 protocolIdents.push_back(std::make_pair(paramName, paramLoc));
526 getCurScope(), variance, varianceLoc, typeParams.size(), paramName,
527 paramLoc, colonLoc, boundType.
isUsable() ? boundType.
get() :
nullptr);
529 typeParams.push_back(typeParam.
get());
535 if (Tok.
is(tok::greater))
537 }
else if (ParseGreaterThanInTemplateList(rAngleLoc,
540 Diag(lAngleLoc, diag::note_matching) <<
"'<'";
541 SkipUntil({tok::greater, tok::greaterequal, tok::at, tok::minus,
542 tok::minus, tok::plus, tok::colon, tok::l_paren, tok::l_brace,
543 tok::comma, tok::semi },
545 if (Tok.
is(tok::greater))
549 if (mayBeProtocolList) {
554 if (Tok.
isNot(tok::colon) && Tok.
isNot(tok::l_paren)) {
563 makeProtocolIdentsIntoTypeParameters();
578 return invalid ?
nullptr : list;
587 ObjCTypeParamListScope Scope(Actions,
getCurScope());
588 return parseObjCTypeParamListOrProtocolRefs(Scope, lAngleLoc, protocolIdents,
615 if (Tok.
isOneOf(tok::minus, tok::plus)) {
616 if (Decl *methodPrototype =
617 ParseObjCMethodPrototype(MethodImplKind,
false))
618 allMethods.push_back(methodPrototype);
621 if (ExpectAndConsumeSemi(diag::err_expected_semi_after_method_proto)) {
624 if (Tok.
is(tok::semi))
629 if (Tok.
is(tok::l_paren)) {
630 Diag(Tok, diag::err_expected_minus_or_plus);
633 MethodImplKind,
false);
637 if (Tok.
is(tok::semi)) {
647 if (Tok.
is(tok::code_completion)) {
651 return cutOffParsing();
655 if (Tok.
isNot(tok::at)) {
659 if (Tok.
is(tok::r_brace))
661 ParsedAttributesWithRange attrs(AttrFactory);
662 allTUVariables.push_back(ParseDeclarationOrFunctionDefinition(attrs));
668 if (Tok.
is(tok::code_completion)) {
670 return cutOffParsing();
675 if (DirectiveKind == tok::objc_end) {
679 }
else if (DirectiveKind == tok::objc_not_keyword) {
680 Diag(Tok, diag::err_objc_unknown_at);
688 switch (DirectiveKind) {
694 Diag(AtLoc, diag::err_objc_illegal_interface_qual);
699 case tok::objc_implementation:
700 case tok::objc_interface:
701 Diag(AtLoc, diag::err_objc_missing_end)
704 << (
int) Actions.getObjCContainerKind();
708 case tok::objc_required:
709 case tok::objc_optional:
712 if (contextKey != tok::objc_protocol)
713 Diag(AtLoc, diag::err_objc_directive_only_in_protocol);
715 MethodImplKind = DirectiveKind;
718 case tok::objc_property:
720 Diag(AtLoc, diag::err_objc_properties_require_objc2);
725 if (Tok.is(tok::l_paren)) {
727 ParseObjCPropertyAttribute(OCDS);
730 bool addedToDeclSpec =
false;
732 if (FD.D.getIdentifier() ==
nullptr) {
733 Diag(AtLoc, diag::err_objc_property_requires_field_name)
734 << FD.D.getSourceRange();
737 if (FD.BitfieldSize) {
738 Diag(AtLoc, diag::err_objc_property_bitfield)
739 << FD.D.getSourceRange();
762 FD.D.getIdentifier());
764 getCurScope(), AtLoc, LParenLoc, FD, OCDS, GetterSel, SetterSel,
767 FD.complete(Property);
772 ParseStructDeclaration(DS, ObjCPropertyCallback);
774 ExpectAndConsume(tok::semi, diag::err_expected_semi_decl_list);
781 if (Tok.
is(tok::code_completion)) {
783 return cutOffParsing();
787 Diag(Tok, diag::err_objc_missing_end)
790 << (
int) Actions.getObjCContainerKind();
791 AtEnd.setBegin(Tok.getLocation());
792 AtEnd.setEnd(Tok.getLocation());
797 Actions.ActOnAtEnd(
getCurScope(), AtEnd, allMethods, allTUVariables);
805 if (DS.getNullability() == nullability) {
806 P.Diag(nullabilityLoc, diag::warn_nullability_duplicate)
812 P.Diag(nullabilityLoc, diag::err_nullability_conflicting)
843 void Parser::ParseObjCPropertyAttribute(
ObjCDeclSpec &DS) {
844 assert(Tok.
getKind() == tok::l_paren);
849 if (Tok.
is(tok::code_completion)) {
851 return cutOffParsing();
863 if (II->
isStr(
"readonly"))
865 else if (II->
isStr(
"assign"))
867 else if (II->
isStr(
"unsafe_unretained"))
869 else if (II->
isStr(
"readwrite"))
871 else if (II->
isStr(
"retain"))
873 else if (II->
isStr(
"strong"))
875 else if (II->
isStr(
"copy"))
877 else if (II->
isStr(
"nonatomic"))
879 else if (II->
isStr(
"atomic"))
881 else if (II->
isStr(
"weak"))
883 else if (II->
isStr(
"getter") || II->
isStr(
"setter")) {
887 unsigned DiagID = IsSetter ? diag::err_objc_expected_equal_for_setter :
888 diag::err_objc_expected_equal_for_getter;
890 if (ExpectAndConsume(tok::equal, DiagID)) {
895 if (Tok.
is(tok::code_completion)) {
900 return cutOffParsing();
907 Diag(Tok, diag::err_objc_expected_selector_for_getter_setter)
917 if (ExpectAndConsume(tok::colon,
918 diag::err_expected_colon_after_setter_name)) {
926 }
else if (II->
isStr(
"nonnull")) {
933 }
else if (II->
isStr(
"nullable")) {
940 }
else if (II->
isStr(
"null_unspecified")) {
947 }
else if (II->
isStr(
"null_resettable")) {
957 }
else if (II->
isStr(
"class")) {
960 Diag(AttrName, diag::err_objc_expected_property_attr) << II;
965 if (Tok.
isNot(tok::comma))
985 bool MethodDefinition) {
986 assert(Tok.
isOneOf(tok::minus, tok::plus) &&
"expected +/-");
990 Decl *MDecl = ParseObjCMethodDecl(mLoc, methodType, MethodImplKind,
1020 case tok::exclaimequal:
1022 case tok::pipeequal:
1024 case tok::caretequal: {
1035 case tok::identifier:
1045 case tok::kw_const_cast:
1046 case tok::kw_continue:
1047 case tok::kw_default:
1048 case tok::kw_delete:
1050 case tok::kw_double:
1051 case tok::kw_dynamic_cast:
1054 case tok::kw_explicit:
1055 case tok::kw_export:
1056 case tok::kw_extern:
1060 case tok::kw_friend:
1063 case tok::kw_inline:
1066 case tok::kw_mutable:
1067 case tok::kw_namespace:
1069 case tok::kw_operator:
1070 case tok::kw_private:
1071 case tok::kw_protected:
1072 case tok::kw_public:
1073 case tok::kw_register:
1074 case tok::kw_reinterpret_cast:
1075 case tok::kw_restrict:
1076 case tok::kw_return:
1078 case tok::kw_signed:
1079 case tok::kw_sizeof:
1080 case tok::kw_static:
1081 case tok::kw_static_cast:
1082 case tok::kw_struct:
1083 case tok::kw_switch:
1084 case tok::kw_template:
1089 case tok::kw_typedef:
1090 case tok::kw_typeid:
1091 case tok::kw_typename:
1092 case tok::kw_typeof:
1094 case tok::kw_unsigned:
1096 case tok::kw_virtual:
1098 case tok::kw_volatile:
1099 case tok::kw_wchar_t:
1102 case tok::kw__Complex:
1103 case tok::kw___alignof:
1104 case tok::kw___auto_type:
1113 bool Parser::isTokIdentifier_in()
const {
1140 void Parser::ParseObjCTypeQualifierList(
ObjCDeclSpec &DS,
1146 if (Tok.
is(tok::code_completion)) {
1149 return cutOffParsing();
1152 if (Tok.
isNot(tok::identifier))
1156 for (
unsigned i = 0; i != objc_NumQuals; ++i) {
1157 if (II != ObjCTypeQuals[i] ||
1165 default: llvm_unreachable(
"Unknown decl qualifier");
1183 case objc_null_unspecified:
1247 assert((paramAttrs !=
nullptr) ==
1250 assert(Tok.
is(tok::l_paren) &&
"expected (");
1259 ParseObjCTypeQualifierList(DS, context);
1262 if (isTypeSpecifierQualifier() || isObjCInstancetype()) {
1265 declSpec.setObjCQualifiers(&DS);
1266 DeclSpecContext dsContext = DSC_normal;
1268 dsContext = DSC_objc_method_result;
1269 ParseSpecifierQualifierList(declSpec,
AS_none, dsContext);
1271 ParseDeclarator(declarator);
1274 if (!declarator.isInvalidType()) {
1276 bool addedToDeclSpec =
false;
1294 if (Tok.
is(tok::r_paren))
1298 Diag(Tok, diag::err_expected_type);
1339 bool MethodDefinition) {
1342 if (Tok.
is(tok::code_completion)) {
1352 if (Tok.
is(tok::l_paren))
1359 MaybeParseGNUAttributes(methodAttrs);
1361 if (Tok.
is(tok::code_completion)) {
1373 if (!SelIdent && Tok.
isNot(tok::colon)) {
1374 Diag(Tok, diag::err_expected_selector_for_method)
1382 if (Tok.
isNot(tok::colon)) {
1385 MaybeParseGNUAttributes(methodAttrs);
1390 mType, DSRet, ReturnType,
1391 selLoc, Sel,
nullptr,
1392 CParamInfo.data(), CParamInfo.size(),
1393 methodAttrs.getList(), MethodImplKind,
1394 false, MethodDefinition);
1395 PD.complete(Result);
1411 if (ExpectAndConsume(tok::colon))
1414 ArgInfo.
Type =
nullptr;
1415 if (Tok.
is(tok::l_paren))
1424 MaybeParseGNUAttributes(paramAttrs);
1429 if (Tok.
is(tok::code_completion)) {
1430 KeyIdents.push_back(SelIdent);
1432 mType == tok::minus,
1434 ReturnType, KeyIdents);
1439 if (expectIdentifier())
1446 ArgInfos.push_back(ArgInfo);
1447 KeyIdents.push_back(SelIdent);
1448 KeyLocs.push_back(selLoc);
1451 allParamAttrs.takeAllFrom(paramAttrs.
getPool());
1454 if (Tok.
is(tok::code_completion)) {
1456 mType == tok::minus,
1458 ReturnType, KeyIdents);
1464 SelIdent = ParseObjCSelectorPiece(selLoc);
1465 if (!SelIdent && Tok.
isNot(tok::colon))
1470 Diag(ArgInfo.
NameLoc, diag::warn_missing_selector_name) << ArgInfo.
Name;
1471 Diag(ArgInfo.
NameLoc, diag::note_missing_selector_name) << ArgInfo.
Name;
1472 Diag(ColonLoc, diag::note_force_empty_selector_name) << ArgInfo.
Name;
1478 bool isVariadic =
false;
1479 bool cStyleParamWarned =
false;
1481 while (Tok.
is(tok::comma)) {
1483 if (Tok.
is(tok::ellipsis)) {
1488 if (!cStyleParamWarned) {
1489 Diag(Tok, diag::warn_cstyle_param);
1490 cStyleParamWarned =
true;
1493 ParseDeclarationSpecifiers(DS);
1496 ParseDeclarator(ParmDecl);
1500 ParmDecl.getIdentifierLoc(),
1508 MaybeParseGNUAttributes(methodAttrs);
1510 if (KeyIdents.size() == 0)
1517 mType, DSRet, ReturnType,
1518 KeyLocs, Sel, &ArgInfos[0],
1519 CParamInfo.data(), CParamInfo.size(),
1520 methodAttrs.getList(),
1521 MethodImplKind, isVariadic, MethodDefinition);
1523 PD.complete(Result);
1533 bool WarnOnDeclarations,
bool ForObjCContainer,
1535 bool consumeLastToken) {
1536 assert(Tok.
is(tok::less) &&
"expected <");
1543 if (Tok.
is(tok::code_completion)) {
1549 if (expectIdentifier()) {
1563 if (ParseGreaterThanInTemplateList(EndLoc, consumeLastToken,
1569 ProtocolIdents, Protocols);
1574 assert(Tok.
is(tok::less) &&
"Protocol qualifiers start with '<'");
1575 assert(
getLangOpts().ObjC1 &&
"Protocol qualifiers only exist in Objective-C");
1580 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
false,
false,
1581 lAngleLoc, rAngleLoc,
1588 Diag(lAngleLoc, diag::warn_objc_protocol_qualifier_missing_id)
1601 void Parser::parseObjCTypeArgsOrProtocolQualifiers(
1610 bool consumeLastToken,
1611 bool warnOnIncompleteProtocols) {
1612 assert(Tok.
is(tok::less) &&
"Not at the start of type args or protocols");
1617 bool allSingleIdentifiers =
true;
1625 if (Tok.
is(tok::identifier) &&
1634 if (Tok.
is(tok::code_completion)) {
1637 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1639 identifierLocs[i]));
1652 allSingleIdentifiers =
false;
1658 if (allSingleIdentifiers) {
1661 (void)ParseGreaterThanInTemplateList(rAngleLoc, consumeLastToken,
1677 warnOnIncompleteProtocols);
1687 bool invalid =
false;
1688 IdentifierInfo *foundProtocolId =
nullptr, *foundValidTypeId =
nullptr;
1693 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1698 const char *prevSpec =
nullptr;
1700 DS.SetTypeSpecType(
TST_typename, identifierLocs[i], prevSpec, diagID,
1707 typeArgs.push_back(fullTypeArg.
get());
1708 if (!foundValidTypeId) {
1709 foundValidTypeId = identifiers[i];
1710 foundValidTypeSrcLoc = identifierLocs[i];
1714 unknownTypeArgs.push_back(identifiers[i]);
1715 unknownTypeArgsLoc.push_back(identifierLocs[i]);
1719 if (!Actions.
LookupProtocol(identifiers[i], identifierLocs[i])) {
1720 unknownTypeArgs.push_back(identifiers[i]);
1721 unknownTypeArgsLoc.push_back(identifierLocs[i]);
1722 }
else if (!foundProtocolId) {
1723 foundProtocolId = identifiers[i];
1724 foundProtocolSrcLoc = identifierLocs[i];
1731 Token CurTypeTok = Tok;
1742 typeArgs.push_back(typeArg.
get());
1743 if (!foundValidTypeId) {
1753 if (foundProtocolId && foundValidTypeId)
1756 foundValidTypeSrcLoc);
1760 if (unknownTypeArgs.size())
1761 for (
unsigned i = 0, e = unknownTypeArgsLoc.size(); i < e; ++i)
1767 (void)ParseGreaterThanInTemplateList(rAngleLoc, consumeLastToken,
1776 typeArgsLAngleLoc = lAngleLoc;
1777 typeArgsRAngleLoc = rAngleLoc;
1780 void Parser::parseObjCTypeArgsAndProtocolQualifiers(
1789 bool consumeLastToken) {
1790 assert(Tok.
is(tok::less));
1793 parseObjCTypeArgsOrProtocolQualifiers(baseType,
1809 if ((consumeLastToken && Tok.
is(tok::less)) ||
1810 (!consumeLastToken &&
NextToken().
is(tok::less))) {
1813 if (!consumeLastToken)
1816 if (!protocols.empty()) {
1818 if (!consumeLastToken)
1820 Diag(Tok, diag::err_objc_type_args_after_protocols)
1821 <<
SourceRange(protocolLAngleLoc, protocolRAngleLoc);
1822 SkipUntil(tok::greater, tok::greatergreater, skipFlags);
1824 ParseObjCProtocolReferences(protocols, protocolLocs,
1827 protocolLAngleLoc, protocolRAngleLoc,
1833 TypeResult Parser::parseObjCTypeArgsAndProtocolQualifiers(
1836 bool consumeLastToken,
1838 assert(Tok.
is(tok::less));
1848 parseObjCTypeArgsAndProtocolQualifiers(type, typeArgsLAngleLoc, typeArgs,
1849 typeArgsRAngleLoc, protocolLAngleLoc,
1850 protocols, protocolLocs,
1851 protocolRAngleLoc, consumeLastToken);
1857 if (consumeLastToken)
1858 endLoc = PrevTokLocation;
1875 void Parser::HelperActionsForIvarDeclarations(Decl *interfaceDecl,
SourceLocation atLoc,
1878 bool RBraceMissing) {
1912 void Parser::ParseObjCClassInstanceVariables(Decl *interfaceDecl,
1915 assert(Tok.
is(tok::l_brace) &&
"expected {");
1924 while (Tok.
isNot(tok::r_brace) && !isEofOrEom()) {
1928 if (Tok.
is(tok::semi)) {
1929 ConsumeExtraSemi(InstanceVariableList);
1935 if (Tok.
is(tok::code_completion)) {
1937 return cutOffParsing();
1941 case tok::objc_private:
1942 case tok::objc_public:
1943 case tok::objc_protected:
1944 case tok::objc_package:
1950 Diag(Tok, diag::err_objc_unexpected_atend);
1955 HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
1956 T, AllIvarDecls,
true);
1960 Diag(Tok, diag::err_objc_illegal_visibility_spec);
1965 if (Tok.
is(tok::code_completion)) {
1968 return cutOffParsing();
1974 FD.D.setObjCIvar(
true);
1976 getCurScope(), FD.D.getDeclSpec().getSourceRange().getBegin(), FD.D,
1977 FD.BitfieldSize, visibility);
1980 AllIvarDecls.push_back(Field);
1986 ParseStructDeclaration(DS, ObjCIvarCallback);
1988 if (Tok.
is(tok::semi)) {
1991 Diag(Tok, diag::err_expected_semi_decl_list);
1996 HelperActionsForIvarDeclarations(interfaceDecl, atLoc,
1997 T, AllIvarDecls,
false);
2020 "ParseObjCAtProtocolDeclaration(): Expected @protocol");
2023 if (Tok.
is(tok::code_completion)) {
2029 MaybeSkipAttributes(tok::objc_protocol);
2031 if (expectIdentifier())
2043 CheckNestedObjCContexts(AtLoc);
2045 if (Tok.
is(tok::comma)) {
2047 ProtocolRefs.push_back(std::make_pair(protocolName, nameLoc));
2052 if (expectIdentifier()) {
2060 if (Tok.
isNot(tok::comma))
2064 if (ExpectAndConsume(tok::semi, diag::err_expected_after,
"@protocol"))
2076 if (Tok.
is(tok::less) &&
2077 ParseObjCProtocolReferences(ProtocolRefs, ProtocolLocs,
false,
true,
2078 LAngleLoc, EndProtoLoc,
2084 ProtocolRefs.data(),
2085 ProtocolRefs.size(),
2086 ProtocolLocs.data(),
2087 EndProtoLoc, attrs.
getList());
2089 ParseObjCInterfaceDeclList(tok::objc_protocol, ProtoType);
2104 Parser::ParseObjCAtImplementationDeclaration(
SourceLocation AtLoc) {
2106 "ParseObjCAtImplementationDeclaration(): Expected @implementation");
2107 CheckNestedObjCContexts(AtLoc);
2111 if (Tok.
is(tok::code_completion)) {
2117 MaybeSkipAttributes(tok::objc_implementation);
2119 if (expectIdentifier())
2124 Decl *ObjCImpDecl =
nullptr;
2128 if (Tok.
is(tok::less)) {
2132 ObjCTypeParamListScope typeParamScope(Actions,
getCurScope());
2133 if (parseObjCTypeParamListOrProtocolRefs(typeParamScope, lAngleLoc,
2134 protocolIdents, rAngleLoc)) {
2135 Diag(diagLoc, diag::err_objc_parameterized_implementation)
2137 }
else if (lAngleLoc.
isValid()) {
2138 Diag(lAngleLoc, diag::err_unexpected_protocol_qualifier)
2143 if (Tok.
is(tok::l_paren)) {
2149 if (Tok.
is(tok::code_completion)) {
2155 if (Tok.
is(tok::identifier)) {
2159 Diag(Tok, diag::err_expected)
2163 if (Tok.
isNot(tok::r_paren)) {
2164 Diag(Tok, diag::err_expected) << tok::r_paren;
2168 rparenLoc = ConsumeParen();
2169 if (Tok.
is(tok::less)) {
2170 Diag(Tok, diag::err_unexpected_protocol_qualifier);
2174 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
2177 protocolLAngleLoc, protocolRAngleLoc,
2181 AtLoc, nameId, nameLoc, categoryId,
2190 if (expectIdentifier())
2196 AtLoc, nameId, nameLoc,
2197 superClassId, superClassLoc);
2199 if (Tok.
is(tok::l_brace))
2200 ParseObjCClassInstanceVariables(ObjCImpDecl, tok::objc_private, AtLoc);
2201 else if (Tok.
is(tok::less)) {
2202 Diag(Tok, diag::err_unexpected_protocol_qualifier);
2207 (void)ParseObjCProtocolReferences(protocols, protocolLocs,
2210 protocolLAngleLoc, protocolRAngleLoc,
2214 assert(ObjCImpDecl);
2219 ObjCImplParsingDataRAII ObjCImplParsing(*
this, ObjCImpDecl);
2220 while (!ObjCImplParsing.isFinished() && !isEofOrEom()) {
2221 ParsedAttributesWithRange attrs(AttrFactory);
2222 MaybeParseCXX11Attributes(attrs);
2225 DeclsInGroup.append(DG.
begin(), DG.
end());
2234 Parser::ParseObjCAtEndDeclaration(
SourceRange atEnd) {
2236 "ParseObjCAtEndDeclaration(): Expected @end");
2238 if (CurParsedObjCImpl)
2239 CurParsedObjCImpl->finish(atEnd);
2242 Diag(atEnd.
getBegin(), diag::err_expected_objc_container);
2246 Parser::ObjCImplParsingDataRAII::~ObjCImplParsingDataRAII() {
2248 finish(
P.Tok.getLocation());
2249 if (
P.isEofOrEom()) {
2250 P.Diag(
P.Tok, diag::err_objc_missing_end)
2252 P.Diag(Dcl->getLocStart(), diag::note_objc_container_start)
2256 P.CurParsedObjCImpl =
nullptr;
2257 assert(LateParsedObjCMethods.empty());
2260 void Parser::ObjCImplParsingDataRAII::finish(
SourceRange AtEnd) {
2262 P.Actions.DefaultSynthesizeProperties(
P.getCurScope(), Dcl, AtEnd.
getBegin());
2263 for (
size_t i = 0; i < LateParsedObjCMethods.size(); ++i)
2264 P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
2267 P.Actions.ActOnAtEnd(
P.getCurScope(), AtEnd);
2270 for (
size_t i = 0; i < LateParsedObjCMethods.size(); ++i)
2271 P.ParseLexedObjCMethodDefs(*LateParsedObjCMethods[i],
2275 for (LateParsedObjCMethodContainer::iterator
2276 I = LateParsedObjCMethods.begin(),
2277 E = LateParsedObjCMethods.end();
I !=
E; ++
I)
2279 LateParsedObjCMethods.clear();
2287 Decl *Parser::ParseObjCAtAliasDeclaration(
SourceLocation atLoc) {
2289 "ParseObjCAtAliasDeclaration(): Expected @compatibility_alias");
2291 if (expectIdentifier())
2295 if (expectIdentifier())
2299 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@compatibility_alias");
2315 Decl *Parser::ParseObjCPropertySynthesize(
SourceLocation atLoc) {
2317 "ParseObjCPropertySynthesize(): Expected '@synthesize'");
2321 if (Tok.
is(tok::code_completion)) {
2327 if (Tok.
isNot(tok::identifier)) {
2328 Diag(Tok, diag::err_synthesized_property_name);
2339 if (Tok.
is(tok::code_completion)) {
2345 if (expectIdentifier())
2352 propertyId, propertyIvar, propertyIvarLoc,
2354 if (Tok.
isNot(tok::comma))
2358 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@synthesize");
2371 "ParseObjCPropertyDynamic(): Expected '@dynamic'");
2374 bool isClassProperty =
false;
2375 if (Tok.
is(tok::l_paren)) {
2380 Diag(Tok, diag::err_objc_expected_property_attr) << II;
2384 if (II->
isStr(
"class")) {
2385 isClassProperty =
true;
2386 if (Tok.
isNot(tok::r_paren)) {
2387 Diag(Tok, diag::err_expected) << tok::r_paren;
2392 Diag(AttrName, diag::err_objc_expected_property_attr) << II;
2399 if (Tok.
is(tok::code_completion)) {
2405 if (expectIdentifier()) {
2418 if (Tok.
isNot(tok::comma))
2422 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@dynamic");
2432 if (Tok.
isNot(tok::semi)) {
2440 ExpectAndConsume(tok::semi, diag::err_expected_after,
"@throw");
2450 if (Tok.
isNot(tok::l_paren)) {
2451 Diag(Tok, diag::err_expected_lparen_after) <<
"@synchronized";
2459 if (Tok.
is(tok::r_paren)) {
2462 if (!operand.isInvalid())
2463 Diag(Tok, diag::err_expected) << tok::r_paren;
2470 if (Tok.
isNot(tok::l_brace)) {
2471 if (!operand.isInvalid())
2472 Diag(Tok, diag::err_expected) << tok::l_brace;
2477 if (!operand.isInvalid())
2482 StmtResult body(ParseCompoundStatementBody());
2487 if (operand.isInvalid())
2490 if (body.isInvalid())
2508 bool catch_or_finally_seen =
false;
2511 if (Tok.
isNot(tok::l_brace)) {
2512 Diag(Tok, diag::err_expected) << tok::l_brace;
2515 StmtVector CatchStmts;
2518 StmtResult TryBody(ParseCompoundStatementBody());
2520 if (TryBody.isInvalid())
2523 while (Tok.
is(tok::at)) {
2527 Token AfterAt = GetLookAheadToken(1);
2534 Decl *FirstPart =
nullptr;
2536 if (Tok.
is(tok::l_paren)) {
2539 if (Tok.
isNot(tok::ellipsis)) {
2541 ParseDeclarationSpecifiers(DS);
2543 ParseDeclarator(ParmDecl);
2553 if (Tok.
is(tok::r_paren))
2554 RParenLoc = ConsumeParen();
2559 if (Tok.
is(tok::l_brace))
2560 CatchBody = ParseCompoundStatementBody();
2562 Diag(Tok, diag::err_expected) << tok::l_brace;
2563 if (CatchBody.isInvalid())
2570 if (!Catch.isInvalid())
2571 CatchStmts.push_back(Catch.get());
2574 Diag(AtCatchFinallyLoc, diag::err_expected_lparen_after)
2578 catch_or_finally_seen =
true;
2580 assert(Tok.
isObjCAtKeyword(tok::objc_finally) &&
"Lookahead confused?");
2585 if (Tok.
is(tok::l_brace))
2586 FinallyBody = ParseCompoundStatementBody();
2588 Diag(Tok, diag::err_expected) << tok::l_brace;
2589 if (FinallyBody.isInvalid())
2593 catch_or_finally_seen =
true;
2597 if (!catch_or_finally_seen) {
2598 Diag(atLoc, diag::err_missing_catch_finally);
2613 if (Tok.
isNot(tok::l_brace)) {
2614 Diag(Tok, diag::err_expected) << tok::l_brace;
2621 StmtResult AutoreleasePoolBody(ParseCompoundStatementBody());
2624 if (AutoreleasePoolBody.isInvalid())
2627 AutoreleasePoolBody.get());
2632 void Parser::StashAwayMethodOrFunctionBodyTokens(Decl *MDecl) {
2634 trySkippingFunctionBody()) {
2639 LexedMethod* LM =
new LexedMethod(
this, MDecl);
2640 CurParsedObjCImpl->LateParsedObjCMethods.push_back(LM);
2643 Toks.push_back(Tok);
2644 if (Tok.
is(tok::kw_try)) {
2646 if (Tok.
is(tok::colon)) {
2647 Toks.push_back(Tok);
2649 while (Tok.
isNot(tok::l_brace)) {
2650 ConsumeAndStoreUntil(tok::l_paren, Toks,
false);
2651 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
2654 Toks.push_back(Tok);
2656 else if (Tok.
is(tok::colon)) {
2659 while (Tok.
isNot(tok::l_brace)) {
2660 ConsumeAndStoreUntil(tok::l_paren, Toks,
false);
2661 ConsumeAndStoreUntil(tok::r_paren, Toks,
false);
2663 Toks.push_back(Tok);
2667 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
2668 while (Tok.
is(tok::kw_catch)) {
2669 ConsumeAndStoreUntil(tok::l_brace, Toks,
false);
2670 ConsumeAndStoreUntil(tok::r_brace, Toks,
false);
2676 Decl *Parser::ParseObjCMethodDefinition() {
2677 Decl *MDecl = ParseObjCMethodPrototype();
2680 "parsing Objective-C method");
2683 if (Tok.
is(tok::semi)) {
2684 if (CurParsedObjCImpl) {
2685 Diag(Tok, diag::warn_semicolon_before_method_body)
2692 if (Tok.
isNot(tok::l_brace)) {
2693 Diag(Tok, diag::err_expected_method_body);
2699 if (Tok.
isNot(tok::l_brace))
2711 assert (CurParsedObjCImpl
2712 &&
"ParseObjCMethodDefinition - Method out of @implementation");
2714 StashAwayMethodOrFunctionBodyTokens(MDecl);
2719 if (Tok.
is(tok::code_completion)) {
2726 return ParseObjCTryStmt(AtLoc);
2729 return ParseObjCThrowStmt(AtLoc);
2732 return ParseObjCSynchronizedStmt(AtLoc);
2735 return ParseObjCAutoreleasePoolStmt(AtLoc);
2743 ExprStatementTokLoc = AtLoc;
2744 ExprResult Res(ParseExpressionWithLeadingAt(AtLoc));
2754 ExpectAndConsumeSemi(diag::err_expected_semi_after_expr);
2760 case tok::code_completion:
2770 if (!Tok.
is(tok::numeric_constant)) {
2771 const char *Symbol =
nullptr;
2773 case tok::minus: Symbol =
"-";
break;
2774 case tok::plus: Symbol =
"+";
break;
2775 default: llvm_unreachable(
"missing unary operator case");
2777 Diag(Tok, diag::err_nsnumber_nonliteral_unary)
2783 if (Lit.isInvalid()) {
2789 if (Lit.isInvalid())
2792 return ParsePostfixExpressionSuffix(
2796 case tok::string_literal:
2797 case tok::wide_string_literal:
2798 return ParsePostfixExpressionSuffix(ParseObjCStringLiteral(AtLoc));
2800 case tok::char_constant:
2801 return ParsePostfixExpressionSuffix(ParseObjCCharacterLiteral(AtLoc));
2803 case tok::numeric_constant:
2804 return ParsePostfixExpressionSuffix(ParseObjCNumericLiteral(AtLoc));
2807 case tok::kw___objc_yes:
2808 return ParsePostfixExpressionSuffix(ParseObjCBooleanLiteral(AtLoc,
true));
2810 case tok::kw___objc_no:
2811 return ParsePostfixExpressionSuffix(ParseObjCBooleanLiteral(AtLoc,
false));
2815 return ParsePostfixExpressionSuffix(ParseObjCArrayLiteral(AtLoc));
2819 return ParsePostfixExpressionSuffix(ParseObjCDictionaryLiteral(AtLoc));
2823 return ParsePostfixExpressionSuffix(ParseObjCBoxedExpr(AtLoc));
2830 case tok::objc_encode:
2831 return ParsePostfixExpressionSuffix(ParseObjCEncodeExpression(AtLoc));
2832 case tok::objc_protocol:
2833 return ParsePostfixExpressionSuffix(ParseObjCProtocolExpression(AtLoc));
2834 case tok::objc_selector:
2835 return ParsePostfixExpressionSuffix(ParseObjCSelectorExpression(AtLoc));
2836 case tok::objc_available:
2837 return ParseAvailabilityCheckExpr(AtLoc);
2839 const char *str =
nullptr;
2843 if (GetLookAheadToken(1).is(tok::l_brace) &&
2844 ExprStatementTokLoc == AtLoc) {
2848 : (ch ==
'f' ?
"finally"
2849 : (ch ==
'a' ?
"autoreleasepool" :
nullptr));
2885 bool Parser::ParseObjCXXMessageReceiver(
bool &IsExpr,
void *&TypeOrExpr) {
2888 if (Tok.
isOneOf(tok::identifier, tok::coloncolon, tok::kw_typename,
2889 tok::annot_cxxscope))
2903 TypeOrExpr = Receiver.
get();
2912 ParseCXXSimpleTypeSpecifier(DS);
2914 if (Tok.
is(tok::l_paren)) {
2927 ExprResult Receiver = ParseCXXTypeConstructExpression(DS);
2929 Receiver = ParsePostfixExpressionSuffix(Receiver.
get());
2931 Receiver = ParseRHSOfBinaryExpression(Receiver.
get(),
prec::Comma);
2936 TypeOrExpr = Receiver.
get();
2949 TypeOrExpr = Type.
get().getAsOpaquePtr();
2958 bool Parser::isSimpleObjCMessageExpression() {
2960 "Incorrect start for isSimpleObjCMessageExpression");
2961 return GetLookAheadToken(1).
is(tok::identifier) &&
2962 GetLookAheadToken(2).
is(tok::identifier);
2965 bool Parser::isStartOfObjCClassMessageMissingOpenBracket() {
2967 InMessageExpression)
2972 if (Tok.
is(tok::annot_typename))
2974 else if (Tok.
is(tok::identifier))
2980 if (!Type.
get().isNull() && Type.
get()->isObjCObjectOrInterfaceType()) {
2981 const Token &AfterNext = GetLookAheadToken(2);
2982 if (AfterNext.
isOneOf(tok::colon, tok::r_square)) {
2983 if (Tok.
is(tok::identifier))
2986 return Tok.
is(tok::annot_typename);
3002 ExprResult Parser::ParseObjCMessageExpression() {
3003 assert(Tok.
is(tok::l_square) &&
"'[' expected");
3006 if (Tok.
is(tok::code_completion)) {
3023 return ParseObjCMessageExpressionBody(LBracLoc,
ConsumeToken(),
nullptr,
3028 void *TypeOrExpr =
nullptr;
3029 if (ParseObjCXXMessageReceiver(IsExpr, TypeOrExpr)) {
3035 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
nullptr,
3036 static_cast<Expr *>(TypeOrExpr));
3038 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
3043 if (Tok.
is(tok::identifier)) {
3048 Name == Ident_super,
3052 return ParseObjCMessageExpressionBody(LBracLoc,
ConsumeToken(),
nullptr,
3056 if (!ReceiverType) {
3064 if (Tok.
is(tok::less)) {
3067 = parseObjCTypeArgsAndProtocolQualifiers(NameLoc, ReceiverType,
3075 ReceiverType = NewReceiverType.
get();
3078 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
3079 ReceiverType,
nullptr);
3094 return ParseObjCMessageExpressionBody(LBracLoc,
SourceLocation(),
nullptr,
3140 Expr *ReceiverExpr) {
3143 if (Tok.
is(tok::code_completion)) {
3147 else if (ReceiverType)
3163 ExprVector KeyExprs;
3165 if (Tok.
is(tok::colon)) {
3168 KeyIdents.push_back(selIdent);
3169 KeyLocs.push_back(Loc);
3171 if (ExpectAndConsume(tok::colon)) {
3181 if (Tok.
is(tok::code_completion)) {
3186 else if (ReceiverType)
3201 Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
3202 Expr = ParseBraceInitializer();
3216 KeyExprs.push_back(Res.
get());
3219 if (Tok.
is(tok::code_completion)) {
3224 else if (ReceiverType)
3237 selIdent = ParseObjCSelectorPiece(Loc);
3238 if (!selIdent && Tok.
isNot(tok::colon))
3243 while (Tok.
is(tok::comma)) {
3247 if (Tok.
is(tok::colon))
3250 if (Tok.
is(tok::colon)) {
3251 Diag(commaLoc, diag::note_extra_comma_message_arg) <<
3262 KeyExprs.push_back(Res.
get());
3264 }
else if (!selIdent) {
3265 Diag(Tok, diag::err_expected) << tok::identifier;
3274 if (Tok.
isNot(tok::r_square)) {
3275 Diag(Tok, diag::err_expected)
3276 << (Tok.
is(tok::identifier) ? tok::colon : tok::r_square);
3286 unsigned nKeys = KeyIdents.size();
3288 KeyIdents.push_back(selIdent);
3289 KeyLocs.push_back(Loc);
3295 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3296 else if (ReceiverType)
3298 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3300 LBracLoc, KeyLocs, RBracLoc, KeyExprs);
3304 ExprResult Res(ParseStringLiteralExpression());
3311 ExprVector AtStrings;
3312 AtLocs.push_back(AtLoc);
3313 AtStrings.push_back(Res.
get());
3315 while (Tok.
is(tok::at)) {
3319 if (!isTokenStringLiteral())
3322 ExprResult Lit(ParseStringLiteralExpression());
3323 if (Lit.isInvalid())
3326 AtStrings.push_back(Lit.get());
3348 if (Lit.isInvalid()) {
3362 if (Lit.isInvalid()) {
3374 if (Tok.
isNot(tok::l_paren))
3375 return ExprError(
Diag(Tok, diag::err_expected_lparen_after) <<
"@");
3383 if (ValueExpr.isInvalid())
3389 ValueExpr = Actions.
ActOnParenExpr(LPLoc, RPLoc, ValueExpr.get());
3395 ExprVector ElementExprs;
3398 bool HasInvalidEltExpr =
false;
3399 while (Tok.
isNot(tok::r_square)) {
3412 HasInvalidEltExpr =
true;
3415 if (Tok.
is(tok::ellipsis))
3418 HasInvalidEltExpr =
true;
3420 ElementExprs.push_back(Res.
get());
3422 if (Tok.
is(tok::comma))
3424 else if (Tok.
isNot(tok::r_square))
3425 return ExprError(
Diag(Tok, diag::err_expected_either) << tok::r_square
3430 if (HasInvalidEltExpr)
3440 bool HasInvalidEltExpr =
false;
3441 while (Tok.
isNot(tok::r_brace)) {
3456 if (ExpectAndConsume(tok::colon)) {
3462 if (ValueExpr.isInvalid()) {
3473 if (KeyExpr.
isInvalid() || ValueExpr.isInvalid())
3474 HasInvalidEltExpr =
true;
3486 KeyExpr.
get(), ValueExpr.get(), EllipsisLoc,
None
3488 Elements.push_back(Element);
3491 return ExprError(
Diag(Tok, diag::err_expected_either) << tok::r_brace
3496 if (HasInvalidEltExpr)
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 (expectIdentifier())
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!");
3639 Eof.setEofData(MCDecl);
3640 Eof.setLocation(OrigLoc);
3641 LM.Toks.push_back(Eof);
3644 LM.Toks.push_back(Tok);
3645 PP.EnterTokenStream(LM.Toks,
true);
3648 ConsumeAnyToken(
true);
3650 assert(Tok.
isOneOf(tok::l_brace, tok::kw_try, tok::colon) &&
3651 "Inline objective-c method not starting with '{' or 'try' or ':'");
3653 ParseScope BodyScope(
this,
3664 if (Tok.
is(tok::kw_try))
3665 ParseFunctionTryBlock(MCDecl, BodyScope);
3667 if (Tok.
is(tok::colon))
3668 ParseConstructorInitializer(MCDecl);
3671 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)
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...
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type...
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)
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)
static ParsedType getTypeAnnotation(const Token &Tok)
getTypeAnnotation - Read a parsed type out of an annotation token.
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 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)
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool IsTemplateName=false)
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)
void setSetterName(IdentifierInfo *name, SourceLocation loc)
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)
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.
SourceLocation getLocStart() const LLVM_READONLY
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.
bool TryAnnotateTypeOrScopeToken()
TryAnnotateTypeOrScopeToken - If the current token position is on a typename (possibly qualified in C...
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
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)
Decl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, AttributeList *AttrList)
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)
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
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)
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.
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...
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)
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 setGetterName(IdentifierInfo *name, SourceLocation loc)
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()
void startToken()
Reset all flags to cleared.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
AttributeList - Represents a syntactic attribute.
Stop skipping at specified token, but don't skip the token itself.
IdentifierInfo * getIdentifierInfo() const
const AttributeList * getAttributes() const