clang: lib/AST/DeclObjC.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
27#include "llvm/ADT/SmallVector.h"
28#include "llvm/Support/ErrorHandling.h"
29#include "llvm/Support/raw_ostream.h"
30#include
31#include
32#include
33#include
34#include
35
36using namespace clang;
37
38
39
40
41
43 List = nullptr;
44 if (Elts == 0) return;
45
46 List = new (Ctx) void*[Elts];
48 memcpy(List, InList, sizeof(void*)*Elts);
49}
50
53 if (Elts == 0)
54 return;
55
58 set(InList, Elts, Ctx);
59}
60
61
62
63
64
72
73void ObjCContainerDecl::anchor() {}
74
75
76
81 Ivar != IvarEnd; ++Ivar) {
82 if (auto *ivar = dyn_cast(*Ivar))
83 return ivar;
84 }
85 return nullptr;
86}
87
88
91 bool AllowHidden) const {
92
93
94 if (const auto *Proto = dyn_cast(this)) {
96 if (!Def->isUnconditionallyVisible() && !AllowHidden)
97 return nullptr;
98 }
99
100
101
102
103
104
105
106
109 Meth != MethEnd; ++Meth) {
110 auto *MD = dyn_cast(*Meth);
111 if (MD && MD->isInstanceMethod() == isInstance)
112 return MD;
113 }
114 return nullptr;
115}
116
117
118
119
120
121
127 Meth != MethEnd; ++Meth) {
128 auto *MD = dyn_cast(*Meth);
129 if (MD && MD->isInstanceMethod() && !MD->isImplicit())
130 return true;
131 }
132
133 if (const auto *ID = dyn_cast(this)) {
134
135
136 for (const auto *Cat : ID->visible_categories()) {
137 if (ObjCMethodDecl *MD = Cat->getInstanceMethod(Sel))
138 if (!MD->isImplicit())
139 return true;
140 if (Cat->IsClassExtension())
141 continue;
142
143
144
145
146 for (const auto *P : Cat->properties())
147 if (P->getIdentifier() == Property->getIdentifier()) {
148 if (P->getPropertyAttributes() &
150 return true;
151 break;
152 }
153 }
154
155
156 for (const auto *Proto : ID->all_referenced_protocols())
157 if (Proto->HasUserDeclaredSetterMethod(Property))
158 return true;
159
160
162 while (OSC) {
164 return true;
166 }
167 }
168 if (const auto *PD = dyn_cast(this))
169 for (const auto *PI : PD->protocols())
170 if (PI->HasUserDeclaredSetterMethod(Property))
171 return true;
172 return false;
173}
174
179
180
181 if (const auto *Proto = dyn_cast(DC)) {
183 if (!Def->isUnconditionallyVisible())
184 return nullptr;
185 }
186
187
188
189 if (auto *IDecl = dyn_cast(DC)) {
190 for (const auto *Ext : IDecl->visible_extensions())
192 propertyID,
193 queryKind))
194 return PD;
195 }
196
198 ObjCPropertyDecl *classProp = nullptr;
200 ++I)
201 if (auto *PD = dyn_cast(*I)) {
202
203
205 !PD->isClassProperty()) ||
207 PD->isClassProperty()) ||
209 !PD->isClassProperty()))
210 return PD;
211
212 if (PD->isClassProperty())
213 classProp = PD;
214 }
215
217
218 return classProp;
219
220 return nullptr;
221}
222
226 {
227 llvm::raw_svector_ostream os(ivarName);
229 }
230 return &Ctx.Idents.get(ivarName.str());
231}
232
234 bool IsInstance) const {
236 if (auto *Prop = dyn_cast(LookupResult)) {
237 if (Prop->isInstanceProperty() == IsInstance) {
238 return Prop;
239 }
240 }
241 }
242 return nullptr;
243}
244
245
246
250
251 if (const auto *Proto = dyn_cast(this)) {
253 if (!Def->isUnconditionallyVisible())
254 return nullptr;
255 }
256
257
258
259 if (const auto *ClassDecl = dyn_cast(this)) {
260 for (const auto *Ext : ClassDecl->visible_extensions()) {
261 if (auto *P = Ext->FindPropertyDeclaration(PropertyId, QueryKind))
262 return P;
263 }
264 }
265
268 QueryKind))
269 return PD;
270
272 default:
273 break;
274 case Decl::ObjCProtocol: {
276 for (const auto *I : PID->protocols())
277 if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId,
278 QueryKind))
279 return P;
280 break;
281 }
282 case Decl::ObjCInterface: {
284
285 for (const auto *Cat : OID->visible_categories()) {
286 if (!Cat->IsClassExtension())
288 PropertyId, QueryKind))
289 return P;
290 }
291
292
293 for (const auto *I : OID->all_referenced_protocols())
294 if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId,
295 QueryKind))
296 return P;
297
298
300 return superClass->FindPropertyDeclaration(PropertyId, QueryKind);
301 break;
302 }
303 case Decl::ObjCCategory: {
305
306 if (!OCD->IsClassExtension())
307 for (const auto *I : OCD->protocols())
308 if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId,
309 QueryKind))
310 return P;
311 break;
312 }
313 }
314 return nullptr;
315}
316
317void ObjCInterfaceDecl::anchor() {}
318
320
322 return written;
323
324
325 if (const ObjCInterfaceDecl *def = getDefinition())
326 return def->getTypeParamListAsWritten();
327
328
329
330
332 decl = decl->getPreviousDecl()) {
334 return written;
335 }
336
337 return nullptr;
338}
339
341 TypeParamList = TPL;
342 if (!TPL)
343 return;
344
345 for (auto *typeParam : *TypeParamList)
346 typeParam->setDeclContext(this);
347}
348
350
352 return nullptr;
353
354 if (data().ExternallyCompleted)
355 LoadExternalDefinition();
356
358 if (ObjCInterfaceDecl *superDecl = superType->getInterface()) {
359 if (ObjCInterfaceDecl *superDef = superDecl->getDefinition())
360 return superDef;
361
362 return superDecl;
363 }
364 }
365
366 return nullptr;
367}
368
371 return superTInfo->getTypeLoc().getBeginLoc();
372
374}
375
376
377
378
381
383 return nullptr;
384
385 if (data().ExternallyCompleted)
386 LoadExternalDefinition();
387
390 QueryKind))
391 return PD;
392
393
395 if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId,
396 QueryKind))
397 return P;
398
399 return nullptr;
400}
401
404 PM[std::make_pair(Prop->getIdentifier(), Prop->isClassProperty())] = Prop;
405 }
408 for (auto *Prop : ClassExt->properties()) {
409 PM[std::make_pair(Prop->getIdentifier(), Prop->isClassProperty())] = Prop;
410 }
411 }
413 PI->collectPropertiesToImplement(PM);
414
415
416
417}
418
420 const ObjCInterfaceDecl *Class = this;
422 if (Class->hasAttr())
423 return true;
425 }
426 return false;
427}
428
430 const ObjCInterfaceDecl *Class = this;
432 if (Class->hasAttr())
435 }
436 return nullptr;
437}
438
442 if (data().ExternallyCompleted)
443 LoadExternalDefinition();
444
445 if (data().AllReferencedProtocols.empty() &&
446 data().ReferencedProtocols.empty()) {
447 data().AllReferencedProtocols.set(ExtList, ExtNum, C);
448 return;
449 }
450
451
452
453
455 for (unsigned i = 0; i < ExtNum; i++) {
456 bool protocolExists = false;
459 if (C.ProtocolCompatibleWithProtocol(ProtoInExtension, Proto)) {
460 protocolExists = true;
461 break;
462 }
463 }
464
465
466 if (!protocolExists)
467 ProtocolRefs.push_back(ProtoInExtension);
468 }
469
470 if (ProtocolRefs.empty())
471 return;
472
473
476
477 data().AllReferencedProtocols.set(ProtocolRefs.data(), ProtocolRefs.size(),C);
478}
479
481ObjCInterfaceDecl::findInterfaceWithDesignatedInitializers() const {
483 while (IFace) {
485 return IFace;
486 if (!IFace->inheritsDesignatedInitializers())
487 break;
489 }
490 return nullptr;
491}
492
495 if (MD->getMethodFamily() == OMF_init && !MD->isOverriding())
496 return true;
497 }
499 for (const auto *MD : Ext->instance_methods()) {
500 if (MD->getMethodFamily() == OMF_init && !MD->isOverriding())
501 return true;
502 }
503 }
505 for (const auto *MD : ImplD->instance_methods()) {
506 if (MD->getMethodFamily() == OMF_init && !MD->isOverriding())
507 return true;
508 }
509 }
510 return false;
511}
512
513bool ObjCInterfaceDecl::inheritsDesignatedInitializers() const {
514 switch (data().InheritedDesignatedInitializers) {
515 case DefinitionData::IDI_Inherited:
516 return true;
517 case DefinitionData::IDI_NotInherited:
518 return false;
519 case DefinitionData::IDI_Unknown:
520
521
522
524 data().InheritedDesignatedInitializers = DefinitionData::IDI_NotInherited;
525 } else {
527 data().InheritedDesignatedInitializers =
528 SuperD->declaresOrInheritsDesignatedInitializers() ?
529 DefinitionData::IDI_Inherited :
530 DefinitionData::IDI_NotInherited;
531 } else {
532 data().InheritedDesignatedInitializers =
533 DefinitionData::IDI_NotInherited;
534 }
535 }
536 assert(data().InheritedDesignatedInitializers
537 != DefinitionData::IDI_Unknown);
538 return data().InheritedDesignatedInitializers ==
539 DefinitionData::IDI_Inherited;
540 }
541
542 llvm_unreachable("unexpected InheritedDesignatedInitializers value");
543}
544
547
549 return;
550 if (data().ExternallyCompleted)
551 LoadExternalDefinition();
552
553 const ObjCInterfaceDecl *IFace= findInterfaceWithDesignatedInitializers();
554 if (!IFace)
555 return;
556
558 if (MD->isThisDeclarationADesignatedInitializer())
559 Methods.push_back(MD);
561 for (const auto *MD : Ext->instance_methods())
562 if (MD->isThisDeclarationADesignatedInitializer())
563 Methods.push_back(MD);
564 }
565}
566
570
571
572
575 HasCompleteDef = true;
576
577
578 if (!HasCompleteDef)
579 return false;
580
581 if (data().ExternallyCompleted)
582 LoadExternalDefinition();
583
584 const ObjCInterfaceDecl *IFace= findInterfaceWithDesignatedInitializers();
585 if (!IFace)
586 return false;
587
589 if (MD->isThisDeclarationADesignatedInitializer()) {
590 if (InitMethod)
591 *InitMethod = MD;
592 return true;
593 }
594 }
596 if (const ObjCMethodDecl *MD = Ext->getInstanceMethod(Sel)) {
597 if (MD->isThisDeclarationADesignatedInitializer()) {
598 if (InitMethod)
599 *InitMethod = MD;
600 return true;
601 }
602 }
603 }
604 return false;
605}
606
607void ObjCInterfaceDecl::allocateDefinitionData() {
608 assert(() && "ObjC class already has a definition");
610 Data.getPointer()->Definition = this;
611}
612
614 allocateDefinitionData();
615
616
617 for (auto *RD : redecls()) {
618 if (RD != this)
619 RD->Data = Data;
620 }
621}
622
624 Data.setPointer(nullptr);
625 allocateDefinitionData();
626
627}
628
633
635 ObjCInterfaceDecl *&clsDeclared) {
636
638 return nullptr;
639
640 if (data().ExternallyCompleted)
641 LoadExternalDefinition();
642
643 ObjCInterfaceDecl* ClassDecl = this;
644 while (ClassDecl != nullptr) {
646 clsDeclared = ClassDecl;
647 return I;
648 }
649
651 if (ObjCIvarDecl *I = Ext->getIvarDecl(ID)) {
652 clsDeclared = ClassDecl;
653 return I;
654 }
655 }
656
658 }
659 return nullptr;
660}
661
662
663
664
667
669 return nullptr;
670
671 if (data().ExternallyCompleted)
672 LoadExternalDefinition();
673
674 ObjCInterfaceDecl* ClassDecl = this;
675 while (ClassDecl != nullptr) {
677 return ClassDecl;
679 }
680 return nullptr;
681}
682
686 if (P->lookupProtocolNamed(Name))
687 return P;
690}
691
692
693
694
695
697 bool isInstance,
698 bool shallowCategoryLookup,
699 bool followSuper,
701{
702
704 return nullptr;
705
706 const ObjCInterfaceDecl* ClassDecl = this;
708
709 if (data().ExternallyCompleted)
710 LoadExternalDefinition();
711
712 while (ClassDecl) {
713
714 if ((MethodDecl = ClassDecl->getMethod(Sel, isInstance)))
715 return MethodDecl;
716
717
719 if ((MethodDecl = Cat->getMethod(Sel, isInstance)))
720 if (C != Cat || !MethodDecl->isImplicit())
721 return MethodDecl;
722
723
724 for (const auto *I : ClassDecl->protocols())
725 if ((MethodDecl = I->lookupMethod(Sel, isInstance)))
726 return MethodDecl;
727
728
729 if (!shallowCategoryLookup)
731
733 Cat->getReferencedProtocols();
734 for (auto *Protocol : Protocols)
735 if ((MethodDecl = Protocol->lookupMethod(Sel, isInstance)))
736 if (C != Cat || !MethodDecl->isImplicit())
737 return MethodDecl;
738 }
739
740
741 if (!followSuper)
742 return nullptr;
743
744
746 }
747 return nullptr;
748}
749
750
751
752
755 bool Instance) const {
756
758 return nullptr;
759
760 if (data().ExternallyCompleted)
761 LoadExternalDefinition();
762
765 Method = Instance ? ImpDecl->getInstanceMethod(Sel)
766 : ImpDecl->getClassMethod(Sel);
767
768
771
772
773
774
777
778
781 }
782
786}
787
789 assert(hasDefinition() && "ODRHash only for records with definitions");
790
791
792 if (hasODRHash())
793 return data().ODRHash;
794
795
799 setHasODRHash(true);
800
801 return data().ODRHash;
802}
803
804bool ObjCInterfaceDecl::hasODRHash() const {
806 return false;
807 return data().HasODRHash;
808}
809
810void ObjCInterfaceDecl::setHasODRHash(bool HasHash) {
811 assert(hasDefinition() && "Cannot set ODRHash without definition");
812 data().HasODRHash = HasHash;
813}
814
815
816
817
818
819ObjCMethodDecl::ObjCMethodDecl(
822 bool isInstance, bool isVariadic, bool isPropertyAccessor,
823 bool isSynthesizedAccessorStub, bool isImplicitlyDeclared, bool isDefined,
825 : NamedDecl(ObjCMethod, contextDecl, beginLoc, SelInfo),
826 DeclContext(ObjCMethod), MethodDeclType(T), ReturnTInfo(ReturnTInfo),
827 DeclEndLoc(endLoc) {
828
829
832 setInstanceMethod(isInstance);
833 setVariadic(isVariadic);
834 setPropertyAccessor(isPropertyAccessor);
835 setSynthesizedAccessorStub(isSynthesizedAccessorStub);
836 setDefined(isDefined);
837 setIsRedeclaration(false);
838 setHasRedeclaration(false);
839 setDeclImplementation(impControl);
841 setRelatedResultType(HasRelatedResultType);
843 setOverriding(false);
844 setHasSkippedBody(false);
845
847}
848
854 bool isImplicitlyDeclared, bool isDefined,
856 return new (C, contextDecl) ObjCMethodDecl(
857 beginLoc, endLoc, SelInfo, T, ReturnTInfo, contextDecl, isInstance,
859 isImplicitlyDeclared, isDefined, impControl, HasRelatedResultType);
860}
861
867
872
877
879 if (const auto *PD = dyn_cast(getDeclContext()))
881 if (const auto *ID = dyn_cast(getDeclContext()))
883 return false;
884}
885
887 const ObjCMethodDecl **InitMethod) const {
889 return false;
892 return false;
894 return ID->isDesignatedInitializer(getSelector(), InitMethod);
895 return false;
896}
897
900 if (param->isDestroyedInCallee())
901 return true;
902 }
903 return false;
904}
905
909
911 assert(PrevMethod);
915}
916
917void ObjCMethodDecl::setParamsAndSelLocs(ASTContext &C,
920 ParamsAndSelLocs = nullptr;
921 NumParams = Params.size();
922 if (Params.empty() && SelLocs.empty())
923 return;
924
926 "Alignment not sufficient for SourceLocation");
927
928 unsigned Size = sizeof(ParmVarDecl *) * NumParams +
930 ParamsAndSelLocs = C.Allocate(Size);
931 llvm::uninitialized_copy(Params, getParams());
932 llvm::uninitialized_copy(SelLocs, getStoredSelLocs());
933}
934
940
944 assert((!SelLocs.empty() || isImplicit()) &&
945 "No selector locs for non-implicit method");
947 return setParamsAndSelLocs(C, Params, {});
948
950 DeclEndLoc));
952 return setParamsAndSelLocs(C, Params, {});
953
954 setParamsAndSelLocs(C, Params, SelLocs);
955}
956
957
958
959
965 if (Redecl)
966 return Redecl;
967
969
970 if (!CtxD->isInvalidDecl()) {
971 if (auto *IFD = dyn_cast(CtxD)) {
973 if (!ImplD->isInvalidDecl())
975
976 } else if (auto *CD = dyn_cast(CtxD)) {
978 if (!ImplD->isInvalidDecl())
980
981 } else if (auto *ImplD = dyn_cast(CtxD)) {
982 if (ObjCInterfaceDecl *IFD = ImplD->getClassInterface())
983 if (!IFD->isInvalidDecl())
985
986 } else if (auto *CImplD = dyn_cast(CtxD)) {
987 if (ObjCCategoryDecl *CatD = CImplD->getCategoryDecl())
988 if (!CatD->isInvalidDecl())
990 }
991 }
992
993
994
995
997 Redecl = nullptr;
998
1000
1003 true);
1004 }
1005
1006 return Redecl ? Redecl : this;
1007}
1008
1012
1013 if (auto *ImplD = dyn_cast(CtxD)) {
1015
1016
1017
1018
1019
1020
1021 if (ObjCMethodDecl *MD = IFD->getMethod(Sel, isInstanceMethod()))
1022 return MD;
1023 for (auto *Ext : IFD->known_extensions())
1024 if (ObjCMethodDecl *MD = Ext->getMethod(Sel, isInstanceMethod()))
1025 return MD;
1026 }
1027 } else if (auto *CImplD = dyn_cast(CtxD)) {
1029 if (ObjCMethodDecl *MD = CatD->getMethod(Sel, isInstanceMethod()))
1030 return MD;
1031 }
1032
1034
1035 ObjCMethodDecl *MD =
1037 true);
1038 return MD ? MD : this;
1039 }
1040
1041 return this;
1042}
1043
1046 return Body->getEndLoc();
1047 return DeclEndLoc;
1048}
1049
1053 return family;
1054
1055
1057
1058
1059 switch (attr->getFamily()) {
1060 case ObjCMethodFamilyAttr::OMF_None: family = OMF_None; break;
1061 case ObjCMethodFamilyAttr::OMF_alloc: family = OMF_alloc; break;
1062 case ObjCMethodFamilyAttr::OMF_copy: family = OMF_copy; break;
1063 case ObjCMethodFamilyAttr::OMF_init: family = OMF_init; break;
1064 case ObjCMethodFamilyAttr::OMF_mutableCopy: family = OMF_mutableCopy; break;
1065 case ObjCMethodFamilyAttr::OMF_new: family = OMF_new; break;
1066 }
1068 return family;
1069 }
1070
1072 switch (family) {
1074
1075
1076
1080 break;
1081
1082
1083
1088 if (()->isObjCObjectPointerType())
1090 break;
1091
1092
1102 break;
1103
1107 break;
1108
1112 else {
1114 if (noParams < 1 || noParams > 3)
1116 else {
1121 break;
1122 }
1123 while (--noParams) {
1124 it++;
1125 ArgT = (*it);
1128 break;
1129 }
1130 }
1131 }
1132 }
1133 break;
1134
1135 }
1136
1137
1139 return family;
1140}
1141
1144 bool &selfIsPseudoStrong,
1145 bool &selfIsConsumed) const {
1147 selfIsPseudoStrong = false;
1148 selfIsConsumed = false;
1150
1151
1152 if (OID) {
1153 selfTy = Context.getObjCInterfaceType(OID);
1154 selfTy = Context.getObjCObjectPointerType(selfTy);
1155 } else {
1156 selfTy = Context.getObjCIdType();
1157 }
1158 } else
1159 selfTy = Context.getObjCClassType();
1160
1161 if (Context.getLangOpts().ObjCAutoRefCount) {
1164
1165
1166
1169 selfTy = Context.getQualifiedType(selfTy, qs);
1170
1171
1174 selfIsPseudoStrong = true;
1175 }
1176 }
1177 else {
1179
1181 selfIsPseudoStrong = true;
1182 }
1183 }
1184 return selfTy;
1185}
1186
1189 bool selfIsPseudoStrong, selfIsConsumed;
1191 getSelfType(Context, OID, selfIsPseudoStrong, selfIsConsumed);
1193 &Context.Idents.get("self"), selfTy,
1196
1197 if (selfIsConsumed)
1198 Self->addAttr(NSConsumedAttr::CreateImplicit(Context));
1199
1200 if (selfIsPseudoStrong)
1201 Self->setARCPseudoStrong(true);
1202
1204 Context, this, SourceLocation(), &Context.Idents.get("_cmd"),
1206}
1207
1209 if (auto *ID = dyn_cast(getDeclContext()))
1210 return ID;
1211 if (auto *CD = dyn_cast(getDeclContext()))
1212 return CD->getClassInterface();
1213 if (auto *IMD = dyn_cast(getDeclContext()))
1214 return IMD->getClassInterface();
1216 return nullptr;
1217 llvm_unreachable("unknown method context");
1218}
1219
1221 if (auto *CD = dyn_cast(getDeclContext()))
1222 return CD;
1223 if (auto *IMD = dyn_cast(getDeclContext()))
1224 return IMD->getCategoryDecl();
1225 return nullptr;
1226}
1227
1230 if (TSI)
1231 return TSI->getTypeLoc().getSourceRange();
1233}
1234
1240
1248
1252 bool MovedToSuper) {
1253 if (!Container)
1254 return;
1255
1256
1257
1258
1259 if (const auto *Category = dyn_cast(Container)) {
1260
1261
1262 if (MovedToSuper)
1264 Overridden = Container->getMethod(Method->getSelector(),
1265 Method->isInstanceMethod(),
1266 true))
1267 if (Method != Overridden) {
1268
1269
1270 Methods.push_back(Overridden);
1271 return;
1272 }
1273
1274 for (const auto *P : Category->protocols())
1276 return;
1277 }
1278
1279
1281 Overridden = Container->getMethod(Method->getSelector(),
1282 Method->isInstanceMethod(),
1283 true))
1284 if (Method != Overridden) {
1285
1286
1287 Methods.push_back(Overridden);
1288 return;
1289 }
1290
1291 if (const auto *Protocol = dyn_cast(Container)){
1292 for (const auto *P : Protocol->protocols())
1294 }
1295
1296 if (const auto *Interface = dyn_cast(Container)) {
1297 for (const auto *P : Interface->protocols())
1299
1300 for (const auto *Cat : Interface->known_categories())
1302
1305 true);
1306 }
1307}
1308
1315
1318 assert(Method->isOverriding());
1319
1320 if (const auto *ProtD =
1321 dyn_cast(Method->getDeclContext())) {
1323
1324 } else if (const auto *IMD =
1325 dyn_cast(Method->getDeclContext())) {
1327 if (!ID)
1328 return;
1329
1330
1331 if (const ObjCMethodDecl *IFaceMeth = ID->getMethod(Method->getSelector(),
1332 Method->isInstanceMethod(),
1333 true))
1334 Method = IFaceMeth;
1336
1337 } else if (const auto *CatD =
1338 dyn_cast(Method->getDeclContext())) {
1340 if (!ID)
1341 return;
1342
1343
1344 if (const ObjCMethodDecl *IFaceMeth = ID->getMethod(Method->getSelector(),
1345 Method->isInstanceMethod(),
1346 true))
1347 Method = IFaceMeth;
1349
1350 } else {
1352 dyn_cast_or_null(Method->getDeclContext()),
1353 Method, overridden);
1354 }
1355}
1356
1359 const ObjCMethodDecl *Method = this;
1360
1361 if (Method->isRedeclaration()) {
1363 ->getMethod(Method->getSelector(), Method->isInstanceMethod(),
1364 true);
1365 }
1366
1367 if (Method->isOverriding()) {
1369 assert(!Overridden.empty() &&
1370 "ObjCMethodDecl's overriding bit is not as expected");
1371 }
1372}
1373
1377 unsigned NumArgs = Sel.getNumArgs();
1378 if (NumArgs > 1)
1379 return nullptr;
1380
1383
1384 if (auto *ImplDecl = dyn_cast(Container))
1386 Container = ImplDecl->getClassInterface();
1387
1388 bool IsGetter = (NumArgs == 0);
1390
1391
1392
1393 auto findMatchingProperty =
1395 if (IsInstance) {
1396 for (const auto *I : Container->instance_properties()) {
1397 Selector NextSel = IsGetter ? I->getGetterName()
1398 : I->getSetterName();
1399 if (NextSel == Sel)
1400 return I;
1401 }
1402 } else {
1403 for (const auto *I : Container->class_properties()) {
1404 Selector NextSel = IsGetter ? I->getGetterName()
1405 : I->getSetterName();
1406 if (NextSel == Sel)
1407 return I;
1408 }
1409 }
1410
1411 return nullptr;
1412 };
1413
1414
1415 if (const auto *Found = findMatchingProperty(Container))
1417
1418
1420 if (const auto *Category = dyn_cast(Container)) {
1421 ClassDecl = Category->getClassInterface();
1422 if (const auto *Found = findMatchingProperty(ClassDecl))
1424 } else {
1425
1427 }
1428 assert(ClassDecl && "Failed to find main class");
1429
1430
1432 if (Ext == Container)
1433 continue;
1434 if (const auto *Found = findMatchingProperty(Ext))
1436 }
1437
1439
1441 if (Cat == Container)
1442 continue;
1443 if (const auto *Found = findMatchingProperty(Cat))
1445 }
1446
1447 llvm_unreachable("Marked as a property accessor but no property found!");
1448 }
1449
1450 if (!CheckOverrides)
1451 return nullptr;
1452
1454
1455 OverridesTy Overrides;
1457 for (const auto *Override : Overrides)
1459 return Prop;
1460
1461 return nullptr;
1462}
1463
1464
1465
1466
1467
1468void ObjCTypeParamDecl::anchor() {}
1469
1478 auto *TPDecl =
1479 new (ctx, dc) ObjCTypeParamDecl(ctx, dc, variance, varianceLoc, index,
1480 nameLoc, name, colonLoc, boundInfo);
1482 TPDecl->setTypeForDecl(TPType.getTypePtr());
1483 return TPDecl;
1484}
1485
1488 return new (ctx, ID) ObjCTypeParamDecl(ctx, nullptr,
1492}
1493
1506
1507
1508
1509
1510ObjCTypeParamList::ObjCTypeParamList(SourceLocation lAngleLoc,
1513 : Brackets(lAngleLoc, rAngleLoc), NumParams(typeParams.size()) {
1514 llvm::copy(typeParams, begin());
1515}
1516
1522 void *mem =
1523 ctx.Allocate(totalSizeToAlloc<ObjCTypeParamDecl *>(typeParams.size()),
1524 alignof(ObjCTypeParamList));
1525 return new (mem) ObjCTypeParamList(lAngleLoc, typeParams, rAngleLoc);
1526}
1527
1530 typeArgs.reserve(size());
1531 for (auto *typeParam : *this)
1532 typeArgs.push_back(typeParam->getUnderlyingType());
1533}
1534
1535
1536
1537
1538
1542 ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc, bool isInternal) {
1543 auto *Result = new (C, DC)
1544 ObjCInterfaceDecl(C, DC, atLoc, Id, typeParamList, ClassLoc, PrevDecl,
1545 isInternal);
1546 Result->Data.setInt(.getLangOpts().Modules);
1547 C.getObjCInterfaceType(Result, PrevDecl);
1549}
1550
1553 auto *Result = new (C, ID)
1554 ObjCInterfaceDecl(C, nullptr, SourceLocation(), nullptr, nullptr,
1556 Result->Data.setInt(.getLangOpts().Modules);
1558}
1559
1560ObjCInterfaceDecl::ObjCInterfaceDecl(
1565 redeclarable_base(C) {
1567
1568
1569 if (PrevDecl)
1570 Data = PrevDecl->Data;
1571
1573
1575}
1576
1577void ObjCInterfaceDecl::LoadExternalDefinition() const {
1578 assert(data().ExternallyCompleted && "Class is not externally completed");
1579 data().ExternallyCompleted = false;
1582}
1583
1586 "Class can't be externally completed without an external source");
1588 "Forward declarations can't be externally completed");
1589 data().ExternallyCompleted = true;
1590}
1591
1593
1595 return;
1596 data().HasDesignatedInitializers = true;
1597}
1598
1600
1602 return false;
1603 if (data().ExternallyCompleted)
1604 LoadExternalDefinition();
1605
1606 return data().HasDesignatedInitializers;
1607}
1608
1609StringRef
1612 return ObjCRTName->getMetadataName();
1613
1615}
1616
1617StringRef
1621 return ID->getObjCRuntimeNameAsString();
1622
1624}
1625
1627 if (const ObjCInterfaceDecl *Def = getDefinition()) {
1628 if (data().ExternallyCompleted)
1629 LoadExternalDefinition();
1630
1632 const_cast<ObjCInterfaceDecl*>(Def));
1633 }
1634
1635
1636 return nullptr;
1637}
1638
1642
1643namespace {
1644
1645struct SynthesizeIvarChunk {
1646 uint64_t Size;
1648
1649 SynthesizeIvarChunk(uint64_t size, ObjCIvarDecl *ivar)
1650 : Size(size), Ivar(ivar) {}
1651};
1652
1653bool operator<(const SynthesizeIvarChunk & LHS,
1654 const SynthesizeIvarChunk &RHS) {
1655 return LHS.Size < RHS.Size;
1656}
1657
1658}
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1670
1672 return nullptr;
1673
1675 if (!data().IvarList) {
1676
1679 (void)Ext->ivar_empty();
1680 }
1683 data().IvarList = *I; ++I;
1684 for (curIvar = data().IvarList; I != E; curIvar = *I, ++I)
1686 }
1687
1689 if (!Ext->ivar_empty()) {
1691 I = Ext->ivar_begin(),
1692 E = Ext->ivar_end();
1693 if (!data().IvarList) {
1694 data().IvarList = *I; ++I;
1695 curIvar = data().IvarList;
1696 }
1697 for ( ;I != E; curIvar = *I, ++I)
1699 }
1700 }
1701 data().IvarListMissingImplementation = true;
1702 }
1703
1704
1705 if (!data().IvarListMissingImplementation)
1706 return data().IvarList;
1707
1709 data().IvarListMissingImplementation = false;
1710 if (!ImplDecl->ivar_empty()) {
1712 for (auto *IV : ImplDecl->ivars()) {
1713 if (IV->getSynthesize() && !IV->isInvalidDecl()) {
1714 layout.push_back(SynthesizeIvarChunk(
1715 IV->getASTContext().getTypeSize(IV->getType()), IV));
1716 continue;
1717 }
1718 if (!data().IvarList)
1719 data().IvarList = IV;
1720 else
1722 curIvar = IV;
1723 }
1724
1725 if (!layout.empty()) {
1726
1727 llvm::stable_sort(layout);
1728 unsigned Ix = 0, EIx = layout.size();
1729 if (!data().IvarList) {
1730 data().IvarList = layout[0].Ivar; Ix++;
1731 curIvar = data().IvarList;
1732 }
1733 for ( ; Ix != EIx; curIvar = layout[Ix].Ivar, Ix++)
1735 }
1736 }
1737 }
1738 return data().IvarList;
1739}
1740
1741
1742
1743
1744
1747
1749 return nullptr;
1750
1751 if (data().ExternallyCompleted)
1752 LoadExternalDefinition();
1753
1755 if (Cat->getIdentifier() == CategoryId)
1756 return Cat;
1757
1758 return nullptr;
1759}
1760
1765 if (ObjCMethodDecl *MD = Impl->getInstanceMethod(Sel))
1766 return MD;
1767 }
1768
1769 return nullptr;
1770}
1771
1776 return MD;
1777 }
1778
1779 return nullptr;
1780}
1781
1782
1783
1784
1786 bool lookupCategory,
1787 bool RHSIsQualifiedID) {
1789 return false;
1790
1791 ObjCInterfaceDecl *IDecl = this;
1792
1793 for (auto *PI : IDecl->protocols()){
1794 if (getASTContext().ProtocolCompatibleWithProtocol(lProto, PI))
1795 return true;
1796
1797
1798
1799
1800
1801
1802 if (RHSIsQualifiedID &&
1803 getASTContext().ProtocolCompatibleWithProtocol(PI, lProto))
1804 return true;
1805 }
1806
1807
1808 if (lookupCategory)
1810 for (auto *PI : Cat->protocols())
1811 if (getASTContext().ProtocolCompatibleWithProtocol(lProto, PI))
1812 return true;
1813 }
1814
1815
1817 return
1819 RHSIsQualifiedID);
1820
1821 return false;
1822}
1823
1824
1825
1826
1827
1828void ObjCIvarDecl::anchor() {}
1829
1835 Expr *BW, bool synthesized) {
1836 if (DC) {
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1849 "Invalid ivar decl context!");
1850
1851
1852 auto *ID = dyn_cast(DC);
1853 if (!ID) {
1854 if (auto *IM = dyn_cast(DC))
1855 ID = IM->getClassInterface();
1856 else
1858 }
1859 ID->setIvarList(nullptr);
1860 }
1861
1862 return new (C, DC) ObjCIvarDecl(DC, StartLoc, IdLoc, Id, T, TInfo, ac, BW,
1863 synthesized);
1864}
1865
1868 nullptr, QualType(), nullptr,
1870}
1871
1874
1875 switch (DC->getKind()) {
1876 default:
1877 case ObjCCategoryImpl:
1878 case ObjCProtocol:
1879 llvm_unreachable("invalid ivar container!");
1880
1881
1882 case ObjCCategory: {
1884 assert(CD->IsClassExtension() && "invalid container for ivar!");
1885 return CD->getClassInterface();
1886 }
1887
1888 case ObjCImplementation:
1890
1891 case ObjCInterface:
1893 }
1894}
1895
1900
1901
1902
1903
1904
1905void ObjCAtDefsFieldDecl::anchor() {}
1906
1911 return new (C, DC) ObjCAtDefsFieldDecl(DC, StartLoc, IdLoc, Id, T, BW);
1912}
1913
1916 return new (C, ID) ObjCAtDefsFieldDecl(nullptr, SourceLocation(),
1918 nullptr);
1919}
1920
1921
1922
1923
1924
1925void ObjCProtocolDecl::anchor() {}
1926
1932 redeclarable_base(C) {
1933 setPreviousDecl(PrevDecl);
1934 if (PrevDecl)
1935 Data = PrevDecl->Data;
1936}
1937
1942 ObjCProtocolDecl *PrevDecl) {
1944 new (C, DC) ObjCProtocolDecl(C, DC, Id, nameLoc, atStartLoc, PrevDecl);
1945 Result->Data.setInt(.getLangOpts().Modules);
1947}
1948
1951 ObjCProtocolDecl *Result =
1952 new (C, ID) ObjCProtocolDecl(C, nullptr, nullptr, SourceLocation(),
1954 Result->Data.setInt(.getLangOpts().Modules);
1956}
1957
1961
1963 llvm::DenseSet<const ObjCProtocolDecl *> &IPs) const {
1964 std::queue<const ObjCProtocolDecl *> WorkQueue;
1965 WorkQueue.push(this);
1966
1967 while (!WorkQueue.empty()) {
1968 const auto *PD = WorkQueue.front();
1969 WorkQueue.pop();
1970 for (const auto *Parent : PD->protocols()) {
1971 const auto *Can = Parent->getCanonicalDecl();
1972 auto Result = IPs.insert(Can);
1974 WorkQueue.push(Parent);
1975 }
1976 }
1977}
1978
1980 ObjCProtocolDecl *PDecl = this;
1981
1983 return PDecl;
1984
1987 return PDecl;
1988
1989 return nullptr;
1990}
1991
1992
1993
1995 bool isInstance) const {
1997
1998
1999
2002 return nullptr;
2003
2004 if ((MethodDecl = getMethod(Sel, isInstance)))
2005 return MethodDecl;
2006
2007 for (const auto *I : protocols())
2008 if ((MethodDecl = I->lookupMethod(Sel, isInstance)))
2009 return MethodDecl;
2010 return nullptr;
2011}
2012
2013void ObjCProtocolDecl::allocateDefinitionData() {
2014 assert(.getPointer() && "Protocol already has a definition!");
2016 Data.getPointer()->Definition = this;
2017 Data.getPointer()->HasODRHash = false;
2018}
2019
2021 allocateDefinitionData();
2022
2023
2024 for (auto *RD : redecls())
2025 RD->Data = this->Data;
2026}
2027
2029 Data.setPointer(nullptr);
2030 allocateDefinitionData();
2031
2032}
2033
2038
2040 if (const ObjCProtocolDecl *PDecl = getDefinition()) {
2041 for (auto *Prop : PDecl->properties()) {
2042
2043 PM.insert(std::make_pair(
2044 std::make_pair(Prop->getIdentifier(), Prop->isClassProperty()),
2045 Prop));
2046 }
2047
2048 for (const auto *PI : PDecl->protocols())
2049 PI->collectPropertiesToImplement(PM);
2050 }
2051}
2052
2056 if (const ObjCProtocolDecl *PDecl = getDefinition()) {
2057 if (!PS.insert(PDecl).second)
2058 return;
2059 for (auto *Prop : PDecl->properties()) {
2061 continue;
2062 if (Prop->getIdentifier() == Property->getIdentifier()) {
2063 PO.push_back(Prop);
2064 return;
2065 }
2066 }
2067
2068 for (const auto *PI : PDecl->protocols())
2069 PI->collectInheritedProtocolProperties(Property, PS, PO);
2070 }
2071}
2072
2073StringRef
2076 return ObjCRTName->getMetadataName();
2077
2079}
2080
2082 assert(hasDefinition() && "ODRHash only for records with definitions");
2083
2084
2085 if (hasODRHash())
2086 return data().ODRHash;
2087
2088
2092 setHasODRHash(true);
2093
2094 return data().ODRHash;
2095}
2096
2097bool ObjCProtocolDecl::hasODRHash() const {
2099 return false;
2100 return data().HasODRHash;
2101}
2102
2103void ObjCProtocolDecl::setHasODRHash(bool HasHash) {
2104 assert(hasDefinition() && "Cannot set ODRHash without definition");
2105 data().HasODRHash = HasHash;
2106}
2107
2108
2109
2110
2111
2112void ObjCCategoryDecl::anchor() {}
2113
2114ObjCCategoryDecl::ObjCCategoryDecl(
2120 ClassInterface(IDecl), CategoryNameLoc(CategoryNameLoc),
2121 IvarLBraceLoc(IvarLBraceLoc), IvarRBraceLoc(IvarRBraceLoc) {
2122 setTypeParamList(typeParamList);
2123}
2124
2131 auto *CatDecl =
2132 new (C, DC) ObjCCategoryDecl(DC, AtLoc, ClassNameLoc, CategoryNameLoc, Id,
2133 IDecl, typeParamList, IvarLBraceLoc,
2134 IvarRBraceLoc);
2135 if (IDecl) {
2136
2141 L->AddedObjCCategoryToInterface(CatDecl, IDecl);
2142 }
2143 }
2144
2145 return CatDecl;
2146}
2147
2150 return new (C, ID) ObjCCategoryDecl(nullptr, SourceLocation(),
2152 nullptr, nullptr, nullptr);
2153}
2154
2157 const_cast<ObjCCategoryDecl*>(this));
2158}
2159
2163
2165 TypeParamList = TPL;
2166 if (!TPL)
2167 return;
2168
2169 for (auto *typeParam : *TypeParamList)
2170 typeParam->setDeclContext(this);
2171}
2172
2173
2174
2175
2176
2177void ObjCCategoryImplDecl::anchor() {}
2178
2183 if (ClassInterface && ClassInterface->hasDefinition())
2184 ClassInterface = ClassInterface->getDefinition();
2185 return new (C, DC) ObjCCategoryImplDecl(DC, Id, ClassInterface, nameLoc,
2186 atStartLoc, CategoryNameLoc);
2187}
2188
2191 return new (C, ID) ObjCCategoryImplDecl(nullptr, nullptr, nullptr,
2194}
2195
2197
2199 return ID->FindCategoryDeclaration(getIdentifier());
2200 return nullptr;
2201}
2202
2203void ObjCImplDecl::anchor() {}
2204
2210
2213
2214 if (auto *ImplD = dyn_cast_or_null(this)) {
2215 if (IFace)
2217
2218 } else if (auto *ImplD = dyn_cast_or_null(this)) {
2221 }
2222
2223 ClassInterface = IFace;
2224}
2225
2226
2227
2228
2232 if (PID->getPropertyIvarDecl() &&
2233 PID->getPropertyIvarDecl()->getIdentifier() == ivarId)
2234 return PID;
2235 return nullptr;
2236}
2237
2238
2239
2240
2246
2247
2248 if (PID->getPropertyDecl()->getIdentifier() == Id) {
2250 !PID->getPropertyDecl()->isClassProperty()) ||
2252 PID->getPropertyDecl()->isClassProperty()) ||
2254 !PID->getPropertyDecl()->isClassProperty()))
2255 return PID;
2256
2257 if (PID->getPropertyDecl()->isClassProperty())
2258 ClassPropImpl = PID;
2259 }
2260
2262
2263 return ClassPropImpl;
2264
2265 return nullptr;
2266}
2267
2273
2274
2275
2276
2277
2278void ObjCImplementationDecl::anchor() {}
2279
2289 if (ClassInterface && ClassInterface->hasDefinition())
2290 ClassInterface = ClassInterface->getDefinition();
2291 return new (C, DC) ObjCImplementationDecl(DC, ClassInterface, SuperDecl,
2292 nameLoc, atStartLoc, superLoc,
2293 IvarLBraceLoc, IvarRBraceLoc);
2294}
2295
2298 return new (C, ID) ObjCImplementationDecl(nullptr, nullptr, nullptr,
2300}
2301
2304 unsigned numInitializers) {
2305 if (numInitializers > 0) {
2306 NumIvarInitializers = numInitializers;
2307 auto **ivarInitializers = new (C) CXXCtorInitializer*[NumIvarInitializers];
2308 memcpy(ivarInitializers, initializers,
2310 IvarInitializers = ivarInitializers;
2311 }
2312}
2313
2316 return IvarInitializers.get(getASTContext().getExternalSource());
2317}
2318
2321 OS << ID.getName();
2322 return OS;
2323}
2324
2325
2326
2327
2328
2329void ObjCCompatibleAliasDecl::anchor() {}
2330
2336 return new (C, DC) ObjCCompatibleAliasDecl(DC, L, Id, AliasedClass);
2337}
2338
2341 return new (C, ID) ObjCCompatibleAliasDecl(nullptr, SourceLocation(),
2342 nullptr, nullptr);
2343}
2344
2345
2346
2347
2348
2349void ObjCPropertyDecl::anchor() {}
2350
2356 return new (C, DC) ObjCPropertyDecl(DC, L, Id, AtLoc, LParenLoc, T, TSI,
2357 propControl);
2358}
2359
2362 return new (C, ID) ObjCPropertyDecl(nullptr, SourceLocation(), nullptr,
2365}
2366
2371
2376
2377
2378
2379
2380
2389 return new (C, DC) ObjCPropertyImplDecl(DC, atLoc, L, property, PK, ivar,
2390 ivarLoc);
2391}
2392
2395 return new (C, ID) ObjCPropertyImplDecl(nullptr, SourceLocation(),
2398}
2399
2402 if (IvarLoc.isValid())
2403 EndLoc = IvarLoc;
2404
2406}
Defines the clang::ASTContext interface.
static void CollectOverriddenMethodsRecurse(const ObjCContainerDecl *Container, const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &Methods, bool MovedToSuper)
Definition DeclObjC.cpp:1249
static bool isIntroducingInitializers(const ObjCInterfaceDecl *D)
Definition DeclObjC.cpp:493
static void collectOverriddenMethodsSlow(const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &overridden)
Definition DeclObjC.cpp:1316
static void CollectOverriddenMethods(const ObjCContainerDecl *Container, const ObjCMethodDecl *Method, SmallVectorImpl< const ObjCMethodDecl * > &Methods)
Definition DeclObjC.cpp:1309
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 ...
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
const LangOptions & getLangOpts() const
IdentifierInfo * getNSObjectName() const
Retrieve the identifier 'NSObject'.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
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.
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.
lookup_result::iterator lookup_iterator
DeclContextLookupResult lookup_result
ObjCMethodDeclBitfields ObjCMethodDeclBits
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
DeclContext(Decl::Kind K)
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.
virtual Decl * getNextRedeclarationImpl()
Returns the next redeclaration or itself if this is the only decl.
SourceLocation getLocation() const
void setImplicit(bool I=true)
DeclContext * getDeclContext()
void setLexicalDeclContext(DeclContext *DC)
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.
NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
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, GlobalDeclID ID)
Definition DeclObjC.cpp:1914
static ObjCAtDefsFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, Expr *BW)
Definition DeclObjC.cpp:1908
ObjCCategoryDecl - Represents a category declaration.
static ObjCCategoryDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, const IdentifierInfo *Id, ObjCInterfaceDecl *IDecl, ObjCTypeParamList *typeParamList, SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
Definition DeclObjC.cpp:2125
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this category.
Definition DeclObjC.cpp:2164
static ObjCCategoryDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:2148
ObjCCategoryImplDecl * getImplementation() const
Definition DeclObjC.cpp:2155
specific_decl_iterator< ObjCIvarDecl > ivar_iterator
void setImplementation(ObjCCategoryImplDecl *ImplD)
Definition DeclObjC.cpp:2160
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCCategoryDecl * getCategoryDecl() const
Definition DeclObjC.cpp:2196
static ObjCCategoryImplDecl * Create(ASTContext &C, DeclContext *DC, const IdentifierInfo *Id, ObjCInterfaceDecl *classInterface, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation CategoryNameLoc)
Definition DeclObjC.cpp:2179
static ObjCCategoryImplDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:2190
ObjCCompatibleAliasDecl - Represents alias of a class.
static ObjCCompatibleAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, ObjCInterfaceDecl *aliasedClass)
Definition DeclObjC.cpp:2332
static ObjCCompatibleAliasDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:2340
ObjCContainerDecl - Represents a container for method declarations.
ObjCMethodDecl * getMethod(Selector Sel, bool isInstance, bool AllowHidden=false) const
Definition DeclObjC.cpp:90
void setAtStartLoc(SourceLocation Loc)
instmeth_range instance_methods() const
llvm::SmallDenseSet< const ObjCProtocolDecl *, 8 > ProtocolPropertySet
ObjCPropertyDecl * getProperty(const IdentifierInfo *Id, bool IsInstance) const
Definition DeclObjC.cpp:233
ObjCIvarDecl * getIvarDecl(IdentifierInfo *Id) const
getIvarDecl - This method looks up an ivar in this ContextDecl.
Definition DeclObjC.cpp:78
llvm::MapVector< std::pair< IdentifierInfo *, unsigned >, ObjCPropertyDecl * > PropertyMap
ObjCPropertyDecl * FindPropertyDeclaration(const IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const
FindPropertyDeclaration - Finds declaration of the property given its name in 'PropertyId' and return...
Definition DeclObjC.cpp:247
llvm::SmallVector< ObjCPropertyDecl *, 8 > PropertyDeclOrder
prop_range properties() const
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
ObjCContainerDecl(Kind DK, DeclContext *DC, const IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc)
Definition DeclObjC.cpp:65
bool HasUserDeclaredSetterMethod(const ObjCPropertyDecl *P) const
This routine returns 'true' if a user declared setter method was found in the class,...
Definition DeclObjC.cpp:122
void addPropertyImplementation(ObjCPropertyImplDecl *property)
Definition DeclObjC.cpp:2205
propimpl_range property_impls() const
void setClassInterface(ObjCInterfaceDecl *IFace)
Definition DeclObjC.cpp:2211
ObjCPropertyImplDecl * FindPropertyImplDecl(IdentifierInfo *propertyId, ObjCPropertyQueryKind queryKind) const
FindPropertyImplDecl - This method looks up a previous ObjCPropertyImplDecl added to the list of thos...
Definition DeclObjC.cpp:2242
const ObjCInterfaceDecl * getClassInterface() const
ObjCPropertyImplDecl * FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const
FindPropertyImplIvarDecl - This method lookup the ivar in the list of properties implemented in this ...
Definition DeclObjC.cpp:2230
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
static ObjCImplementationDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:2297
static ObjCImplementationDecl * Create(ASTContext &C, DeclContext *DC, ObjCInterfaceDecl *classInterface, ObjCInterfaceDecl *superDecl, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation superLoc=SourceLocation(), SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
Definition DeclObjC.cpp:2281
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
Definition DeclObjC.cpp:1618
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)
Definition DeclObjC.cpp:2302
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...
Definition DeclObjC.cpp:439
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
Definition DeclObjC.cpp:319
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...
Definition DeclObjC.cpp:665
ivar_iterator ivar_end() const
ObjCPropertyDecl * FindPropertyVisibleInPrimaryClass(const IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const
FindPropertyVisibleInPrimaryClass - Finds declaration of the property with name 'PropertyId' in the p...
Definition DeclObjC.cpp:379
ObjCMethodDecl * getCategoryMethod(Selector Sel, bool isInstance) const
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, const IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
Definition DeclObjC.cpp:1539
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
Definition DeclObjC.cpp:634
void setCategoryListRaw(ObjCCategoryDecl *category)
Set the raw pointer to the start of the category/extension list.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
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...
Definition DeclObjC.cpp:1669
ObjCCategoryDecl * FindCategoryDeclaration(const IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
Definition DeclObjC.cpp:1745
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.
Definition DeclObjC.cpp:788
void setImplementation(ObjCImplementationDecl *ImplD)
Definition DeclObjC.cpp:1639
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...
Definition DeclObjC.cpp:429
SourceLocation getSuperClassLoc() const
Retrieve the starting location of the superclass.
Definition DeclObjC.cpp:369
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...
Definition DeclObjC.cpp:1584
ObjCMethodDecl * getCategoryClassMethod(Selector Sel) const
Definition DeclObjC.cpp:1772
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.
ObjCMethodDecl * lookupPrivateMethod(const Selector &Sel, bool Instance=true) const
Lookup a method in the classes implementation hierarchy.
Definition DeclObjC.cpp:753
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this class.
Definition DeclObjC.cpp:340
ObjCMethodDecl * getCategoryInstanceMethod(Selector Sel) const
Definition DeclObjC.cpp:1762
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,...
Definition DeclObjC.cpp:696
ObjCProtocolDecl * lookupNestedProtocol(IdentifierInfo *Name)
Definition DeclObjC.cpp:684
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class,...
Definition DeclObjC.cpp:1785
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
Definition DeclObjC.cpp:1610
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
ObjCImplementationDecl * getImplementation() const
Definition DeclObjC.cpp:1626
static ObjCInterfaceDecl * CreateDeserialized(const ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:1551
bool hasDesignatedInitializers() const
Returns true if this interface decl contains at least one initializer marked with the 'objc_designate...
Definition DeclObjC.cpp:1599
void getDesignatedInitializers(llvm::SmallVectorImpl< const ObjCMethodDecl * > &Methods) const
Returns the designated initializers for the interface.
Definition DeclObjC.cpp:545
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
Definition DeclObjC.cpp:613
ObjCInterfaceDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
void collectPropertiesToImplement(PropertyMap &PM) const override
This routine collects list of properties to be implemented in the class.
Definition DeclObjC.cpp:402
bool isArcWeakrefUnavailable() const
isArcWeakrefUnavailable - Checks for a class or one of its super classes to be incompatible with __we...
Definition DeclObjC.cpp:419
visible_categories_range visible_categories() const
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
ObjCInterfaceDecl * getSuperClass() const
Definition DeclObjC.cpp:349
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.
Definition DeclObjC.cpp:567
void startDuplicateDefinitionForComparison()
Starts the definition without sharing it with other redeclarations.
Definition DeclObjC.cpp:623
void setHasDesignatedInitializers()
Indicate that this interface decl contains at least one initializer marked with the 'objc_designated_...
Definition DeclObjC.cpp:1592
specific_decl_iterator< ObjCIvarDecl > ivar_iterator
void mergeDuplicateDefinitionWithCommon(const ObjCInterfaceDecl *Definition)
Definition DeclObjC.cpp:629
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...
Definition DeclObjC.cpp:1872
static ObjCIvarDecl * Create(ASTContext &C, ObjCContainerDecl *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW=nullptr, bool synthesized=false)
Definition DeclObjC.cpp:1830
static ObjCIvarDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:1866
QualType getUsageType(QualType objectType) const
Retrieve the type of this instance variable when viewed as a member of a specific object type.
Definition DeclObjC.cpp:1896
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)
Definition DeclObjC.cpp:42
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.
Definition DeclObjC.cpp:886
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.
Definition DeclObjC.cpp:1357
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)
Definition DeclObjC.cpp:849
void setHasRedeclaration(bool HRD) const
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
Definition DeclObjC.cpp:1375
QualType getSendResultType() const
Determine the type of an expression that sends a message to this function.
Definition DeclObjC.cpp:1235
bool hasParamDestroyedInCallee() const
True if the method has a parameter that's destroyed in the callee.
Definition DeclObjC.cpp:898
void setIsRedeclaration(bool RD)
void setCmdDecl(ImplicitParamDecl *CD)
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition DeclObjC.cpp:906
ObjCMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Definition DeclObjC.cpp:1009
SourceLocation getEndLoc() const LLVM_READONLY
Definition DeclObjC.cpp:1044
TypeSourceInfo * getReturnTypeSourceInfo() const
QualType getSelfType(ASTContext &Context, const ObjCInterfaceDecl *OID, bool &selfIsPseudoStrong, bool &selfIsConsumed) const
Definition DeclObjC.cpp:1142
bool hasRedeclaration() const
True if redeclared in the same interface.
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs={})
Sets the method's parameters and selector source locations.
Definition DeclObjC.cpp:941
void setAsRedeclaration(const ObjCMethodDecl *PrevMethod)
Definition DeclObjC.cpp:910
param_type_iterator param_type_begin() const
bool isSynthesizedAccessorStub() const
SourceLocation getSelectorLoc(unsigned Index) const
SourceRange getReturnTypeSourceRange() const
Definition DeclObjC.cpp:1228
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.
Definition DeclObjC.cpp:868
Selector getSelector() const
bool isInstanceMethod() const
static ObjCMethodDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:862
bool isThisDeclarationADesignatedInitializer() const
Returns true if this specific method declaration is marked with the designated initializer attribute.
Definition DeclObjC.cpp:873
llvm::mapped_iterator< param_const_iterator, GetTypeFn > param_type_iterator
ObjCCategoryDecl * getCategory()
If this method is declared or implemented in a category, return that category.
Definition DeclObjC.cpp:1220
bool definedInNSObject(const ASTContext &) const
Is this method defined in the NSObject base class?
Definition DeclObjC.cpp:878
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
Definition DeclObjC.cpp:1050
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
createImplicitParams - Used to lazily create the self and cmd implicit parameters.
Definition DeclObjC.cpp:1187
QualType getReturnType() const
unsigned getNumSelectorLocs() const
bool isClassMethod() const
ObjCInterfaceDecl * getClassInterface()
Definition DeclObjC.cpp:1208
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
Definition DeclObjC.cpp:935
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.
Definition DeclObjC.cpp:2367
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID, ObjCPropertyQueryKind queryKind)
Lookup a property by name in the specified DeclContext.
Definition DeclObjC.cpp:176
static ObjCPropertyDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:2360
bool isDirectProperty() const
Definition DeclObjC.cpp:2372
IdentifierInfo * getDefaultSynthIvarName(ASTContext &Ctx) const
Get the default name of the synthesized ivar.
Definition DeclObjC.cpp:224
static ObjCPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, const IdentifierInfo *Id, SourceLocation AtLocation, SourceLocation LParenLocation, QualType T, TypeSourceInfo *TSI, PropertyControl propControl=None)
Definition DeclObjC.cpp:2352
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
static ObjCPropertyImplDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:2394
static ObjCPropertyImplDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation atLoc, SourceLocation L, ObjCPropertyDecl *property, Kind PK, ObjCIvarDecl *ivarDecl, SourceLocation ivarLoc)
Definition DeclObjC.cpp:2381
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition DeclObjC.cpp:2400
Represents an Objective-C protocol declaration.
void mergeDuplicateDefinitionWithCommon(const ObjCProtocolDecl *Definition)
Definition DeclObjC.cpp:2034
void startDuplicateDefinitionForComparison()
Starts the definition without sharing it with other redeclarations.
Definition DeclObjC.cpp:2028
bool hasDefinition() const
Determine whether this protocol has a definition.
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance) const
Definition DeclObjC.cpp:1994
static ObjCProtocolDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc, ObjCProtocolDecl *PrevDecl)
Definition DeclObjC.cpp:1938
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for protocol's metadata.
Definition DeclObjC.cpp:2074
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
void getImpliedProtocols(llvm::DenseSet< const ObjCProtocolDecl * > &IPs) const
Get the set of all protocols implied by this protocols inheritance hierarchy.
Definition DeclObjC.cpp:1962
void startDefinition()
Starts the definition of this Objective-C protocol.
Definition DeclObjC.cpp:2020
static ObjCProtocolDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Definition DeclObjC.cpp:1949
bool isNonRuntimeProtocol() const
This is true iff the protocol is tagged with the objc_non_runtime_protocol attribute.
Definition DeclObjC.cpp:1958
void collectInheritedProtocolProperties(const ObjCPropertyDecl *Property, ProtocolPropertySet &PS, PropertyDeclOrder &PO) const
Definition DeclObjC.cpp:2053
ObjCProtocolDecl * lookupProtocolNamed(IdentifierInfo *PName)
Definition DeclObjC.cpp:1979
protocol_range protocols() const
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition DeclObjC.cpp:2081
void collectPropertiesToImplement(PropertyMap &PM) const override
This routine collects list of properties to be implemented in the class.
Definition DeclObjC.cpp:2039
void set(ObjCProtocolDecl *const *InList, unsigned Elts, const SourceLocation *Locs, ASTContext &Ctx)
Definition DeclObjC.cpp:51
static ObjCTypeParamDecl * Create(ASTContext &ctx, DeclContext *dc, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, SourceLocation nameLoc, IdentifierInfo *name, SourceLocation colonLoc, TypeSourceInfo *boundInfo)
Definition DeclObjC.cpp:1470
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition DeclObjC.cpp:1494
static ObjCTypeParamDecl * CreateDeserialized(ASTContext &ctx, GlobalDeclID ID)
Definition DeclObjC.cpp:1486
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...
Definition DeclObjC.cpp:1528
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.
Definition DeclObjC.cpp:1517
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)
void setPreviousDecl(ObjCInterfaceDecl *PrevDecl)
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.
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< Decl > decl
Matches declarations.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
@ SelLoc_NonStandard
Non-standard.
@ SelLoc_StandardNoSpace
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or immediately...
@ InvalidObjCMethodFamily
@ Override
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
ObjCMethodFamily
A family of Objective-C methods.
@ OMF_None
No particular method family.
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.
const FunctionProtoType * T
ObjCImplementationControl
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
@ Invariant
The parameter is invariant: must match exactly.
U cast(CodeGen::Address addr)
@ 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.