19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/ADT/SmallString.h"
21 using namespace clang;
29 if (Elts == 0)
return;
32 List =
new (Ctx)
void*[Elts];
34 memcpy(
List, InList,
sizeof(
void*)*Elts);
44 set(InList, Elts, Ctx);
51 void ObjCContainerDecl::anchor() { }
59 Ivar != IvarEnd; ++Ivar) {
69 bool AllowHidden)
const {
74 if (Def->isHidden() && !AllowHidden)
88 Meth != MethEnd; ++Meth) {
106 Meth != MethEnd; ++Meth) {
115 for (
const auto *Cat :
ID->visible_categories()) {
117 if (!MD->isImplicit())
119 if (Cat->IsClassExtension())
125 for (
const auto *
P : Cat->properties())
134 for (
const auto *Proto :
ID->all_referenced_protocols())
135 if (Proto->HasUserDeclaredSetterMethod(Property))
147 for (
const auto *PI : PD->protocols())
148 if (PI->HasUserDeclaredSetterMethod(Property))
166 if (
auto *IDecl = dyn_cast<ObjCInterfaceDecl>(DC)) {
167 for (
const auto *Ext : IDecl->known_extensions())
186 llvm::raw_svector_ostream os(ivarName);
205 if (
const auto *ClassDecl = dyn_cast<ObjCInterfaceDecl>(
this)) {
206 for (
const auto *Ext : ClassDecl->visible_extensions()) {
207 if (
auto *
P = Ext->FindPropertyDeclaration(PropertyId))
219 case Decl::ObjCProtocol: {
226 case Decl::ObjCInterface: {
230 if (!Cat->IsClassExtension())
242 return superClass->FindPropertyDeclaration(PropertyId);
245 case Decl::ObjCCategory: {
258 void ObjCInterfaceDecl::anchor() { }
267 return def->getTypeParamListAsWritten();
285 for (
auto typeParam : *TypeParamList)
286 typeParam->setDeclContext(
this);
294 if (data().ExternallyCompleted)
295 LoadExternalDefinition();
311 return superTInfo->getTypeLoc().getLocStart();
327 if (data().ExternallyCompleted)
328 LoadExternalDefinition();
345 PM[Prop->getIdentifier()] = Prop;
351 PM[Prop->getIdentifier()] = Prop;
356 PI->collectPropertiesToImplement(PM, PO);
365 if (Class->
hasAttr<ArcWeakrefUnavailableAttr>())
375 if (Class->
hasAttr<ObjCRequiresPropertyDefsAttr>())
386 if (data().ExternallyCompleted)
387 LoadExternalDefinition();
389 if (data().AllReferencedProtocols.empty() &&
390 data().ReferencedProtocols.empty()) {
391 data().AllReferencedProtocols.set(ExtList, ExtNum, C);
399 for (
unsigned i = 0; i < ExtNum; i++) {
400 bool protocolExists =
false;
404 protocolExists =
true;
411 ProtocolRefs.push_back(ProtoInExtension);
414 if (ProtocolRefs.empty())
421 data().AllReferencedProtocols.set(ProtocolRefs.data(), ProtocolRefs.size(),
C);
425 ObjCInterfaceDecl::findInterfaceWithDesignatedInitializers()
const {
430 if (!IFace->inheritsDesignatedInitializers())
439 if (MD->getMethodFamily() ==
OMF_init && !MD->isOverriding())
443 for (
const auto *MD : Ext->instance_methods()) {
444 if (MD->getMethodFamily() ==
OMF_init && !MD->isOverriding())
449 for (
const auto *MD : ImplD->instance_methods()) {
450 if (MD->getMethodFamily() ==
OMF_init && !MD->isOverriding())
457 bool ObjCInterfaceDecl::inheritsDesignatedInitializers()
const {
458 switch (data().InheritedDesignatedInitializers) {
459 case DefinitionData::IDI_Inherited:
461 case DefinitionData::IDI_NotInherited:
463 case DefinitionData::IDI_Unknown: {
468 data().InheritedDesignatedInitializers = DefinitionData::IDI_NotInherited;
471 data().InheritedDesignatedInitializers =
472 SuperD->declaresOrInheritsDesignatedInitializers() ?
473 DefinitionData::IDI_Inherited :
474 DefinitionData::IDI_NotInherited;
476 data().InheritedDesignatedInitializers =
477 DefinitionData::IDI_NotInherited;
480 assert(data().InheritedDesignatedInitializers
481 != DefinitionData::IDI_Unknown);
482 return data().InheritedDesignatedInitializers ==
483 DefinitionData::IDI_Inherited;
487 llvm_unreachable(
"unexpected InheritedDesignatedInitializers value");
495 if (data().ExternallyCompleted)
496 LoadExternalDefinition();
503 if (MD->isThisDeclarationADesignatedInitializer())
504 Methods.push_back(MD);
506 for (
const auto *MD : Ext->instance_methods())
507 if (MD->isThisDeclarationADesignatedInitializer())
508 Methods.push_back(MD);
517 if (data().ExternallyCompleted)
518 LoadExternalDefinition();
525 if (MD->isThisDeclarationADesignatedInitializer()) {
533 if (MD->isThisDeclarationADesignatedInitializer()) {
543 void ObjCInterfaceDecl::allocateDefinitionData() {
544 assert(!
hasDefinition() &&
"ObjC class already has a definition");
546 Data.getPointer()->Definition =
this;
550 cast<ObjCInterfaceType>(TypeForDecl)->
Decl =
this;
554 allocateDefinitionData();
569 if (data().ExternallyCompleted)
570 LoadExternalDefinition();
573 while (ClassDecl !=
nullptr) {
575 clsDeclared = ClassDecl;
581 clsDeclared = ClassDecl;
600 if (data().ExternallyCompleted)
601 LoadExternalDefinition();
604 while (ClassDecl !=
nullptr) {
615 if (
P->lookupProtocolNamed(Name))
627 bool shallowCategoryLookup,
638 if (data().ExternallyCompleted)
639 LoadExternalDefinition();
643 if ((MethodDecl = ClassDecl->
getMethod(Sel, isInstance)))
648 if ((MethodDecl = Cat->getMethod(Sel, isInstance)))
654 if ((MethodDecl =
I->lookupMethod(Sel, isInstance)))
658 if (!shallowCategoryLookup)
662 Cat->getReferencedProtocols();
664 E = Protocols.
end();
I !=
E; ++
I)
665 if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance)))
685 bool Instance)
const {
690 if (data().ExternallyCompleted)
691 LoadExternalDefinition();
695 Method = Instance ? ImpDecl->getInstanceMethod(Sel)
696 : ImpDecl->getClassMethod(Sel);
725 DeclContext *contextDecl,
bool isInstance,
bool isVariadic,
726 bool isPropertyAccessor,
bool isImplicitlyDeclared,
bool isDefined,
729 beginLoc, endLoc, SelInfo, T, ReturnTInfo, contextDecl, isInstance,
730 isVariadic, isPropertyAccessor, isImplicitlyDeclared, isDefined,
731 impControl, HasRelatedResultType);
741 hasAttr<ObjCDesignatedInitializerAttr>();
749 if (isa<ObjCProtocolDecl>(DC))
752 return ID->isDesignatedInitializer(
getSelector(), InitMethod);
763 IsRedeclaration =
true;
764 PrevMethod->HasRedeclaration =
true;
767 void ObjCMethodDecl::setParamsAndSelLocs(
ASTContext &
C,
770 ParamsAndSelLocs =
nullptr;
771 NumParams = Params.size();
772 if (Params.empty() && SelLocs.empty())
775 static_assert(llvm::AlignOf<ParmVarDecl *>::Alignment >=
776 llvm::AlignOf<SourceLocation>::Alignment,
777 "Alignment not sufficient for SourceLocation");
779 unsigned Size =
sizeof(
ParmVarDecl *) * NumParams +
781 ParamsAndSelLocs = C.
Allocate(Size);
782 std::copy(Params.begin(), Params.end(), getParams());
783 std::copy(SelLocs.begin(), SelLocs.end(), getStoredSelLocs());
796 "No selector locs for non-implicit method");
798 return setParamsAndSelLocs(C, Params,
llvm::None);
803 return setParamsAndSelLocs(C, Params,
llvm::None);
805 setParamsAndSelLocs(C, Params, SelLocs);
814 if (HasRedeclaration)
824 if (!ImplD->isInvalidDecl())
829 if (!ImplD->isInvalidDecl())
833 dyn_cast<ObjCImplementationDecl>(CtxD)) {
835 if (!IFD->isInvalidDecl())
839 dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
841 if (!CatD->isInvalidDecl())
848 return cast<ObjCContainerDecl>(CtxD)->getMethod(
getSelector(),
852 return Redecl ? Redecl :
this;
865 dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
873 return cast<ObjCContainerDecl>(CtxD)->getMethod(
getSelector(),
881 return Body->getLocEnd();
891 if (
const ObjCMethodFamilyAttr *attr = getAttr<ObjCMethodFamilyAttr>()) {
894 switch (attr->getFamily()) {
902 Family =
static_cast<unsigned>(family);
949 if (noParams < 1 || noParams > 3)
973 Family =
static_cast<unsigned>(family);
979 bool &selfIsPseudoStrong,
980 bool &selfIsConsumed) {
982 selfIsPseudoStrong =
false;
983 selfIsConsumed =
false;
998 selfIsConsumed = hasAttr<NSConsumesSelfAttr>();
1009 selfIsPseudoStrong =
true;
1016 selfIsPseudoStrong =
true;
1024 bool selfIsPseudoStrong, selfIsConsumed;
1026 getSelfType(Context, OID, selfIsPseudoStrong, selfIsConsumed);
1033 self->addAttr(NSConsumedAttr::CreateImplicit(Context));
1035 if (selfIsPseudoStrong)
1036 self->setARCPseudoStrong(
true);
1047 return CD->getClassInterface();
1049 return IMD->getClassInterface();
1052 llvm_unreachable(
"unknown method context");
1058 return TSI->getTypeLoc().getSourceRange();
1079 bool MovedToSuper) {
1087 Category = dyn_cast<ObjCCategoryDecl>(Container)) {
1095 if (Method != Overridden) {
1098 Methods.push_back(Overridden);
1102 for (
const auto *
P :
Category->protocols())
1112 if (Method != Overridden) {
1115 Methods.push_back(Overridden);
1119 if (
const ObjCProtocolDecl *Protocol = dyn_cast<ObjCProtocolDecl>(Container)){
1120 for (
const auto *
P : Protocol->protocols())
1125 Interface = dyn_cast<ObjCInterfaceDecl>(Container)) {
1126 for (
const auto *
P : Interface->protocols())
1129 for (
const auto *Cat : Interface->known_categories())
1182 Method, overridden);
1197 assert(!Overridden.empty() &&
1198 "ObjCMethodDecl's overriding bit is not as expected");
1214 bool IsGetter = (NumArgs == 0);
1218 auto findMatchingProperty =
1222 Selector NextSel = IsGetter ?
I->getGetterName()
1223 :
I->getSetterName();
1232 if (
const auto *Found = findMatchingProperty(Container))
1237 if (
const auto *
Category = dyn_cast<ObjCCategoryDecl>(Container)) {
1238 ClassDecl =
Category->getClassInterface();
1239 if (
const auto *Found = findMatchingProperty(ClassDecl))
1249 if (Ext == Container)
1252 if (
const auto *Found = findMatchingProperty(Ext))
1257 llvm_unreachable(
"Marked as a property accessor but no property found!");
1260 if (!CheckOverrides)
1264 OverridesTy Overrides;
1266 for (OverridesTy::const_iterator
I = Overrides.begin(),
E = Overrides.end();
1279 void ObjCTypeParamDecl::anchor() { }
1290 nameLoc, name, colonLoc, boundInfo);
1320 : NumParams(typeParams.size())
1324 std::copy(typeParams.begin(), typeParams.end(),
begin());
1334 ctx.
Allocate(totalSizeToAlloc<ObjCTypeParamDecl *>(typeParams.size()),
1335 llvm::alignOf<ObjCTypeParamList>());
1341 typeArgs.reserve(
size());
1342 for (
auto typeParam : *
this)
1343 typeArgs.push_back(typeParam->getUnderlyingType());
1385 redeclarable_base(C), TypeForDecl(nullptr), TypeParamList(nullptr),
1391 Data = PrevDecl->Data;
1398 void ObjCInterfaceDecl::LoadExternalDefinition()
const {
1399 assert(data().ExternallyCompleted &&
"Class is not externally completed");
1400 data().ExternallyCompleted =
false;
1402 const_cast<ObjCInterfaceDecl *>(
this));
1407 "Class can't be externally completed without an external source");
1409 "Forward declarations can't be externally completed");
1410 data().ExternallyCompleted =
true;
1417 data().HasDesignatedInitializers =
true;
1424 if (data().ExternallyCompleted)
1425 LoadExternalDefinition();
1427 return data().HasDesignatedInitializers;
1432 if (ObjCRuntimeNameAttr *ObjCRTName = getAttr<ObjCRuntimeNameAttr>())
1433 return ObjCRTName->getMetadataName();
1442 return ID->getObjCRuntimeNameAsString();
1449 if (data().ExternallyCompleted)
1450 LoadExternalDefinition();
1453 const_cast<ObjCInterfaceDecl*>(Def));
1465 struct SynthesizeIvarChunk {
1469 : Size(size), Ivar(ivar) {}
1472 bool operator<(
const SynthesizeIvarChunk & LHS,
1473 const SynthesizeIvarChunk &RHS) {
1474 return LHS.Size < RHS.Size;
1493 if (!data().IvarList) {
1496 data().IvarList = *
I; ++
I;
1497 for (curIvar = data().IvarList; I !=
E; curIvar = *
I, ++
I)
1502 if (!Ext->ivar_empty()) {
1504 I = Ext->ivar_begin(),
1505 E = Ext->ivar_end();
1506 if (!data().IvarList) {
1507 data().IvarList = *
I; ++
I;
1508 curIvar = data().IvarList;
1510 for ( ;I !=
E; curIvar = *
I, ++
I)
1514 data().IvarListMissingImplementation =
true;
1518 if (!data().IvarListMissingImplementation)
1519 return data().IvarList;
1522 data().IvarListMissingImplementation =
false;
1523 if (!ImplDecl->ivar_empty()) {
1525 for (
auto *IV : ImplDecl->ivars()) {
1526 if (IV->getSynthesize() && !IV->isInvalidDecl()) {
1527 layout.push_back(SynthesizeIvarChunk(
1528 IV->getASTContext().getTypeSize(IV->getType()), IV));
1531 if (!data().IvarList)
1532 data().IvarList = IV;
1538 if (!layout.empty()) {
1540 std::stable_sort(layout.begin(), layout.end());
1541 unsigned Ix = 0, EIx = layout.size();
1542 if (!data().IvarList) {
1543 data().IvarList = layout[0].Ivar; Ix++;
1544 curIvar = data().IvarList;
1546 for ( ; Ix != EIx; curIvar = layout[Ix].Ivar, Ix++)
1551 return data().IvarList;
1564 if (data().ExternallyCompleted)
1565 LoadExternalDefinition();
1568 if (Cat->getIdentifier() == CategoryId)
1599 bool lookupCategory,
1600 bool RHSIsQualifiedID) {
1615 if (RHSIsQualifiedID &&
1623 for (
auto *PI : Cat->protocols())
1641 void ObjCIvarDecl::anchor() { }
1660 assert((isa<ObjCInterfaceDecl>(DC) || isa<ObjCImplementationDecl>(DC) ||
1661 isa<ObjCCategoryDecl>(DC)) &&
1662 "Invalid ivar decl context!");
1668 ID = IM->getClassInterface();
1670 ID = cast<ObjCCategoryDecl>(DC)->getClassInterface();
1675 return new (
C, DC)
ObjCIvarDecl(DC, StartLoc, IdLoc, Id, T, TInfo, ac, BW,
1690 case ObjCCategoryImpl:
1692 llvm_unreachable(
"invalid ivar container!");
1695 case ObjCCategory: {
1701 case ObjCImplementation:
1702 return cast<ObjCImplementationDecl>(DC)->getClassInterface();
1705 return cast<ObjCInterfaceDecl>(DC);
1718 void ObjCAtDefsFieldDecl::anchor() { }
1738 void ObjCProtocolDecl::anchor() { }
1745 redeclarable_base(C), Data() {
1746 setPreviousDecl(PrevDecl);
1748 Data = PrevDecl->Data;
1778 if ((PDecl =
I->lookupProtocolNamed(Name)))
1787 bool isInstance)
const {
1796 if ((MethodDecl =
getMethod(Sel, isInstance)))
1800 if ((MethodDecl =
I->lookupMethod(Sel, isInstance)))
1805 void ObjCProtocolDecl::allocateDefinitionData() {
1806 assert(!Data.getPointer() &&
"Protocol already has a definition!");
1808 Data.getPointer()->Definition =
this;
1812 allocateDefinitionData();
1816 RD->Data = this->Data;
1823 for (
auto *Prop : PDecl->properties()) {
1825 PM.insert(std::make_pair(Prop->getIdentifier(), Prop));
1829 for (
const auto *PI : PDecl->protocols())
1830 PI->collectPropertiesToImplement(PM, PO);
1839 bool MatchFound =
false;
1840 for (
auto *Prop : PDecl->properties()) {
1841 if (Prop == Property)
1851 for (
const auto *PI : PDecl->protocols())
1852 PI->collectInheritedProtocolProperties(Property, PM);
1858 if (ObjCRuntimeNameAttr *ObjCRTName = getAttr<ObjCRuntimeNameAttr>())
1859 return ObjCRTName->getMetadataName();
1868 void ObjCCategoryDecl::anchor() { }
1878 ClassInterface(IDecl), TypeParamList(nullptr),
1879 NextClassCategory(nullptr), CategoryNameLoc(CategoryNameLoc),
1880 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc)
1882 setTypeParamList(typeParamList);
1896 IDecl, typeParamList, IvarLBraceLoc,
1904 L->AddedObjCCategoryToInterface(CatDecl, IDecl);
1915 nullptr,
nullptr,
nullptr);
1920 const_cast<ObjCCategoryDecl*>(
this));
1928 TypeParamList = TPL;
1932 for (
auto typeParam : *TypeParamList)
1933 typeParam->setDeclContext(
this);
1941 void ObjCCategoryImplDecl::anchor() { }
1953 atStartLoc, CategoryNameLoc);
1971 void ObjCImplDecl::anchor() { }
1975 property->setLexicalDeclContext(
this);
1983 = dyn_cast_or_null<ObjCImplementationDecl>(
this)) {
1988 dyn_cast_or_null<ObjCCategoryImplDecl>(
this)) {
1993 ClassInterface = IFace;
2003 if (PID->getPropertyIvarDecl() &&
2004 PID->getPropertyIvarDecl()->getIdentifier() == ivarId)
2016 if (PID->getPropertyDecl()->getIdentifier() == Id)
2031 void ObjCImplementationDecl::anchor() { }
2045 nameLoc, atStartLoc, superLoc,
2046 IvarLBraceLoc, IvarRBraceLoc);
2057 unsigned numInitializers) {
2058 if (numInitializers > 0) {
2059 NumIvarInitializers = numInitializers;
2062 memcpy(ivarInitializers, initializers,
2064 IvarInitializers = ivarInitializers;
2083 void ObjCCompatibleAliasDecl::anchor() { }
2103 void ObjCPropertyDecl::anchor() { }
bool isObjCSelType() const
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
ObjCMethodDecl * getCategoryMethod(Selector Sel, bool isInstance) const
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs=llvm::None)
Sets the method's parameters and selector source locations.
bool hasDefinition() const
Determine whether this class has been defined.
Defines the clang::ASTContext interface.
void setExternallyCompleted()
Indicate that this Objective-C class is complete, but that the external AST source will be responsibl...
void setImplicit(bool I=true)
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
protocol_range protocols() const
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
static ObjCIvarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
ObjCInterfaceDecl * getClassInterface()
const ObjCInterfaceDecl * isObjCRequiresPropertyDefs() const
isObjCRequiresPropertyDefs - Checks that a class or one of its super classes must not be auto-synthes...
ObjCInterfaceDecl * getClassInterface()
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
ObjCMethodDecl * getCategoryClassMethod(Selector Sel) const
void getOverriddenMethods(SmallVectorImpl< const ObjCMethodDecl * > &Overridden) const
Return overridden methods for the given Method.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
void gatherDefaultTypeArgs(SmallVectorImpl< QualType > &typeArgs) const
Gather the default set of type arguments to be substituted for these type parameters when dealing wit...
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type...
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
void setPreviousDecl(ObjCInterfaceDecl *PrevDecl)
Set the previous declaration.
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
void setObjCLifetime(ObjCLifetime type)
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
Decl - This represents one declaration (or definition), e.g.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type...
static ObjCProtocolDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc, ObjCProtocolDecl *PrevDecl)
static ObjCPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, SourceLocation AtLocation, SourceLocation LParenLocation, QualType T, TypeSourceInfo *TSI, PropertyControl propControl=None)
void ** List
List is an array of pointers to objects that are not owned by this object.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
ObjCProtocolDecl * lookupNestedProtocol(IdentifierInfo *Name)
A container of type source information.
bool isArcWeakrefUnavailable() const
isArcWeakrefUnavailable - Checks for a class or one of its super classes to be incompatible with __we...
protocol_range protocols() const
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
createImplicitParams - Used to lazily create the self and cmd implict parameters. ...
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
ObjCMethodDecl * getMethod(Selector Sel, bool isInstance, bool AllowHidden=false) const
void setImplementation(ObjCCategoryImplDecl *ImplD)
visible_categories_range visible_categories() const
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 getUsageType(QualType objectType) const
Retrieve the type of this instance variable when viewed as a member of a specific object type...
llvm::DenseMap< const ObjCProtocolDecl *, ObjCPropertyDecl * > ProtocolPropertyMap
QualType getObjCClassType() const
Represents the Objective-C Class type.
TypeSourceInfo * getSuperClassTInfo() const
ObjCMethodDecl - Represents an instance or class method declaration.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or NULL if none exists.
SourceRange getReturnTypeSourceRange() const
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class...
ObjCPropertyDecl * FindPropertyVisibleInPrimaryClass(IdentifierInfo *PropertyId) const
FindPropertyVisibleInPrimaryClass - Finds declaration of the property with name 'PropertyId' in the p...
void setSelfDecl(ImplicitParamDecl *SD)
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
unsigned param_size() const
unsigned size() const
Determine the number of type parameters in this list.
ParmVarDecl - Represents a parameter to a function.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names the category interface associated with this implementat...
The collection of all-type qualifiers we support.
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
One of these records is kept for each identifier that is lexed.
const ObjCInterfaceDecl * getContainingInterface() const
Return the class interface that this ivar is logically contained in; this is either the interface whe...
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Represents a class type in Objective C.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The results of name lookup within a DeclContext.
ObjCMethodFamily
A family of Objective-C methods.
ObjCIvarDecl * getIvarDecl(IdentifierInfo *Id) const
getIvarDecl - This method looks up an ivar in this ContextDecl.
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this class.
all_protocol_range all_referenced_protocols() const
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
void startDefinition()
Starts the definition of this Objective-C protocol.
SelectorLocationsKind hasStandardSelectorLocs(Selector Sel, ArrayRef< SourceLocation > SelLocs, ArrayRef< Expr * > Args, SourceLocation EndLoc)
Returns true if all SelLocs are in a "standard" location.
void set(ObjCProtocolDecl *const *InList, unsigned Elts, const SourceLocation *Locs, ASTContext &Ctx)
bool IsClassExtension() const
void collectPropertiesToImplement(PropertyMap &PM, PropertyDeclOrder &PO) const override
This routine collects list of properties to be implemented in the class.
SourceLocation getSelectorLoc(unsigned Index) const
unsigned getNumSelectorLocs() const
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
void set(void *const *InList, unsigned Elts, ASTContext &Ctx)
ObjCContainerDecl - Represents a container for method declarations.
const LangOptions & getLangOpts() const
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
SourceLocation getSuperClassLoc() const
Retrieve the starting location of the superclass.
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())
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
static ObjCPropertyImplDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation atLoc, SourceLocation L, ObjCPropertyDecl *property, Kind PK, ObjCIvarDecl *ivarDecl, SourceLocation ivarLoc)
ObjCPropertyImplDecl * FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const
FindPropertyImplIvarDecl - This method lookup the ivar in the list of properties implemented in this ...
bool hasDesignatedInitializers() const
Returns true if this interface decl contains at least one initializer marked with the 'objc_designate...
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl * > typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
static ObjCAtDefsFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, Expr *BW)
static ObjCCategoryImplDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Selector getSetterName() const
bool isDesignatedInitializerForTheInterface(const ObjCMethodDecl **InitMethod=nullptr) const
Returns true if the method selector resolves to a designated initializer in the class's interface...
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
void setAsRedeclaration(const ObjCMethodDecl *PrevMethod)
Represents an Objective-C protocol declaration.
Represents an ObjC class declaration.
SourceLocation getLocEnd() const LLVM_READONLY
propimpl_range property_impls() const
llvm::DenseMap< IdentifierInfo *, ObjCPropertyDecl * > PropertyMap
detail::InMemoryDirectory::const_iterator I
ObjCMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
ObjCMethodDecl * lookupPrivateMethod(const Selector &Sel, bool Instance=true) const
Lookup a method in the classes implementation hierarchy.
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID)
Lookup a property by name in the specified DeclContext.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCProtocolDecl * lookupProtocolNamed(IdentifierInfo *PName)
static ObjCCompatibleAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isThisDeclarationADesignatedInitializer() const
Returns true if this specific method declaration is marked with the designated initializer attribute...
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this category.
ID
Defines the set of possible language-specific address spaces.
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
void setNextIvar(ObjCIvarDecl *ivar)
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
Expr - This represents one expression.
StringRef getName() const
Return the actual identifier string.
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
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 isImplicitlyDeclared=false, bool isDefined=false, ImplementationControl impControl=None, bool HasRelatedResultType=false)
unsigned getNumArgs() const
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for protocol's metadata.
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
Lookup an instance method for a given selector.
static ObjCTypeParamDecl * Create(ASTContext &ctx, DeclContext *dc, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, SourceLocation nameLoc, IdentifierInfo *name, SourceLocation colonLoc, TypeSourceInfo *boundInfo)
DeclContext * getDeclContext()
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
bool isObjCIdType() const
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
void setImplementation(ObjCImplementationDecl *ImplD)
void mergeClassExtensionProtocolList(ObjCProtocolDecl *const *List, unsigned Num, ASTContext &C)
mergeClassExtensionProtocolList - Merge class extension's protocol list into the protocol list for th...
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
bool isInstanceMethod() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
QualType getObjCIdType() const
Represents the Objective-CC id type.
void getDesignatedInitializers(llvm::SmallVectorImpl< const ObjCMethodDecl * > &Methods) const
Returns the designated initializers for the interface.
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
The result type of a method or function.
static ObjCTypeParamDecl * CreateDeserialized(ASTContext &ctx, unsigned ID)
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
static bool isIntroducingInitializers(const ObjCInterfaceDecl *D)
static ObjCMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
TypeSourceInfo * getReturnTypeSourceInfo() const
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance) const
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
ivar_iterator ivar_begin() const
ObjCCategoryDecl * getCategoryDecl() const
bool isClassMethod() const
static ObjCCompatibleAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, ObjCInterfaceDecl *aliasedClass)
ObjCPropertyImplDecl * FindPropertyImplDecl(IdentifierInfo *propertyId) const
FindPropertyImplDecl - This method looks up a previous ObjCPropertyImplDecl added to the list of thos...
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
static ObjCProtocolDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Assigning into this object requires the old value to be released and the new value to be retained...
QualType getSelfType(ASTContext &Context, const ObjCInterfaceDecl *OID, bool &selfIsPseudoStrong, bool &selfIsConsumed)
static void CollectOverriddenMethodsRecurse(const ObjCContainerDecl *Container, const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &Methods, bool MovedToSuper)
bool isDesignatedInitializer(Selector Sel, const ObjCMethodDecl **InitMethod=nullptr) const
Returns true if the given selector is a designated initializer for the interface. ...
QualType getUsageType(QualType objectType) const
Retrieve the type when this property is used with a specific base object type.
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
StringRef getName() const
getName - Get the name of identifier for the class interface associated with this implementation as a...
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists...
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
ivar_iterator ivar_end() const
bool isValid() const
Return true if this is a valid SourceLocation object.
ASTContext & getASTContext() const LLVM_READONLY
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
QualType withConst() const
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...
ObjCCategoryDecl - Represents a category declaration.
const ObjCInterfaceDecl * getClassInterface() const
bool isPropertyAccessor() const
Represents one property declaration in an Objective-C interface.
void collectInheritedProtocolProperties(const ObjCPropertyDecl *Property, ProtocolPropertyMap &PM) const
QualType getReturnType() const
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
instmeth_range instance_methods() const
ObjCCategoryDecl * FindCategoryDeclaration(IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
bool HasUserDeclaredSetterMethod(const ObjCPropertyDecl *P) const
This routine returns 'true' if a user declared setter method was found in the class, its protocols, its super classes or categories.
ObjCCategoryImplDecl * getImplementation() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
prop_range properties() const
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
bool isInvalidDecl() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
void setIvarList(ObjCIvarDecl *ivar)
Represents the declaration of an Objective-C type parameter.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
static ObjCImplementationDecl * Create(ASTContext &C, DeclContext *DC, ObjCInterfaceDecl *classInterface, ObjCInterfaceDecl *superDecl, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation superLoc=SourceLocation(), SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
static ObjCCategoryDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Selector getSelector() const
detail::InMemoryDirectory::const_iterator E
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
ObjCMethodDecl * getCategoryInstanceMethod(Selector Sel) const
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
known_extensions_range known_extensions() const
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 ObjCAtDefsFieldDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
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, its categories, and its super classes (using a linear search).
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T)
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
Represents a C++ base or member initializer.
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
ObjCPropertyDecl * FindPropertyDeclaration(const IdentifierInfo *PropertyId) const
FindPropertyDeclaration - Finds declaration of the property given its name in 'PropertyId' and return...
void setCategoryListRaw(ObjCCategoryDecl *category)
Set the raw pointer to the start of the category/extension list.
protocol_range protocols() const
ObjCImplementationDecl * getImplementation() const
void addDecl(Decl *D)
Add the declaration D into this context.
static void collectOverriddenMethodsSlow(const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &overridden)
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
No particular method family.
Represents a field declaration created by an @defs(...).
void setIvarInitializers(ASTContext &C, CXXCtorInitializer **initializers, unsigned numInitializers)
StringRef getName() const
getName - Get the name of identifier for the class interface associated with this implementation as a...
static ObjCImplementationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
all_protocol_iterator all_referenced_protocol_begin() const
void setClassInterface(ObjCInterfaceDecl *IFace)
ObjCIvarDecl - Represents an ObjC instance variable.
void * Allocate(size_t Size, unsigned Align=8) const
llvm::mapped_iterator< param_const_iterator, deref_fun > param_type_iterator
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
ObjCInterfaceDecl * getSuperClass() const
Kind
Lists the kind of concrete classes of Decl.
QualType getSendResultType() const
Determine the type of an expression that sends a message to this function.
ObjCInterfaceDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
static ObjCInterfaceDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
static ObjCPropertyImplDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void addPropertyImplementation(ObjCPropertyImplDecl *property)
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
ObjCIvarDecl * all_declared_ivar_begin()
all_declared_ivar_begin - return first ivar declared in this class, its extensions and its implementa...
static ObjCCategoryImplDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, ObjCInterfaceDecl *classInterface, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation CategoryNameLoc)
TypeSourceInfo * getTypeSourceInfo() const
static ObjCPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static void CollectOverriddenMethods(const ObjCContainerDecl *Container, const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &Methods)
void setHasDesignatedInitializers()
Indicate that this interface decl contains at least one initializer marked with the 'objc_designated_...
IdentifierInfo * getDefaultSynthIvarName(ASTContext &Ctx) const
Get the default name of the synthesized ivar.
void collectPropertiesToImplement(PropertyMap &PM, PropertyDeclOrder &PO) const override
This routine collects list of properties to be implemented in the class.
void setCmdDecl(ImplicitParamDecl *CD)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
The parameter is invariant: must match exactly.
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
visible_extensions_range visible_extensions() const
ObjCCompatibleAliasDecl - Represents alias of a class.
bool isHidden() const
Determine whether this declaration is hidden from name lookup.
param_type_iterator param_type_begin() const