27#include "llvm/ADT/SmallString.h"
28#include "llvm/ADT/SmallVector.h"
29#include "llvm/Support/Casting.h"
30#include "llvm/Support/ErrorHandling.h"
31#include "llvm/Support/raw_ostream.h"
47 if (Elts == 0)
return;
49 List =
new (Ctx)
void*[Elts];
61 set(InList, Elts, Ctx);
75void ObjCContainerDecl::anchor() {}
83 Ivar != IvarEnd; ++Ivar) {
84 if (
auto *ivar = dyn_cast<ObjCIvarDecl>(*Ivar))
93 bool AllowHidden)
const {
96 if (
const auto *Proto = dyn_cast<ObjCProtocolDecl>(
this)) {
98 if (!Def->isUnconditionallyVisible() && !AllowHidden)
111 Meth != MethEnd; ++Meth) {
112 auto *MD = dyn_cast<ObjCMethodDecl>(*Meth);
113 if (MD && MD->isInstanceMethod() == isInstance)
129 Meth != MethEnd; ++Meth) {
130 auto *MD = dyn_cast<ObjCMethodDecl>(*Meth);
131 if (MD && MD->isInstanceMethod() && !MD->isImplicit())
135 if (
const auto *ID = dyn_cast<ObjCInterfaceDecl>(
this)) {
138 for (
const auto *Cat : ID->visible_categories()) {
140 if (!MD->isImplicit())
142 if (Cat->IsClassExtension())
148 for (
const auto *
P : Cat->properties())
149 if (
P->getIdentifier() ==
Property->getIdentifier()) {
150 if (
P->getPropertyAttributes() &
158 for (
const auto *Proto : ID->all_referenced_protocols())
159 if (Proto->HasUserDeclaredSetterMethod(
Property))
170 if (
const auto *PD = dyn_cast<ObjCProtocolDecl>(
this))
171 for (
const auto *PI : PD->protocols())
172 if (PI->HasUserDeclaredSetterMethod(
Property))
183 if (
const auto *Proto = dyn_cast<ObjCProtocolDecl>(DC)) {
185 if (!Def->isUnconditionallyVisible())
191 if (
auto *IDecl = dyn_cast<ObjCInterfaceDecl>(DC)) {
192 for (
const auto *Ext : IDecl->visible_extensions())
203 if (
auto *PD = dyn_cast<ObjCPropertyDecl>(*I)) {
207 !PD->isClassProperty()) ||
209 PD->isClassProperty()) ||
211 !PD->isClassProperty()))
214 if (PD->isClassProperty())
229 llvm::raw_svector_ostream os(ivarName);
236 bool IsInstance)
const {
238 if (
auto *Prop = dyn_cast<ObjCPropertyDecl>(
LookupResult)) {
239 if (Prop->isInstanceProperty() == IsInstance) {
253 if (
const auto *Proto = dyn_cast<ObjCProtocolDecl>(
this)) {
255 if (!Def->isUnconditionallyVisible())
261 if (
const auto *ClassDecl = dyn_cast<ObjCInterfaceDecl>(
this)) {
262 for (
const auto *Ext : ClassDecl->visible_extensions()) {
263 if (
auto *
P = Ext->FindPropertyDeclaration(PropertyId, QueryKind))
276 case Decl::ObjCProtocol: {
277 const auto *PID = cast<ObjCProtocolDecl>(
this);
278 for (
const auto *I : PID->protocols())
284 case Decl::ObjCInterface: {
285 const auto *OID = cast<ObjCInterfaceDecl>(
this);
287 for (
const auto *Cat : OID->visible_categories()) {
288 if (!Cat->IsClassExtension())
290 PropertyId, QueryKind))
295 for (
const auto *I : OID->all_referenced_protocols())
302 return superClass->FindPropertyDeclaration(PropertyId, QueryKind);
305 case Decl::ObjCCategory: {
306 const auto *OCD = cast<ObjCCategoryDecl>(
this);
308 if (!OCD->IsClassExtension())
309 for (
const auto *I : OCD->protocols())
319void ObjCInterfaceDecl::anchor() {}
328 return def->getTypeParamListAsWritten();
347 for (
auto *typeParam : *TypeParamList)
348 typeParam->setDeclContext(
this);
356 if (data().ExternallyCompleted)
357 LoadExternalDefinition();
373 return superTInfo->getTypeLoc().getBeginLoc();
389 if (data().ExternallyCompleted)
390 LoadExternalDefinition();
408 PM[std::make_pair(Prop->getIdentifier(), Prop->isClassProperty())] = Prop;
413 PM[std::make_pair(Prop->getIdentifier(), Prop->isClassProperty())] = Prop;
426 if (
Class->hasAttr<ArcWeakrefUnavailableAttr>())
436 if (
Class->hasAttr<ObjCRequiresPropertyDefsAttr>())
446 if (data().ExternallyCompleted)
447 LoadExternalDefinition();
449 if (data().AllReferencedProtocols.empty() &&
450 data().ReferencedProtocols.empty()) {
451 data().AllReferencedProtocols.set(ExtList, ExtNum,
C);
459 for (
unsigned i = 0; i < ExtNum; i++) {
460 bool protocolExists =
false;
463 if (
C.ProtocolCompatibleWithProtocol(ProtoInExtension, Proto)) {
464 protocolExists =
true;
471 ProtocolRefs.push_back(ProtoInExtension);
474 if (ProtocolRefs.empty())
481 data().AllReferencedProtocols.set(ProtocolRefs.data(), ProtocolRefs.size(),
C);
485ObjCInterfaceDecl::findInterfaceWithDesignatedInitializers()
const {
490 if (!IFace->inheritsDesignatedInitializers())
499 if (MD->getMethodFamily() ==
OMF_init && !MD->isOverriding())
503 for (
const auto *MD : Ext->instance_methods()) {
504 if (MD->getMethodFamily() ==
OMF_init && !MD->isOverriding())
509 for (
const auto *MD : ImplD->instance_methods()) {
510 if (MD->getMethodFamily() ==
OMF_init && !MD->isOverriding())
517bool ObjCInterfaceDecl::inheritsDesignatedInitializers()
const {
518 switch (data().InheritedDesignatedInitializers) {
519 case DefinitionData::IDI_Inherited:
521 case DefinitionData::IDI_NotInherited:
523 case DefinitionData::IDI_Unknown:
528 data().InheritedDesignatedInitializers = DefinitionData::IDI_NotInherited;
531 data().InheritedDesignatedInitializers =
532 SuperD->declaresOrInheritsDesignatedInitializers() ?
533 DefinitionData::IDI_Inherited :
534 DefinitionData::IDI_NotInherited;
536 data().InheritedDesignatedInitializers =
537 DefinitionData::IDI_NotInherited;
540 assert(data().InheritedDesignatedInitializers
541 != DefinitionData::IDI_Unknown);
542 return data().InheritedDesignatedInitializers ==
543 DefinitionData::IDI_Inherited;
546 llvm_unreachable(
"unexpected InheritedDesignatedInitializers value");
554 if (data().ExternallyCompleted)
555 LoadExternalDefinition();
562 if (MD->isThisDeclarationADesignatedInitializer())
563 Methods.push_back(MD);
565 for (
const auto *MD : Ext->instance_methods())
566 if (MD->isThisDeclarationADesignatedInitializer())
567 Methods.push_back(MD);
579 HasCompleteDef =
true;
585 if (data().ExternallyCompleted)
586 LoadExternalDefinition();
593 if (MD->isThisDeclarationADesignatedInitializer()) {
601 if (MD->isThisDeclarationADesignatedInitializer()) {
611void ObjCInterfaceDecl::allocateDefinitionData() {
612 assert(!
hasDefinition() &&
"ObjC class already has a definition");
614 Data.getPointer()->Definition =
this;
618 allocateDefinitionData();
628 Data.setPointer(
nullptr);
629 allocateDefinitionData();
644 if (data().ExternallyCompleted)
645 LoadExternalDefinition();
648 while (ClassDecl !=
nullptr) {
650 clsDeclared = ClassDecl;
656 clsDeclared = ClassDecl;
675 if (data().ExternallyCompleted)
676 LoadExternalDefinition();
679 while (ClassDecl !=
nullptr) {
690 if (
P->lookupProtocolNamed(Name))
702 bool shallowCategoryLookup,
713 if (data().ExternallyCompleted)
714 LoadExternalDefinition();
718 if ((MethodDecl = ClassDecl->
getMethod(Sel, isInstance)))
723 if ((MethodDecl = Cat->getMethod(Sel, isInstance)))
728 for (
const auto *I : ClassDecl->
protocols())
729 if ((MethodDecl = I->lookupMethod(Sel, isInstance)))
733 if (!shallowCategoryLookup)
737 Cat->getReferencedProtocols();
738 for (
auto *Protocol : Protocols)
739 if ((MethodDecl = Protocol->lookupMethod(Sel, isInstance)))
759 bool Instance)
const {
764 if (data().ExternallyCompleted)
765 LoadExternalDefinition();
769 Method = Instance ? ImpDecl->getInstanceMethod(Sel)
770 : ImpDecl->getClassMethod(Sel);
793 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
797 return data().ODRHash;
805 return data().ODRHash;
808bool ObjCInterfaceDecl::hasODRHash()
const {
811 return data().HasODRHash;
814void ObjCInterfaceDecl::setHasODRHash(
bool HasHash) {
815 assert(
hasDefinition() &&
"Cannot set ODRHash without definition");
816 data().HasODRHash = HasHash;
823ObjCMethodDecl::ObjCMethodDecl(
826 bool isInstance,
bool isVariadic,
bool isPropertyAccessor,
827 bool isSynthesizedAccessorStub,
bool isImplicitlyDeclared,
bool isDefined,
829 :
NamedDecl(ObjCMethod, contextDecl, beginLoc, SelInfo),
830 DeclContext(ObjCMethod), MethodDeclType(T), ReturnTInfo(ReturnTInfo),
836 setInstanceMethod(isInstance);
837 setVariadic(isVariadic);
838 setPropertyAccessor(isPropertyAccessor);
839 setSynthesizedAccessorStub(isSynthesizedAccessorStub);
840 setDefined(isDefined);
841 setIsRedeclaration(
false);
842 setHasRedeclaration(
false);
843 setDeclImplementation(impControl);
845 setRelatedResultType(HasRelatedResultType);
847 setOverriding(
false);
848 setHasSkippedBody(
false);
856 DeclContext *contextDecl,
bool isInstance,
bool isVariadic,
857 bool isPropertyAccessor,
bool isSynthesizedAccessorStub,
858 bool isImplicitlyDeclared,
bool isDefined,
861 beginLoc, endLoc, SelInfo, T, ReturnTInfo, contextDecl, isInstance,
863 isImplicitlyDeclared,
isDefined, impControl, HasRelatedResultType);
872 return hasAttr<ObjCDirectAttr>() &&
878 hasAttr<ObjCDesignatedInitializerAttr>();
882 if (
const auto *PD = dyn_cast<const ObjCProtocolDecl>(
getDeclContext()))
884 if (
const auto *ID = dyn_cast<const ObjCInterfaceDecl>(
getDeclContext()))
894 if (isa<ObjCProtocolDecl>(DC))
897 return ID->isDesignatedInitializer(
getSelector(), InitMethod);
903 if (param->isDestroyedInCallee())
920void ObjCMethodDecl::setParamsAndSelLocs(
ASTContext &
C,
923 ParamsAndSelLocs =
nullptr;
924 NumParams = Params.size();
925 if (Params.empty() && SelLocs.empty())
929 "Alignment not sufficient for SourceLocation");
931 unsigned Size =
sizeof(
ParmVarDecl *) * NumParams +
933 ParamsAndSelLocs =
C.Allocate(Size);
934 std::uninitialized_copy(Params.begin(), Params.end(), getParams());
935 std::uninitialized_copy(SelLocs.begin(), SelLocs.end(), getStoredSelLocs());
948 "No selector locs for non-implicit method");
950 return setParamsAndSelLocs(
C, Params, std::nullopt);
955 return setParamsAndSelLocs(
C, Params, std::nullopt);
957 setParamsAndSelLocs(
C, Params, SelLocs);
973 if (!CtxD->isInvalidDecl()) {
974 if (
auto *IFD = dyn_cast<ObjCInterfaceDecl>(CtxD)) {
976 if (!ImplD->isInvalidDecl())
979 }
else if (
auto *CD = dyn_cast<ObjCCategoryDecl>(CtxD)) {
981 if (!ImplD->isInvalidDecl())
984 }
else if (
auto *ImplD = dyn_cast<ObjCImplementationDecl>(CtxD)) {
986 if (!IFD->isInvalidDecl())
989 }
else if (
auto *CImplD = dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
991 if (!CatD->isInvalidDecl())
999 if (Redecl && cast<Decl>(Redecl->
getDeclContext())->isInvalidDecl())
1004 return cast<ObjCContainerDecl>(CtxD)->getMethod(
getSelector(),
1009 return Redecl ? Redecl :
this;
1016 if (
auto *ImplD = dyn_cast<ObjCImplementationDecl>(CtxD)) {
1026 for (
auto *Ext : IFD->known_extensions())
1030 }
else if (
auto *CImplD = dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
1041 return MD ? MD :
this;
1049 return Body->getEndLoc();
1059 if (
const ObjCMethodFamilyAttr *
attr = getAttr<ObjCMethodFamilyAttr>()) {
1062 switch (
attr->getFamily()) {
1063 case ObjCMethodFamilyAttr::OMF_None: family =
OMF_None;
break;
1064 case ObjCMethodFamilyAttr::OMF_alloc: family =
OMF_alloc;
break;
1065 case ObjCMethodFamilyAttr::OMF_copy: family =
OMF_copy;
break;
1066 case ObjCMethodFamilyAttr::OMF_init: family =
OMF_init;
break;
1067 case ObjCMethodFamilyAttr::OMF_mutableCopy: family =
OMF_mutableCopy;
break;
1068 case ObjCMethodFamilyAttr::OMF_new: family =
OMF_new;
break;
1117 if (noParams < 1 || noParams > 3)
1126 while (--noParams) {
1147 bool &selfIsPseudoStrong,
1148 bool &selfIsConsumed)
const {
1150 selfIsPseudoStrong =
false;
1151 selfIsConsumed =
false;
1166 selfIsConsumed = hasAttr<NSConsumesSelfAttr>();
1177 selfIsPseudoStrong =
true;
1184 selfIsPseudoStrong =
true;
1192 bool selfIsPseudoStrong, selfIsConsumed;
1194 getSelfType(Context, OID, selfIsPseudoStrong, selfIsConsumed);
1201 Self->addAttr(NSConsumedAttr::CreateImplicit(Context));
1203 if (selfIsPseudoStrong)
1204 Self->setARCPseudoStrong(
true);
1215 return CD->getClassInterface();
1217 return IMD->getClassInterface();
1220 llvm_unreachable(
"unknown method context");
1226 if (
auto *IMD = dyn_cast<ObjCCategoryImplDecl>(
getDeclContext()))
1227 return IMD->getCategoryDecl();
1234 return TSI->getTypeLoc().getSourceRange();
1255 bool MovedToSuper) {
1262 if (
const auto *
Category = dyn_cast<ObjCCategoryDecl>(Container)) {
1267 Overridden = Container->getMethod(Method->
getSelector(),
1270 if (Method != Overridden) {
1273 Methods.push_back(Overridden);
1277 for (
const auto *
P :
Category->protocols())
1284 Overridden = Container->getMethod(Method->
getSelector(),
1287 if (Method != Overridden) {
1290 Methods.push_back(Overridden);
1294 if (
const auto *Protocol = dyn_cast<ObjCProtocolDecl>(Container)){
1295 for (
const auto *
P : Protocol->protocols())
1299 if (
const auto *
Interface = dyn_cast<ObjCInterfaceDecl>(Container)) {
1303 for (
const auto *Cat :
Interface->known_categories())
1323 if (
const auto *ProtD =
1327 }
else if (
const auto *IMD =
1340 }
else if (
const auto *CatD =
1356 Method, overridden);
1372 assert(!Overridden.empty() &&
1373 "ObjCMethodDecl's overriding bit is not as expected");
1385 const auto *Container = cast<ObjCContainerDecl>(
getParent());
1387 if (
auto *ImplDecl = dyn_cast<ObjCImplDecl>(Container))
1389 Container = ImplDecl->getClassInterface();
1391 bool IsGetter = (NumArgs == 0);
1396 auto findMatchingProperty =
1399 for (
const auto *I : Container->instance_properties()) {
1400 Selector NextSel = IsGetter ? I->getGetterName()
1401 : I->getSetterName();
1406 for (
const auto *I : Container->class_properties()) {
1407 Selector NextSel = IsGetter ? I->getGetterName()
1408 : I->getSetterName();
1418 if (
const auto *Found = findMatchingProperty(Container))
1423 if (
const auto *
Category = dyn_cast<ObjCCategoryDecl>(Container)) {
1424 ClassDecl =
Category->getClassInterface();
1425 if (
const auto *Found = findMatchingProperty(ClassDecl))
1429 ClassDecl = cast<ObjCInterfaceDecl>(Container);
1431 assert(ClassDecl &&
"Failed to find main class");
1435 if (Ext == Container)
1437 if (
const auto *Found = findMatchingProperty(Ext))
1444 if (Cat == Container)
1446 if (
const auto *Found = findMatchingProperty(Cat))
1450 llvm_unreachable(
"Marked as a property accessor but no property found!");
1453 if (!CheckOverrides)
1458 OverridesTy Overrides;
1460 for (
const auto *Override : Overrides)
1471void ObjCTypeParamDecl::anchor() {}
1483 nameLoc, name, colonLoc, boundInfo);
1516 : Brackets(lAngleLoc, rAngleLoc), NumParams(typeParams.size()) {
1517 std::copy(typeParams.begin(), typeParams.end(), begin());
1526 ctx.
Allocate(totalSizeToAlloc<ObjCTypeParamDecl *>(typeParams.size()),
1533 typeArgs.reserve(
size());
1534 for (
auto *typeParam : *
this)
1535 typeArgs.push_back(typeParam->getUnderlyingType());
1553 Result->Data.setInt(!
C.getLangOpts().Modules);
1554 C.getObjCInterfaceType(
Result, PrevDecl);
1563 Result->Data.setInt(!
C.getLangOpts().Modules);
1574 redeclarable_base(
C) {
1579 Data = PrevDecl->Data;
1586void ObjCInterfaceDecl::LoadExternalDefinition()
const {
1587 assert(data().ExternallyCompleted &&
"Class is not externally completed");
1588 data().ExternallyCompleted =
false;
1595 "Class can't be externally completed without an external source");
1597 "Forward declarations can't be externally completed");
1598 data().ExternallyCompleted =
true;
1605 data().HasDesignatedInitializers =
true;
1612 if (data().ExternallyCompleted)
1613 LoadExternalDefinition();
1615 return data().HasDesignatedInitializers;
1620 if (
const auto *ObjCRTName = getAttr<ObjCRuntimeNameAttr>())
1621 return ObjCRTName->getMetadataName();
1630 return ID->getObjCRuntimeNameAsString();
1637 if (data().ExternallyCompleted)
1638 LoadExternalDefinition();
1654struct SynthesizeIvarChunk {
1659 : Size(size), Ivar(ivar) {}
1662bool operator<(
const SynthesizeIvarChunk & LHS,
1663 const SynthesizeIvarChunk &RHS) {
1664 return LHS.Size < RHS.Size;
1684 if (!data().IvarList) {
1688 (void)Ext->ivar_empty();
1692 data().IvarList = *I; ++I;
1693 for (curIvar = data().IvarList; I != E; curIvar = *I, ++I)
1698 if (!Ext->ivar_empty()) {
1700 I = Ext->ivar_begin(),
1701 E = Ext->ivar_end();
1702 if (!data().IvarList) {
1703 data().IvarList = *I; ++I;
1704 curIvar = data().IvarList;
1706 for ( ;I != E; curIvar = *I, ++I)
1710 data().IvarListMissingImplementation =
true;
1714 if (!data().IvarListMissingImplementation)
1715 return data().IvarList;
1718 data().IvarListMissingImplementation =
false;
1719 if (!ImplDecl->ivar_empty()) {
1721 for (
auto *IV : ImplDecl->ivars()) {
1722 if (IV->getSynthesize() && !IV->isInvalidDecl()) {
1723 layout.push_back(SynthesizeIvarChunk(
1724 IV->getASTContext().getTypeSize(IV->getType()), IV));
1727 if (!data().IvarList)
1728 data().IvarList = IV;
1734 if (!layout.empty()) {
1736 llvm::stable_sort(layout);
1737 unsigned Ix = 0, EIx = layout.size();
1738 if (!data().IvarList) {
1739 data().IvarList = layout[0].Ivar; Ix++;
1740 curIvar = data().IvarList;
1742 for ( ; Ix != EIx; curIvar = layout[Ix].Ivar, Ix++)
1747 return data().IvarList;
1760 if (data().ExternallyCompleted)
1761 LoadExternalDefinition();
1764 if (Cat->getIdentifier() == CategoryId)
1795 bool lookupCategory,
1796 bool RHSIsQualifiedID) {
1803 if (
getASTContext().ProtocolCompatibleWithProtocol(lProto, PI))
1811 if (RHSIsQualifiedID &&
1819 for (
auto *PI : Cat->protocols())
1820 if (
getASTContext().ProtocolCompatibleWithProtocol(lProto, PI))
1837void ObjCIvarDecl::anchor() {}
1856 assert((isa<ObjCInterfaceDecl>(DC) || isa<ObjCImplementationDecl>(DC) ||
1857 isa<ObjCCategoryDecl>(DC)) &&
1858 "Invalid ivar decl context!");
1861 auto *ID = dyn_cast<ObjCInterfaceDecl>(DC);
1863 if (
auto *IM = dyn_cast<ObjCImplementationDecl>(DC))
1864 ID = IM->getClassInterface();
1866 ID = cast<ObjCCategoryDecl>(DC)->getClassInterface();
1868 ID->setIvarList(
nullptr);
1871 return new (
C, DC)
ObjCIvarDecl(DC, StartLoc, IdLoc,
Id, T, TInfo, ac, BW,
1884 switch (DC->getKind()) {
1886 case ObjCCategoryImpl:
1888 llvm_unreachable(
"invalid ivar container!");
1891 case ObjCCategory: {
1892 auto *CD = cast<ObjCCategoryDecl>(DC);
1893 assert(CD->IsClassExtension() &&
"invalid container for ivar!");
1894 return CD->getClassInterface();
1897 case ObjCImplementation:
1898 return cast<ObjCImplementationDecl>(DC)->getClassInterface();
1901 return cast<ObjCInterfaceDecl>(DC);
1914void ObjCAtDefsFieldDecl::anchor() {}
1934void ObjCProtocolDecl::anchor() {}
1941 redeclarable_base(
C) {
1942 setPreviousDecl(PrevDecl);
1944 Data = PrevDecl->Data;
1954 Result->Data.setInt(!
C.getLangOpts().Modules);
1963 Result->Data.setInt(!
C.getLangOpts().Modules);
1968 return hasAttr<ObjCNonRuntimeProtocolAttr>();
1973 std::queue<const ObjCProtocolDecl *> WorkQueue;
1974 WorkQueue.push(
this);
1976 while (!WorkQueue.empty()) {
1977 const auto *PD = WorkQueue.front();
1979 for (
const auto *
Parent : PD->protocols()) {
1980 const auto *Can =
Parent->getCanonicalDecl();
1981 auto Result = IPs.insert(Can);
2004 bool isInstance)
const {
2013 if ((MethodDecl =
getMethod(Sel, isInstance)))
2017 if ((MethodDecl = I->lookupMethod(Sel, isInstance)))
2022void ObjCProtocolDecl::allocateDefinitionData() {
2023 assert(!Data.getPointer() &&
"Protocol already has a definition!");
2025 Data.getPointer()->Definition =
this;
2026 Data.getPointer()->HasODRHash =
false;
2030 allocateDefinitionData();
2034 RD->Data = this->Data;
2038 Data.setPointer(
nullptr);
2039 allocateDefinitionData();
2050 for (
auto *Prop : PDecl->properties()) {
2052 PM.insert(std::make_pair(
2053 std::make_pair(Prop->getIdentifier(), Prop->isClassProperty()),
2057 for (
const auto *PI : PDecl->protocols())
2058 PI->collectPropertiesToImplement(PM);
2066 if (!PS.insert(PDecl).second)
2068 for (
auto *Prop : PDecl->properties()) {
2071 if (Prop->getIdentifier() ==
Property->getIdentifier()) {
2077 for (
const auto *PI : PDecl->protocols())
2078 PI->collectInheritedProtocolProperties(
Property, PS, PO);
2084 if (
const auto *ObjCRTName = getAttr<ObjCRuntimeNameAttr>())
2085 return ObjCRTName->getMetadataName();
2091 assert(
hasDefinition() &&
"ODRHash only for records with definitions");
2095 return data().ODRHash;
2101 setHasODRHash(
true);
2103 return data().ODRHash;
2106bool ObjCProtocolDecl::hasODRHash()
const {
2109 return data().HasODRHash;
2112void ObjCProtocolDecl::setHasODRHash(
bool HasHash) {
2113 assert(
hasDefinition() &&
"Cannot set ODRHash without definition");
2114 data().HasODRHash = HasHash;
2121void ObjCCategoryDecl::anchor() {}
2131 ClassInterface(IDecl), CategoryNameLoc(CategoryNameLoc),
2132 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc) {
2133 setTypeParamList(typeParamList);
2147 IDecl, typeParamList, IvarLBraceLoc,
2155 L->AddedObjCCategoryToInterface(CatDecl, IDecl);
2166 nullptr,
nullptr,
nullptr);
2179 TypeParamList = TPL;
2183 for (
auto *typeParam : *TypeParamList)
2184 typeParam->setDeclContext(
this);
2191void ObjCCategoryImplDecl::anchor() {}
2203 atStartLoc, CategoryNameLoc);
2220void ObjCImplDecl::anchor() {}
2224 property->setLexicalDeclContext(
this);
2231 if (
auto *ImplD = dyn_cast_or_null<ObjCImplementationDecl>(
this)) {
2235 }
else if (
auto *ImplD = dyn_cast_or_null<ObjCCategoryImplDecl>(
this)) {
2240 ClassInterface = IFace;
2249 if (PID->getPropertyIvarDecl() &&
2250 PID->getPropertyIvarDecl()->getIdentifier() == ivarId)
2265 if (PID->getPropertyDecl()->getIdentifier() ==
Id) {
2267 !PID->getPropertyDecl()->isClassProperty()) ||
2269 PID->getPropertyDecl()->isClassProperty()) ||
2271 !PID->getPropertyDecl()->isClassProperty()))
2274 if (PID->getPropertyDecl()->isClassProperty())
2275 ClassPropImpl = PID;
2280 return ClassPropImpl;
2295void ObjCImplementationDecl::anchor() {}
2309 nameLoc, atStartLoc, superLoc,
2310 IvarLBraceLoc, IvarRBraceLoc);
2321 unsigned numInitializers) {
2322 if (numInitializers > 0) {
2323 NumIvarInitializers = numInitializers;
2325 memcpy(ivarInitializers, initializers,
2327 IvarInitializers = ivarInitializers;
2346void ObjCCompatibleAliasDecl::anchor() {}
2366void ObjCPropertyDecl::anchor() {}
Defines the clang::ASTContext interface.
static void CollectOverriddenMethodsRecurse(const ObjCContainerDecl *Container, const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &Methods, bool MovedToSuper)
static bool isIntroducingInitializers(const ObjCInterfaceDecl *D)
static void collectOverriddenMethodsSlow(const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &overridden)
static void CollectOverriddenMethods(const ObjCContainerDecl *Container, const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &Methods)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
Defines the clang::SourceLocation class and associated facilities.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
QualType getObjCClassType() const
Represents the Objective-C Class type.
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
const LangOptions & getLangOpts() const
IdentifierInfo * getNSObjectName() const
Retrieve the identifier 'NSObject'.
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
QualType getObjCIdType() const
Represents the Objective-CC id type.
void * Allocate(size_t Size, unsigned Align=8) const
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl * > protocols) const
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or nullptr if none exists.
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Represents a C++ base or member initializer.
The results of name lookup within a DeclContext.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
ObjCMethodDeclBitfields ObjCMethodDeclBits
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void addDecl(Decl *D)
Add the declaration D into this context.
SourceLocation getEndLoc() const LLVM_READONLY
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Kind
Lists the kind of concrete classes of Decl.
SourceLocation getLocation() const
void setImplicit(bool I=true)
DeclContext * getDeclContext()
This represents one expression.
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, ImplicitParamKind ParamKind)
Create implicit parameter.
Represents the results of name lookup.
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
void AddObjCProtocolDecl(const ObjCProtocolDecl *P)
void AddObjCInterfaceDecl(const ObjCInterfaceDecl *Record)
Represents a field declaration created by an @defs(...).
static ObjCAtDefsFieldDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ObjCAtDefsFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, Expr *BW)
ObjCCategoryDecl - Represents a category declaration.
static ObjCCategoryDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this category.
static ObjCCategoryDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, IdentifierInfo *Id, ObjCInterfaceDecl *IDecl, ObjCTypeParamList *typeParamList, SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
ObjCCategoryImplDecl * getImplementation() const
void setImplementation(ObjCCategoryImplDecl *ImplD)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
static ObjCCategoryImplDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ObjCCategoryImplDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, ObjCInterfaceDecl *classInterface, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation CategoryNameLoc)
ObjCCategoryDecl * getCategoryDecl() const
ObjCCompatibleAliasDecl - Represents alias of a class.
static ObjCCompatibleAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, ObjCInterfaceDecl *aliasedClass)
static ObjCCompatibleAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ObjCContainerDecl - Represents a container for method declarations.
ObjCMethodDecl * getMethod(Selector Sel, bool isInstance, bool AllowHidden=false) const
void setAtStartLoc(SourceLocation Loc)
llvm::MapVector< std::pair< IdentifierInfo *, unsigned >, ObjCPropertyDecl * > PropertyMap
instmeth_range instance_methods() const
llvm::SmallDenseSet< const ObjCProtocolDecl *, 8 > ProtocolPropertySet
ObjCPropertyDecl * getProperty(const IdentifierInfo *Id, bool IsInstance) const
ObjCIvarDecl * getIvarDecl(IdentifierInfo *Id) const
getIvarDecl - This method looks up an ivar in this ContextDecl.
ObjCPropertyDecl * FindPropertyDeclaration(const IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const
FindPropertyDeclaration - Finds declaration of the property given its name in 'PropertyId' and return...
virtual void collectPropertiesToImplement(PropertyMap &PM) const
This routine collects list of properties to be implemented in the class.
prop_range properties() const
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
bool HasUserDeclaredSetterMethod(const ObjCPropertyDecl *P) const
This routine returns 'true' if a user declared setter method was found in the class,...
ObjCContainerDecl(Kind DK, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc)
void addPropertyImplementation(ObjCPropertyImplDecl *property)
propimpl_range property_impls() const
void setClassInterface(ObjCInterfaceDecl *IFace)
ObjCPropertyImplDecl * FindPropertyImplDecl(IdentifierInfo *propertyId, ObjCPropertyQueryKind queryKind) const
FindPropertyImplDecl - This method looks up a previous ObjCPropertyImplDecl added to the list of thos...
const ObjCInterfaceDecl * getClassInterface() const
ObjCPropertyImplDecl * FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const
FindPropertyImplIvarDecl - This method lookup the ivar in the list of properties implemented in this ...
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
static ObjCImplementationDecl * Create(ASTContext &C, DeclContext *DC, ObjCInterfaceDecl *classInterface, ObjCInterfaceDecl *superDecl, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation superLoc=SourceLocation(), SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
StringRef getName() const
getName - Get the name of identifier for the class interface associated with this implementation as a...
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
void setIvarInitializers(ASTContext &C, CXXCtorInitializer **initializers, unsigned numInitializers)
static ObjCImplementationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents an ObjC class declaration.
void mergeClassExtensionProtocolList(ObjCProtocolDecl *const *List, unsigned Num, ASTContext &C)
mergeClassExtensionProtocolList - Merge class extension's protocol list into the protocol list for th...
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
all_protocol_iterator all_referenced_protocol_end() const
ObjCInterfaceDecl * lookupInheritedClass(const IdentifierInfo *ICName)
lookupInheritedClass - This method returns ObjCInterfaceDecl * of the super class whose name is passe...
ivar_iterator ivar_end() const
ObjCMethodDecl * getCategoryMethod(Selector Sel, bool isInstance) const
ObjCPropertyDecl * FindPropertyVisibleInPrimaryClass(IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const
FindPropertyVisibleInPrimaryClass - Finds declaration of the property with name 'PropertyId' in the p...
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
static ObjCInterfaceDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
void setCategoryListRaw(ObjCCategoryDecl *category)
Set the raw pointer to the start of the category/extension list.
bool hasDefinition() const
Determine whether this class has been defined.
all_protocol_range all_referenced_protocols() const
visible_extensions_range visible_extensions() const
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class.
ObjCIvarDecl * all_declared_ivar_begin()
all_declared_ivar_begin - return first ivar declared in this class, its extensions and its implementa...
ivar_iterator ivar_begin() const
protocol_range protocols() const
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
Lookup an instance method for a given selector.
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
void setImplementation(ObjCImplementationDecl *ImplD)
known_categories_range known_categories() const
const ObjCInterfaceDecl * isObjCRequiresPropertyDefs() const
isObjCRequiresPropertyDefs - Checks that a class or one of its super classes must not be auto-synthes...
SourceLocation getSuperClassLoc() const
Retrieve the starting location of the superclass.
all_protocol_iterator all_referenced_protocol_begin() const
void setExternallyCompleted()
Indicate that this Objective-C class is complete, but that the external AST source will be responsibl...
ObjCMethodDecl * getCategoryClassMethod(Selector Sel) const
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
ObjCCategoryDecl * FindCategoryDeclaration(IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
ObjCMethodDecl * lookupPrivateMethod(const Selector &Sel, bool Instance=true) const
Lookup a method in the classes implementation hierarchy.
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this class.
ObjCMethodDecl * getCategoryInstanceMethod(Selector Sel) const
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance, bool shallowCategoryLookup=false, bool followSuper=true, const ObjCCategoryDecl *C=nullptr) const
lookupMethod - This method returns an instance/class method by looking in the class,...
ObjCProtocolDecl * lookupNestedProtocol(IdentifierInfo *Name)
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class,...
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
ObjCImplementationDecl * getImplementation() const
bool hasDesignatedInitializers() const
Returns true if this interface decl contains at least one initializer marked with the 'objc_designate...
void getDesignatedInitializers(llvm::SmallVectorImpl< const ObjCMethodDecl * > &Methods) const
Returns the designated initializers for the interface.
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
void collectPropertiesToImplement(PropertyMap &PM) const override
This routine collects list of properties to be implemented in the class.
bool isArcWeakrefUnavailable() const
isArcWeakrefUnavailable - Checks for a class or one of its super classes to be incompatible with __we...
visible_categories_range visible_categories() const
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
ObjCInterfaceDecl * getSuperClass() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
TypeSourceInfo * getSuperClassTInfo() const
bool isDesignatedInitializer(Selector Sel, const ObjCMethodDecl **InitMethod=nullptr) const
Returns true if the given selector is a designated initializer for the interface.
void startDuplicateDefinitionForComparison()
Starts the definition without sharing it with other redeclarations.
void setHasDesignatedInitializers()
Indicate that this interface decl contains at least one initializer marked with the 'objc_designated_...
void mergeDuplicateDefinitionWithCommon(const ObjCInterfaceDecl *Definition)
known_extensions_range known_extensions() const
ObjCIvarDecl - Represents an ObjC instance variable.
void setNextIvar(ObjCIvarDecl *ivar)
ObjCInterfaceDecl * getContainingInterface()
Return the class interface that this ivar is logically contained in; this is either the interface whe...
static ObjCIvarDecl * Create(ASTContext &C, ObjCContainerDecl *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW=nullptr, bool synthesized=false)
static ObjCIvarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
QualType getUsageType(QualType objectType) const
Retrieve the type of this instance variable when viewed as a member of a specific object type.
void ** List
List is an array of pointers to objects that are not owned by this object.
void set(void *const *InList, unsigned Elts, ASTContext &Ctx)
ObjCList - This is a simple template class used to hold various lists of decls etc,...
ObjCMethodDecl - Represents an instance or class method declaration.
bool isDesignatedInitializerForTheInterface(const ObjCMethodDecl **InitMethod=nullptr) const
Returns true if the method selector resolves to a designated initializer in the class's interface.
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
ArrayRef< ParmVarDecl * > parameters() const
unsigned param_size() const
void setSelfDecl(ImplicitParamDecl *SD)
bool isPropertyAccessor() const
void getOverriddenMethods(SmallVectorImpl< const ObjCMethodDecl * > &Overridden) const
Return overridden methods for the given Method.
static ObjCMethodDecl * Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, bool isInstance=true, bool isVariadic=false, bool isPropertyAccessor=false, bool isSynthesizedAccessorStub=false, bool isImplicitlyDeclared=false, bool isDefined=false, ObjCImplementationControl impControl=ObjCImplementationControl::None, bool HasRelatedResultType=false)
void setHasRedeclaration(bool HRD) const
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
QualType getSendResultType() const
Determine the type of an expression that sends a message to this function.
bool hasParamDestroyedInCallee() const
True if the method has a parameter that's destroyed in the callee.
void setIsRedeclaration(bool RD)
void setCmdDecl(ImplicitParamDecl *CD)
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
ObjCMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
SourceLocation getEndLoc() const LLVM_READONLY
TypeSourceInfo * getReturnTypeSourceInfo() const
QualType getSelfType(ASTContext &Context, const ObjCInterfaceDecl *OID, bool &selfIsPseudoStrong, bool &selfIsConsumed) const
bool hasRedeclaration() const
True if redeclared in the same interface.
void setAsRedeclaration(const ObjCMethodDecl *PrevMethod)
param_type_iterator param_type_begin() const
bool isSynthesizedAccessorStub() const
SourceLocation getSelectorLoc(unsigned Index) const
SourceRange getReturnTypeSourceRange() const
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs=std::nullopt)
Sets the method's parameters and selector source locations.
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
bool isDirectMethod() const
True if the method is tagged as objc_direct.
llvm::mapped_iterator< param_const_iterator, GetTypeFn > param_type_iterator
Selector getSelector() const
bool isInstanceMethod() const
bool isThisDeclarationADesignatedInitializer() const
Returns true if this specific method declaration is marked with the designated initializer attribute.
ObjCCategoryDecl * getCategory()
If this method is declared or implemented in a category, return that category.
bool definedInNSObject(const ASTContext &) const
Is this method defined in the NSObject base class?
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
createImplicitParams - Used to lazily create the self and cmd implicit parameters.
QualType getReturnType() const
unsigned getNumSelectorLocs() const
bool isClassMethod() const
ObjCInterfaceDecl * getClassInterface()
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
static ObjCMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a class type in Objective C.
Represents one property declaration in an Objective-C interface.
QualType getUsageType(QualType objectType) const
Retrieve the type when this property is used with a specific base object type.
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID, ObjCPropertyQueryKind queryKind)
Lookup a property by name in the specified DeclContext.
bool isDirectProperty() const
static ObjCPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ObjCPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, SourceLocation AtLocation, SourceLocation LParenLocation, QualType T, TypeSourceInfo *TSI, PropertyControl propControl=None)
IdentifierInfo * getDefaultSynthIvarName(ASTContext &Ctx) const
Get the default name of the synthesized ivar.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
static ObjCPropertyImplDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ObjCPropertyImplDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation atLoc, SourceLocation L, ObjCPropertyDecl *property, Kind PK, ObjCIvarDecl *ivarDecl, SourceLocation ivarLoc)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Represents an Objective-C protocol declaration.
void mergeDuplicateDefinitionWithCommon(const ObjCProtocolDecl *Definition)
void startDuplicateDefinitionForComparison()
Starts the definition without sharing it with other redeclarations.
bool hasDefinition() const
Determine whether this protocol has a definition.
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance) const
static ObjCProtocolDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc, ObjCProtocolDecl *PrevDecl)
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for protocol's metadata.
void getImpliedProtocols(llvm::DenseSet< const ObjCProtocolDecl * > &IPs) const
Get the set of all protocols implied by this protocols inheritance hierarchy.
void startDefinition()
Starts the definition of this Objective-C protocol.
bool isNonRuntimeProtocol() const
This is true iff the protocol is tagged with the objc_non_runtime_protocol attribute.
void collectInheritedProtocolProperties(const ObjCPropertyDecl *Property, ProtocolPropertySet &PS, PropertyDeclOrder &PO) const
ObjCProtocolDecl * lookupProtocolNamed(IdentifierInfo *PName)
static ObjCProtocolDecl * CreateDeserialized(ASTContext &C, unsigned ID)
protocol_range protocols() const
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
void collectPropertiesToImplement(PropertyMap &PM) const override
This routine collects list of properties to be implemented in the class.
void set(ObjCProtocolDecl *const *InList, unsigned Elts, const SourceLocation *Locs, ASTContext &Ctx)
Represents the declaration of an Objective-C type parameter.
static ObjCTypeParamDecl * Create(ASTContext &ctx, DeclContext *dc, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, SourceLocation nameLoc, IdentifierInfo *name, SourceLocation colonLoc, TypeSourceInfo *boundInfo)
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
static ObjCTypeParamDecl * CreateDeserialized(ASTContext &ctx, unsigned ID)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
void gatherDefaultTypeArgs(SmallVectorImpl< QualType > &typeArgs) const
Gather the default set of type arguments to be substituted for these type parameters when dealing wit...
unsigned size() const
Determine the number of type parameters in this list.
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl * > typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
Represents a parameter to a function.
A (possibly-)qualified type.
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type.
QualType withConst() const
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
QualType substObjCMemberType(QualType objectType, const DeclContext *dc, ObjCSubstitutionContext context) const
Substitute type arguments from an object type for the Objective-C type parameters used in the subject...
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type.
The collection of all-type qualifiers we support.
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
void setObjCLifetime(ObjCLifetime type)
ObjCInterfaceDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
void setPreviousDecl(ObjCInterfaceDecl *PrevDecl)
Set the previous declaration.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Smart pointer class that efficiently represents Objective-C method names.
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
unsigned getNumArgs() const
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
A container of type source information.
bool isObjCSelType() const
bool isObjCIdType() const
TypeSourceInfo * getTypeSourceInfo() const
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
@ SelLoc_NonStandard
Non-standard.
@ SelLoc_StandardNoSpace
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or immediately...
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
ObjCMethodFamily
A family of Objective-C methods.
@ OMF_None
No particular method family.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
SelectorLocationsKind hasStandardSelectorLocs(Selector Sel, ArrayRef< SourceLocation > SelLocs, ArrayRef< Expr * > Args, SourceLocation EndLoc)
Returns true if all SelLocs are in a "standard" location.
@ Property
The type of a property.
@ Result
The result type of a method or function.
ObjCImplementationControl
@ InvalidObjCMethodFamily
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
@ Invariant
The parameter is invariant: must match exactly.
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ ObjCSelf
Parameter for Objective-C 'self' argument.
@ ObjCCmd
Parameter for Objective-C '_cmd' argument.
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.