Lines Matching +full:dc +full:- +full:id
1 //===- DeclObjC.cpp - ObjC Declaration AST Node Implementation ------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements the Objective-C related Decl classes.
11 //===----------------------------------------------------------------------===//
41 //===----------------------------------------------------------------------===//
43 //===----------------------------------------------------------------------===//
64 //===----------------------------------------------------------------------===//
66 //===----------------------------------------------------------------------===//
68 ObjCContainerDecl::ObjCContainerDecl(Kind DK, DeclContext *DC, in ObjCContainerDecl() argument
69 const IdentifierInfo *Id, in ObjCContainerDecl() argument
72 : NamedDecl(DK, DC, nameLoc, Id), DeclContext(DK) { in ObjCContainerDecl()
78 /// getIvarDecl - This method looks up an ivar in this ContextDecl.
81 ObjCContainerDecl::getIvarDecl(IdentifierInfo *Id) const { in getIvarDecl()
82 lookup_result R = lookup(Id); in getIvarDecl()
98 if (const ObjCProtocolDecl *Def = Proto->getDefinition()) in getMethod()
99 if (!Def->isUnconditionallyVisible() && !AllowHidden) in getMethod()
107 // - (int) class_method; in getMethod()
114 if (MD && MD->isInstanceMethod() == isInstance) in getMethod()
127 Selector Sel = Property->getSetterName(); in HasUserDeclaredSetterMethod()
132 if (MD && MD->isInstanceMethod() && !MD->isImplicit()) in HasUserDeclaredSetterMethod()
136 if (const auto *ID = dyn_cast<ObjCInterfaceDecl>(this)) { in HasUserDeclaredSetterMethod() local
139 for (const auto *Cat : ID->visible_categories()) { in HasUserDeclaredSetterMethod()
140 if (ObjCMethodDecl *MD = Cat->getInstanceMethod(Sel)) in HasUserDeclaredSetterMethod()
141 if (!MD->isImplicit()) in HasUserDeclaredSetterMethod()
143 if (Cat->IsClassExtension()) in HasUserDeclaredSetterMethod()
148 // auto-synthesized). in HasUserDeclaredSetterMethod()
149 for (const auto *P : Cat->properties()) in HasUserDeclaredSetterMethod()
150 if (P->getIdentifier() == Property->getIdentifier()) { in HasUserDeclaredSetterMethod()
151 if (P->getPropertyAttributes() & in HasUserDeclaredSetterMethod()
159 for (const auto *Proto : ID->all_referenced_protocols()) in HasUserDeclaredSetterMethod()
160 if (Proto->HasUserDeclaredSetterMethod(Property)) in HasUserDeclaredSetterMethod()
164 ObjCInterfaceDecl *OSC = ID->getSuperClass(); in HasUserDeclaredSetterMethod()
166 if (OSC->HasUserDeclaredSetterMethod(Property)) in HasUserDeclaredSetterMethod()
168 OSC = OSC->getSuperClass(); in HasUserDeclaredSetterMethod()
172 for (const auto *PI : PD->protocols()) in HasUserDeclaredSetterMethod()
173 if (PI->HasUserDeclaredSetterMethod(Property)) in HasUserDeclaredSetterMethod()
179 ObjCPropertyDecl::findPropertyDecl(const DeclContext *DC, in findPropertyDecl() argument
184 if (const auto *Proto = dyn_cast<ObjCProtocolDecl>(DC)) { in findPropertyDecl()
185 if (const ObjCProtocolDecl *Def = Proto->getDefinition()) in findPropertyDecl()
186 if (!Def->isUnconditionallyVisible()) in findPropertyDecl()
192 if (auto *IDecl = dyn_cast<ObjCInterfaceDecl>(DC)) { in findPropertyDecl()
193 for (const auto *Ext : IDecl->visible_extensions()) in findPropertyDecl()
200 DeclContext::lookup_result R = DC->lookup(propertyID); in findPropertyDecl()
208 !PD->isClassProperty()) || in findPropertyDecl()
210 PD->isClassProperty()) || in findPropertyDecl()
212 !PD->isClassProperty())) in findPropertyDecl()
215 if (PD->isClassProperty()) in findPropertyDecl()
231 os << '_' << getIdentifier()->getName(); in getDefaultSynthIvarName()
236 ObjCPropertyDecl *ObjCContainerDecl::getProperty(const IdentifierInfo *Id, in getProperty() argument
238 for (auto *LookupResult : lookup(Id)) { in getProperty()
240 if (Prop->isInstanceProperty() == IsInstance) { in getProperty()
248 /// FindPropertyDeclaration - Finds declaration of the property given its name
255 if (const ObjCProtocolDecl *Def = Proto->getDefinition()) in FindPropertyDeclaration()
256 if (!Def->isUnconditionallyVisible()) in FindPropertyDeclaration()
263 for (const auto *Ext : ClassDecl->visible_extensions()) { in FindPropertyDeclaration()
264 if (auto *P = Ext->FindPropertyDeclaration(PropertyId, QueryKind)) in FindPropertyDeclaration()
279 for (const auto *I : PID->protocols()) in FindPropertyDeclaration()
280 if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId, in FindPropertyDeclaration()
288 for (const auto *Cat : OID->visible_categories()) { in FindPropertyDeclaration()
289 if (!Cat->IsClassExtension()) in FindPropertyDeclaration()
290 if (ObjCPropertyDecl *P = Cat->FindPropertyDeclaration( in FindPropertyDeclaration()
296 for (const auto *I : OID->all_referenced_protocols()) in FindPropertyDeclaration()
297 if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId, in FindPropertyDeclaration()
302 if (const ObjCInterfaceDecl *superClass = OID->getSuperClass()) in FindPropertyDeclaration()
303 return superClass->FindPropertyDeclaration(PropertyId, QueryKind); in FindPropertyDeclaration()
309 if (!OCD->IsClassExtension()) in FindPropertyDeclaration()
310 for (const auto *I : OCD->protocols()) in FindPropertyDeclaration()
311 if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId, in FindPropertyDeclaration()
329 return def->getTypeParamListAsWritten(); in getTypeParamList()
335 decl = decl->getPreviousDecl()) { in getTypeParamList()
336 if (ObjCTypeParamList *written = decl->getTypeParamListAsWritten()) in getTypeParamList()
349 typeParam->setDeclContext(this); in setTypeParamList()
361 if (ObjCInterfaceDecl *superDecl = superType->getInterface()) { in getSuperClass()
362 if (ObjCInterfaceDecl *superDef = superDecl->getDefinition()) in getSuperClass()
374 return superTInfo->getTypeLoc().getBeginLoc(); in getSuperClassLoc()
379 /// FindPropertyVisibleInPrimaryClass - Finds declaration of the property
398 if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId, in FindPropertyVisibleInPrimaryClass()
407 PM[std::make_pair(Prop->getIdentifier(), Prop->isClassProperty())] = Prop; in collectPropertiesToImplement()
411 for (auto *Prop : ClassExt->properties()) { in collectPropertiesToImplement()
412 PM[std::make_pair(Prop->getIdentifier(), Prop->isClassProperty())] = Prop; in collectPropertiesToImplement()
416 PI->collectPropertiesToImplement(PM); in collectPropertiesToImplement()
425 if (Class->hasAttr<ArcWeakrefUnavailableAttr>()) in isArcWeakrefUnavailable()
427 Class = Class->getSuperClass(); in isArcWeakrefUnavailable()
435 if (Class->hasAttr<ObjCRequiresPropertyDefsAttr>()) in isObjCRequiresPropertyDefs()
437 Class = Class->getSuperClass(); in isObjCRequiresPropertyDefs()
487 if (IFace->hasDesignatedInitializers()) in findInterfaceWithDesignatedInitializers()
489 if (!IFace->inheritsDesignatedInitializers()) in findInterfaceWithDesignatedInitializers()
491 IFace = IFace->getSuperClass(); in findInterfaceWithDesignatedInitializers()
497 for (const auto *MD : D->instance_methods()) { in isIntroducingInitializers()
498 if (MD->getMethodFamily() == OMF_init && !MD->isOverriding()) in isIntroducingInitializers()
501 for (const auto *Ext : D->visible_extensions()) { in isIntroducingInitializers()
502 for (const auto *MD : Ext->instance_methods()) { in isIntroducingInitializers()
503 if (MD->getMethodFamily() == OMF_init && !MD->isOverriding()) in isIntroducingInitializers()
507 if (const auto *ImplD = D->getImplementation()) { in isIntroducingInitializers()
508 for (const auto *MD : ImplD->instance_methods()) { in isIntroducingInitializers()
509 if (MD->getMethodFamily() == OMF_init && !MD->isOverriding()) in isIntroducingInitializers()
531 SuperD->declaresOrInheritsDesignatedInitializers() ? in inheritsDesignatedInitializers()
560 for (const auto *MD : IFace->instance_methods()) in getDesignatedInitializers()
561 if (MD->isThisDeclarationADesignatedInitializer()) in getDesignatedInitializers()
563 for (const auto *Ext : IFace->visible_extensions()) { in getDesignatedInitializers()
564 for (const auto *MD : Ext->instance_methods()) in getDesignatedInitializers()
565 if (MD->isThisDeclarationADesignatedInitializer()) in getDesignatedInitializers()
576 if (!HasCompleteDef && getCanonicalDecl()->hasDefinition() && in isDesignatedInitializer()
577 getCanonicalDecl()->getDefinition() == getDefinition()) in isDesignatedInitializer()
591 if (const ObjCMethodDecl *MD = IFace->getInstanceMethod(Sel)) { in isDesignatedInitializer()
592 if (MD->isThisDeclarationADesignatedInitializer()) { in isDesignatedInitializer()
598 for (const auto *Ext : IFace->visible_extensions()) { in isDesignatedInitializer()
599 if (const ObjCMethodDecl *MD = Ext->getInstanceMethod(Sel)) { in isDesignatedInitializer()
600 if (MD->isThisDeclarationADesignatedInitializer()) { in isDesignatedInitializer()
613 Data.getPointer()->Definition = this; in allocateDefinitionData()
622 RD->Data = Data; in startDefinition()
634 Data = Definition->Data; in mergeDuplicateDefinitionWithCommon()
637 ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(IdentifierInfo *ID, in lookupInstanceVariable() argument
648 if (ObjCIvarDecl *I = ClassDecl->getIvarDecl(ID)) { in lookupInstanceVariable()
653 for (const auto *Ext : ClassDecl->visible_extensions()) { in lookupInstanceVariable()
654 if (ObjCIvarDecl *I = Ext->getIvarDecl(ID)) { in lookupInstanceVariable()
660 ClassDecl = ClassDecl->getSuperClass(); in lookupInstanceVariable()
665 /// lookupInheritedClass - This method returns ObjCInterfaceDecl * of the super
679 if (ClassDecl->getIdentifier() == ICName) in lookupInheritedClass()
681 ClassDecl = ClassDecl->getSuperClass(); in lookupInheritedClass()
689 if (P->lookupProtocolNamed(Name)) in lookupNestedProtocol()
692 return SuperClass ? SuperClass->lookupNestedProtocol(Name) : nullptr; in lookupNestedProtocol()
695 /// lookupMethod - This method returns an instance/class method by looking in
717 if ((MethodDecl = ClassDecl->getMethod(Sel, isInstance))) in lookupMethod()
720 // 2. Didn't find one yet - now look through categories. in lookupMethod()
721 for (const auto *Cat : ClassDecl->visible_categories()) in lookupMethod()
722 if ((MethodDecl = Cat->getMethod(Sel, isInstance))) in lookupMethod()
723 if (C != Cat || !MethodDecl->isImplicit()) in lookupMethod()
726 // 3. Didn't find one yet - look through primary class's protocols. in lookupMethod()
727 for (const auto *I : ClassDecl->protocols()) in lookupMethod()
728 if ((MethodDecl = I->lookupMethod(Sel, isInstance))) in lookupMethod()
731 // 4. Didn't find one yet - now look through categories' protocols in lookupMethod()
733 for (const auto *Cat : ClassDecl->visible_categories()) { in lookupMethod()
734 // Didn't find one yet - look through protocols. in lookupMethod()
736 Cat->getReferencedProtocols(); in lookupMethod()
738 if ((MethodDecl = Protocol->lookupMethod(Sel, isInstance))) in lookupMethod()
739 if (C != Cat || !MethodDecl->isImplicit()) in lookupMethod()
748 ClassDecl = ClassDecl->getSuperClass(); in lookupMethod()
768 Method = Instance ? ImpDecl->getInstanceMethod(Sel) in lookupPrivateMethod()
769 : ImpDecl->getClassMethod(Sel); in lookupPrivateMethod()
787 return getSuperClass()->lookupPrivateMethod(Sel, Instance); in lookupPrivateMethod()
818 //===----------------------------------------------------------------------===//
820 //===----------------------------------------------------------------------===//
866 GlobalDeclID ID) { in CreateDeserialized() argument
867 return new (C, ID) ObjCMethodDecl(SourceLocation(), SourceLocation(), in CreateDeserialized()
883 return PD->getIdentifier() == Ctx.getNSObjectName(); in definedInNSObject()
884 if (const auto *ID = dyn_cast<const ObjCInterfaceDecl>(getDeclContext())) in definedInNSObject() local
885 return ID->getIdentifier() == Ctx.getNSObjectName(); in definedInNSObject()
893 const DeclContext *DC = getDeclContext(); in isDesignatedInitializerForTheInterface() local
894 if (isa<ObjCProtocolDecl>(DC)) in isDesignatedInitializerForTheInterface()
896 if (const ObjCInterfaceDecl *ID = getClassInterface()) in isDesignatedInitializerForTheInterface() local
897 return ID->isDesignatedInitializer(getSelector(), InitMethod); in isDesignatedInitializerForTheInterface()
903 if (param->isDestroyedInCallee()) in hasParamDestroyedInCallee()
917 PrevMethod->setHasRedeclaration(true); in setAsRedeclaration()
948 "No selector locs for non-implicit method"); in setMethodParams()
973 if (!CtxD->isInvalidDecl()) { in getNextRedeclarationImpl()
976 if (!ImplD->isInvalidDecl()) in getNextRedeclarationImpl()
977 Redecl = ImplD->getMethod(getSelector(), isInstanceMethod()); in getNextRedeclarationImpl()
981 if (!ImplD->isInvalidDecl()) in getNextRedeclarationImpl()
982 Redecl = ImplD->getMethod(getSelector(), isInstanceMethod()); in getNextRedeclarationImpl()
985 if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface()) in getNextRedeclarationImpl()
986 if (!IFD->isInvalidDecl()) in getNextRedeclarationImpl()
987 Redecl = IFD->getMethod(getSelector(), isInstanceMethod()); in getNextRedeclarationImpl()
990 if (ObjCCategoryDecl *CatD = CImplD->getCategoryDecl()) in getNextRedeclarationImpl()
991 if (!CatD->isInvalidDecl()) in getNextRedeclarationImpl()
992 Redecl = CatD->getMethod(getSelector(), isInstanceMethod()); in getNextRedeclarationImpl()
999 if (Redecl && cast<Decl>(Redecl->getDeclContext())->isInvalidDecl()) in getNextRedeclarationImpl()
1004 return cast<ObjCContainerDecl>(CtxD)->getMethod(getSelector(), in getNextRedeclarationImpl()
1017 if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface()) { in getCanonicalDecl()
1024 if (ObjCMethodDecl *MD = IFD->getMethod(Sel, isInstanceMethod())) in getCanonicalDecl()
1026 for (auto *Ext : IFD->known_extensions()) in getCanonicalDecl()
1027 if (ObjCMethodDecl *MD = Ext->getMethod(Sel, isInstanceMethod())) in getCanonicalDecl()
1031 if (ObjCCategoryDecl *CatD = CImplD->getCategoryDecl()) in getCanonicalDecl()
1032 if (ObjCMethodDecl *MD = CatD->getMethod(Sel, isInstanceMethod())) in getCanonicalDecl()
1039 cast<ObjCContainerDecl>(CtxD)->getMethod(Sel, isInstanceMethod(), in getCanonicalDecl()
1049 return Body->getEndLoc(); in getEndLoc()
1062 switch (attr->getFamily()) { in getMethodFamily()
1081 if (!isInstanceMethod() || !getReturnType()->isObjCObjectPointerType()) in getMethodFamily()
1091 if (!getReturnType()->isObjCObjectPointerType()) in getMethodFamily()
1108 if (isInstanceMethod() || !getReturnType()->isVoidType()) in getMethodFamily()
1113 if (!isInstanceMethod() || !getReturnType()->isObjCIdType()) in getMethodFamily()
1122 if (!ArgT->isObjCSelType()) { in getMethodFamily()
1126 while (--noParams) { in getMethodFamily()
1129 if (!ArgT->isObjCIdType()) { in getMethodFamily()
1168 // 'self' is always __strong. It's actually pseudo-strong except in getSelfType()
1201 Self->addAttr(NSConsumedAttr::CreateImplicit(Context)); in createImplicitParams()
1204 Self->setARCPseudoStrong(true); in createImplicitParams()
1212 if (auto *ID = dyn_cast<ObjCInterfaceDecl>(getDeclContext())) in getClassInterface() local
1213 return ID; in getClassInterface()
1215 return CD->getClassInterface(); in getClassInterface()
1217 return IMD->getClassInterface(); in getClassInterface()
1227 return IMD->getCategoryDecl(); in getCategory()
1234 return TSI->getTypeLoc().getSourceRange(); in getReturnTypeSourceRange()
1267 Overridden = Container->getMethod(Method->getSelector(), in CollectOverriddenMethodsRecurse()
1268 Method->isInstanceMethod(), in CollectOverriddenMethodsRecurse()
1277 for (const auto *P : Category->protocols()) in CollectOverriddenMethodsRecurse()
1284 Overridden = Container->getMethod(Method->getSelector(), in CollectOverriddenMethodsRecurse()
1285 Method->isInstanceMethod(), in CollectOverriddenMethodsRecurse()
1295 for (const auto *P : Protocol->protocols()) in CollectOverriddenMethodsRecurse()
1300 for (const auto *P : Interface->protocols()) in CollectOverriddenMethodsRecurse()
1303 for (const auto *Cat : Interface->known_categories()) in CollectOverriddenMethodsRecurse()
1306 if (const ObjCInterfaceDecl *Super = Interface->getSuperClass()) in CollectOverriddenMethodsRecurse()
1321 assert(Method->isOverriding()); in collectOverriddenMethodsSlow()
1324 dyn_cast<ObjCProtocolDecl>(Method->getDeclContext())) { in collectOverriddenMethodsSlow()
1328 dyn_cast<ObjCImplDecl>(Method->getDeclContext())) { in collectOverriddenMethodsSlow()
1329 const ObjCInterfaceDecl *ID = IMD->getClassInterface(); in collectOverriddenMethodsSlow() local
1330 if (!ID) in collectOverriddenMethodsSlow()
1334 if (const ObjCMethodDecl *IFaceMeth = ID->getMethod(Method->getSelector(), in collectOverriddenMethodsSlow()
1335 Method->isInstanceMethod(), in collectOverriddenMethodsSlow()
1338 CollectOverriddenMethods(ID, Method, overridden); in collectOverriddenMethodsSlow()
1341 dyn_cast<ObjCCategoryDecl>(Method->getDeclContext())) { in collectOverriddenMethodsSlow()
1342 const ObjCInterfaceDecl *ID = CatD->getClassInterface(); in collectOverriddenMethodsSlow() local
1343 if (!ID) in collectOverriddenMethodsSlow()
1347 if (const ObjCMethodDecl *IFaceMeth = ID->getMethod(Method->getSelector(), in collectOverriddenMethodsSlow()
1348 Method->isInstanceMethod(), in collectOverriddenMethodsSlow()
1351 CollectOverriddenMethods(ID, Method, overridden); in collectOverriddenMethodsSlow()
1355 dyn_cast_or_null<ObjCContainerDecl>(Method->getDeclContext()), in collectOverriddenMethodsSlow()
1364 if (Method->isRedeclaration()) { in getOverriddenMethods()
1365 Method = cast<ObjCContainerDecl>(Method->getDeclContext()) in getOverriddenMethods()
1366 ->getMethod(Method->getSelector(), Method->isInstanceMethod(), in getOverriddenMethods()
1370 if (Method->isOverriding()) { in getOverriddenMethods()
1389 Container = ImplDecl->getClassInterface(); in findPropertyDecl()
1395 /// given Objective-C container. in findPropertyDecl()
1397 [&](const ObjCContainerDecl *Container) -> const ObjCPropertyDecl * { in findPropertyDecl()
1399 for (const auto *I : Container->instance_properties()) { in findPropertyDecl()
1400 Selector NextSel = IsGetter ? I->getGetterName() in findPropertyDecl()
1401 : I->getSetterName(); in findPropertyDecl()
1406 for (const auto *I : Container->class_properties()) { in findPropertyDecl()
1407 Selector NextSel = IsGetter ? I->getGetterName() in findPropertyDecl()
1408 : I->getSetterName(); in findPropertyDecl()
1424 ClassDecl = Category->getClassInterface(); in findPropertyDecl()
1434 for (const auto *Ext : ClassDecl->visible_extensions()) { in findPropertyDecl()
1443 for (const auto *Cat : ClassDecl->known_categories()) { in findPropertyDecl()
1461 if (const ObjCPropertyDecl *Prop = Override->findPropertyDecl(false)) in findPropertyDecl()
1467 //===----------------------------------------------------------------------===//
1469 //===----------------------------------------------------------------------===//
1473 ObjCTypeParamDecl *ObjCTypeParamDecl::Create(ASTContext &ctx, DeclContext *dc, in Create() argument
1482 new (ctx, dc) ObjCTypeParamDecl(ctx, dc, variance, varianceLoc, index, in Create()
1485 TPDecl->setTypeForDecl(TPType.getTypePtr()); in Create()
1490 GlobalDeclID ID) { in CreateDeserialized() argument
1491 return new (ctx, ID) ObjCTypeParamDecl(ctx, nullptr, in CreateDeserialized()
1504 getTypeSourceInfo()->getTypeLoc().getEndLoc()); in getSourceRange()
1510 //===----------------------------------------------------------------------===//
1512 //===----------------------------------------------------------------------===//
1535 typeArgs.push_back(typeParam->getUnderlyingType()); in gatherDefaultTypeArgs()
1538 //===----------------------------------------------------------------------===//
1540 //===----------------------------------------------------------------------===//
1543 const ASTContext &C, DeclContext *DC, SourceLocation atLoc, in Create() argument
1544 const IdentifierInfo *Id, ObjCTypeParamList *typeParamList, in Create() argument
1546 auto *Result = new (C, DC) in Create()
1547 ObjCInterfaceDecl(C, DC, atLoc, Id, typeParamList, ClassLoc, PrevDecl, in Create()
1549 Result->Data.setInt(!C.getLangOpts().Modules); in Create()
1555 GlobalDeclID ID) { in CreateDeserialized() argument
1556 auto *Result = new (C, ID) in CreateDeserialized()
1559 Result->Data.setInt(!C.getLangOpts().Modules); in CreateDeserialized()
1564 const ASTContext &C, DeclContext *DC, SourceLocation AtLoc, in ObjCInterfaceDecl() argument
1565 const IdentifierInfo *Id, ObjCTypeParamList *typeParamList, in ObjCInterfaceDecl() argument
1567 : ObjCContainerDecl(ObjCInterface, DC, Id, CLoc, AtLoc), in ObjCInterfaceDecl()
1573 Data = PrevDecl->Data; in ObjCInterfaceDecl()
1583 getASTContext().getExternalSource()->CompleteType( in LoadExternalDefinition()
1615 return ObjCRTName->getMetadataName(); in getObjCRuntimeNameAsString()
1622 if (ObjCInterfaceDecl *ID = in getObjCRuntimeNameAsString() local
1623 const_cast<ObjCImplementationDecl*>(this)->getClassInterface()) in getObjCRuntimeNameAsString()
1624 return ID->getObjCRuntimeNameAsString(); in getObjCRuntimeNameAsString()
1663 /// all_declared_ivar_begin - return first ivar declared in this class,
1682 (void)Ext->ivar_empty(); in all_declared_ivar_begin()
1688 curIvar->setNextIvar(*I); in all_declared_ivar_begin()
1692 if (!Ext->ivar_empty()) { in all_declared_ivar_begin()
1694 I = Ext->ivar_begin(), in all_declared_ivar_begin()
1695 E = Ext->ivar_end(); in all_declared_ivar_begin()
1701 curIvar->setNextIvar(*I); in all_declared_ivar_begin()
1713 if (!ImplDecl->ivar_empty()) { in all_declared_ivar_begin()
1715 for (auto *IV : ImplDecl->ivars()) { in all_declared_ivar_begin()
1716 if (IV->getSynthesize() && !IV->isInvalidDecl()) { in all_declared_ivar_begin()
1718 IV->getASTContext().getTypeSize(IV->getType()), IV)); in all_declared_ivar_begin()
1724 curIvar->setNextIvar(IV); in all_declared_ivar_begin()
1737 curIvar->setNextIvar(layout[Ix].Ivar); in all_declared_ivar_begin()
1744 /// FindCategoryDeclaration - Finds category declaration in the list of
1758 if (Cat->getIdentifier() == CategoryId) in FindCategoryDeclaration()
1767 if (ObjCCategoryImplDecl *Impl = Cat->getImplementation()) in getCategoryInstanceMethod()
1768 if (ObjCMethodDecl *MD = Impl->getInstanceMethod(Sel)) in getCategoryInstanceMethod()
1777 if (ObjCCategoryImplDecl *Impl = Cat->getImplementation()) in getCategoryClassMethod()
1778 if (ObjCMethodDecl *MD = Impl->getClassMethod(Sel)) in getCategoryClassMethod()
1785 /// ClassImplementsProtocol - Checks that 'lProto' protocol
1796 for (auto *PI : IDecl->protocols()){ in ClassImplementsProtocol()
1800 // also allowed assigning a protocol-qualified 'id' type to a LHS object in ClassImplementsProtocol()
1801 // when protocol in qualified LHS is in list of protocols in the rhs 'id' in ClassImplementsProtocol()
1813 for (auto *PI : Cat->protocols()) in ClassImplementsProtocol()
1819 if (IDecl->getSuperClass()) in ClassImplementsProtocol()
1821 IDecl->getSuperClass()->ClassImplementsProtocol(lProto, lookupCategory, in ClassImplementsProtocol()
1827 //===----------------------------------------------------------------------===//
1829 //===----------------------------------------------------------------------===//
1833 ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, ObjCContainerDecl *DC, in Create() argument
1836 const IdentifierInfo *Id, QualType T, in Create() argument
1839 if (DC) { in Create()
1845 // (isa<ObjCCategoryDecl>(DC) && in Create()
1846 // cast<ObjCCategoryDecl>(DC)->IsClassExtension())) in Create()
1847 // but unfortunately we sometimes place ivars into non-class extension in Create()
1850 assert((isa<ObjCInterfaceDecl>(DC) || isa<ObjCImplementationDecl>(DC) || in Create()
1851 isa<ObjCCategoryDecl>(DC)) && in Create()
1853 // Once a new ivar is created in any of class/class-extension/implementation in Create()
1855 auto *ID = dyn_cast<ObjCInterfaceDecl>(DC); in Create() local
1856 if (!ID) { in Create()
1857 if (auto *IM = dyn_cast<ObjCImplementationDecl>(DC)) in Create()
1858 ID = IM->getClassInterface(); in Create()
1860 ID = cast<ObjCCategoryDecl>(DC)->getClassInterface(); in Create()
1862 ID->setIvarList(nullptr); in Create()
1865 return new (C, DC) ObjCIvarDecl(DC, StartLoc, IdLoc, Id, T, TInfo, ac, BW, in Create()
1869 ObjCIvarDecl *ObjCIvarDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
1870 return new (C, ID) ObjCIvarDecl(nullptr, SourceLocation(), SourceLocation(), in CreateDeserialized()
1876 auto *DC = cast<ObjCContainerDecl>(getDeclContext()); in getContainingInterface() local
1878 switch (DC->getKind()) { in getContainingInterface()
1886 auto *CD = cast<ObjCCategoryDecl>(DC); in getContainingInterface()
1887 assert(CD->IsClassExtension() && "invalid container for ivar!"); in getContainingInterface()
1888 return CD->getClassInterface(); in getContainingInterface()
1892 return cast<ObjCImplementationDecl>(DC)->getClassInterface(); in getContainingInterface()
1895 return cast<ObjCInterfaceDecl>(DC); in getContainingInterface()
1904 //===----------------------------------------------------------------------===//
1906 //===----------------------------------------------------------------------===//
1911 *ObjCAtDefsFieldDecl::Create(ASTContext &C, DeclContext *DC, in Create() argument
1913 IdentifierInfo *Id, QualType T, Expr *BW) { in Create() argument
1914 return new (C, DC) ObjCAtDefsFieldDecl(DC, StartLoc, IdLoc, Id, T, BW); in Create()
1918 GlobalDeclID ID) { in CreateDeserialized() argument
1919 return new (C, ID) ObjCAtDefsFieldDecl(nullptr, SourceLocation(), in CreateDeserialized()
1924 //===----------------------------------------------------------------------===//
1926 //===----------------------------------------------------------------------===//
1930 ObjCProtocolDecl::ObjCProtocolDecl(ASTContext &C, DeclContext *DC, in ObjCProtocolDecl() argument
1931 IdentifierInfo *Id, SourceLocation nameLoc, in ObjCProtocolDecl() argument
1934 : ObjCContainerDecl(ObjCProtocol, DC, Id, nameLoc, atStartLoc), in ObjCProtocolDecl()
1938 Data = PrevDecl->Data; in ObjCProtocolDecl()
1941 ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC, in Create() argument
1942 IdentifierInfo *Id, in Create() argument
1947 new (C, DC) ObjCProtocolDecl(C, DC, Id, nameLoc, atStartLoc, PrevDecl); in Create()
1948 Result->Data.setInt(!C.getLangOpts().Modules); in Create()
1953 GlobalDeclID ID) { in CreateDeserialized() argument
1955 new (C, ID) ObjCProtocolDecl(C, nullptr, nullptr, SourceLocation(), in CreateDeserialized()
1957 Result->Data.setInt(!C.getLangOpts().Modules); in CreateDeserialized()
1973 for (const auto *Parent : PD->protocols()) { in getImpliedProtocols()
1974 const auto *Can = Parent->getCanonicalDecl(); in getImpliedProtocols()
1989 if ((PDecl = I->lookupProtocolNamed(Name))) in lookupProtocolNamed()
1995 // lookupMethod - Lookup a instance/class method in the protocol and protocols
2004 if (!Def || !Def->isUnconditionallyVisible()) in lookupMethod()
2011 if ((MethodDecl = I->lookupMethod(Sel, isInstance))) in lookupMethod()
2019 Data.getPointer()->Definition = this; in allocateDefinitionData()
2020 Data.getPointer()->HasODRHash = false; in allocateDefinitionData()
2028 RD->Data = this->Data; in startDefinition()
2039 Data = Definition->Data; in mergeDuplicateDefinitionWithCommon()
2044 for (auto *Prop : PDecl->properties()) { in collectPropertiesToImplement()
2047 std::make_pair(Prop->getIdentifier(), Prop->isClassProperty()), in collectPropertiesToImplement()
2051 for (const auto *PI : PDecl->protocols()) in collectPropertiesToImplement()
2052 PI->collectPropertiesToImplement(PM); in collectPropertiesToImplement()
2062 for (auto *Prop : PDecl->properties()) { in collectInheritedProtocolProperties()
2065 if (Prop->getIdentifier() == Property->getIdentifier()) { in collectInheritedProtocolProperties()
2071 for (const auto *PI : PDecl->protocols()) in collectInheritedProtocolProperties()
2072 PI->collectInheritedProtocolProperties(Property, PS, PO); in collectInheritedProtocolProperties()
2079 return ObjCRTName->getMetadataName(); in getObjCRuntimeNameAsString()
2111 //===----------------------------------------------------------------------===//
2113 //===----------------------------------------------------------------------===//
2118 DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc, in ObjCCategoryDecl() argument
2119 SourceLocation CategoryNameLoc, const IdentifierInfo *Id, in ObjCCategoryDecl() argument
2122 : ObjCContainerDecl(ObjCCategory, DC, Id, ClassNameLoc, AtLoc), in ObjCCategoryDecl()
2129 ASTContext &C, DeclContext *DC, SourceLocation AtLoc, in Create() argument
2131 const IdentifierInfo *Id, ObjCInterfaceDecl *IDecl, in Create() argument
2135 new (C, DC) ObjCCategoryDecl(DC, AtLoc, ClassNameLoc, CategoryNameLoc, Id, in Create()
2140 CatDecl->NextClassCategory = IDecl->getCategoryListRaw(); in Create()
2141 if (IDecl->hasDefinition()) { in Create()
2142 IDecl->setCategoryListRaw(CatDecl); in Create()
2144 L->AddedObjCCategoryToInterface(CatDecl, IDecl); in Create()
2152 GlobalDeclID ID) { in CreateDeserialized() argument
2153 return new (C, ID) ObjCCategoryDecl(nullptr, SourceLocation(), in CreateDeserialized()
2173 typeParam->setDeclContext(this); in setTypeParamList()
2176 //===----------------------------------------------------------------------===//
2178 //===----------------------------------------------------------------------===//
2183 ASTContext &C, DeclContext *DC, const IdentifierInfo *Id, in Create() argument
2186 if (ClassInterface && ClassInterface->hasDefinition()) in Create()
2187 ClassInterface = ClassInterface->getDefinition(); in Create()
2188 return new (C, DC) ObjCCategoryImplDecl(DC, Id, ClassInterface, nameLoc, in Create()
2193 ObjCCategoryImplDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
2194 return new (C, ID) ObjCCategoryImplDecl(nullptr, nullptr, nullptr, in CreateDeserialized()
2201 if (const ObjCInterfaceDecl *ID = getClassInterface()) in getCategoryDecl() local
2202 return ID->FindCategoryDeclaration(getIdentifier()); in getCategoryDecl()
2210 property->setLexicalDeclContext(this); in addPropertyImplementation()
2222 if (ObjCCategoryDecl *CD = IFace->FindCategoryDeclaration(getIdentifier())) in setClassInterface()
2229 /// FindPropertyImplIvarDecl - This method lookup the ivar in the list of
2235 if (PID->getPropertyIvarDecl() && in FindPropertyImplIvarDecl()
2236 PID->getPropertyIvarDecl()->getIdentifier() == ivarId) in FindPropertyImplIvarDecl()
2241 /// FindPropertyImplDecl - This method looks up a previous ObjCPropertyImplDecl
2245 FindPropertyImplDecl(IdentifierInfo *Id, in FindPropertyImplDecl() argument
2251 if (PID->getPropertyDecl()->getIdentifier() == Id) { in FindPropertyImplDecl()
2253 !PID->getPropertyDecl()->isClassProperty()) || in FindPropertyImplDecl()
2255 PID->getPropertyDecl()->isClassProperty()) || in FindPropertyImplDecl()
2257 !PID->getPropertyDecl()->isClassProperty())) in FindPropertyImplDecl()
2260 if (PID->getPropertyDecl()->isClassProperty()) in FindPropertyImplDecl()
2277 //===----------------------------------------------------------------------===//
2279 //===----------------------------------------------------------------------===//
2284 ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC, in Create() argument
2292 if (ClassInterface && ClassInterface->hasDefinition()) in Create()
2293 ClassInterface = ClassInterface->getDefinition(); in Create()
2294 return new (C, DC) ObjCImplementationDecl(DC, ClassInterface, SuperDecl, in Create()
2300 ObjCImplementationDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
2301 return new (C, ID) ObjCImplementationDecl(nullptr, nullptr, nullptr, in CreateDeserialized()
2323 const ObjCImplementationDecl &ID) { in operator <<() argument
2324 OS << ID.getName(); in operator <<()
2328 //===----------------------------------------------------------------------===//
2330 //===----------------------------------------------------------------------===//
2335 ObjCCompatibleAliasDecl::Create(ASTContext &C, DeclContext *DC, in Create() argument
2337 IdentifierInfo *Id, in Create() argument
2339 return new (C, DC) ObjCCompatibleAliasDecl(DC, L, Id, AliasedClass); in Create()
2343 ObjCCompatibleAliasDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
2344 return new (C, ID) ObjCCompatibleAliasDecl(nullptr, SourceLocation(), in CreateDeserialized()
2348 //===----------------------------------------------------------------------===//
2350 //===----------------------------------------------------------------------===//
2355 ObjCPropertyDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, in Create() argument
2356 const IdentifierInfo *Id, SourceLocation AtLoc, in Create() argument
2359 return new (C, DC) ObjCPropertyDecl(DC, L, Id, AtLoc, LParenLoc, T, TSI, in Create()
2364 GlobalDeclID ID) { in CreateDeserialized() argument
2365 return new (C, ID) ObjCPropertyDecl(nullptr, SourceLocation(), nullptr, in CreateDeserialized()
2380 //===----------------------------------------------------------------------===//
2382 //===----------------------------------------------------------------------===//
2385 DeclContext *DC, in Create() argument
2392 return new (C, DC) ObjCPropertyImplDecl(DC, atLoc, L, property, PK, ivar, in Create()
2397 ObjCPropertyImplDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { in CreateDeserialized() argument
2398 return new (C, ID) ObjCPropertyImplDecl(nullptr, SourceLocation(), in CreateDeserialized()