24 #include "llvm/ADT/DenseSet.h"
25 #include "llvm/ADT/SmallString.h"
27 using namespace clang;
71 =
property->getPropertyAttributes();
73 =
property->getType().getObjCLifetime();
79 if (!expectedLifetime) {
93 property->setPropertyAttributes(attr);
97 if (propertyLifetime == expectedLifetime)
return;
99 property->setInvalidDecl();
101 diag::err_arc_inconsistent_property_ownership)
112 llvm::SmallPtrSetImpl<ObjCProtocolDecl *> &Known) {
114 if (!Known.insert(Proto).second)
119 for (
unsigned I = 0, N = R.
size();
I != N; ++
I) {
150 llvm_unreachable(
"bad qualifier");
201 if (CDecl->IsClassExtension()) {
203 FD, GetterSel, SetterSel,
207 T, TSI, MethodImplKind);
215 GetterSel, SetterSel, isReadWrite,
217 T, TSI, MethodImplKind);
224 (isa<ObjCInterfaceDecl>(ClassDecl) ||
225 isa<ObjCProtocolDecl>(ClassDecl)));
228 if (Res->getType().getObjCLifetime())
231 llvm::SmallPtrSet<ObjCProtocolDecl *, 16> KnownProtos;
234 bool FoundInSuper =
false;
238 for (
unsigned I = 0, N = R.
size();
I != N; ++
I) {
248 CurrentInterfaceDecl = Super;
253 for (
auto *
P : CurrentInterfaceDecl->
protocols()) {
258 for (
auto *
P : IFace->all_referenced_protocols()) {
266 if (!Cat->IsClassExtension())
267 for (
auto *
P : Cat->protocols())
281 unsigned attributesAsWritten = 0;
318 bool invalidTemp =
false;
319 StringRef file = SM.
getBufferData(locInfo.first, &invalidTemp);
322 const char *tokenBegin = file.data() + locInfo.second;
327 file.begin(), tokenBegin, file.end());
330 lexer.LexFromRawLexer(Tok);
331 if (Tok.is(tok::raw_identifier) && Tok.getRawIdentifier() == attrName) {
332 Loc = Tok.getLocation();
335 }
while (Tok.isNot(tok::r_paren));
344 bool PropagateAtomicity) {
352 if (OldIsAtomic == NewIsAtomic)
return;
358 auto Attrs =
Property->getPropertyAttributes();
365 if (
Property->getPropertyAttributesAsWritten() &
374 const unsigned AtomicityMask =
376 if (PropagateAtomicity &&
379 Attrs = Attrs & ~AtomicityMask;
391 if ((OldIsAtomic && isImplicitlyReadonlyAtomic(OldProperty)) ||
392 (NewIsAtomic && isImplicitlyReadonlyAtomic(NewProperty)))
398 if (
auto Category = dyn_cast<ObjCCategoryDecl>(OldDC))
399 OldContextName =
Category->getClassInterface()->getIdentifier();
401 OldContextName = cast<ObjCContainerDecl>(OldDC)->
getIdentifier();
415 const bool isReadWrite,
416 unsigned &Attributes,
417 const unsigned AttributesAsWritten,
441 Diag(AtLoc, diag::err_duplicate_property);
460 ? diag::err_use_continuation_class_redeclaration_readwrite
461 : diag::err_use_continuation_class;
472 Diag(AtLoc, diag::warn_property_redecl_getter_mismatch)
483 unsigned ExistingOwnership
486 if (ExistingOwnership && NewOwnership != ExistingOwnership) {
489 Diag(AtLoc, diag::warn_property_attr_mismatch);
494 Attributes = (Attributes & ~
OwnershipMask) | ExistingOwnership;
503 Diag(AtLoc, diag::warn_property_implicitly_mismatched);
511 FD, GetterSel, SetterSel,
513 Attributes, AttributesAsWritten,
514 T, TSI, MethodImplKind, DC);
524 bool IncompatibleObjC =
false;
534 if (!isa<ObjCObjectPointerType>(PrimaryClassPropertyT) ||
535 !isa<ObjCObjectPointerType>(ClassExtPropertyT) ||
537 ConvertedType, IncompatibleObjC))
538 || IncompatibleObjC) {
540 diag::err_type_mismatch_continuation_class) << PDecl->
getType();
562 const bool isReadWrite,
563 const unsigned Attributes,
564 const unsigned AttributesAsWritten,
595 Diag(AtLoc, diag::warn_implements_nscopying) << PropertyId;
613 LParenLoc, T, TInfo);
617 Diag(PDecl->getLocation(), diag::err_duplicate_property);
618 Diag(prevDecl->getLocation(), diag::note_property_declare);
619 PDecl->setInvalidDecl();
624 PDecl->setLexicalDeclContext(lexicalDC);
627 if (T->isArrayType() || T->isFunctionType()) {
628 Diag(AtLoc, diag::err_property_type) << T;
629 PDecl->setInvalidDecl();
636 PDecl->setGetterName(GetterSel);
637 PDecl->setSetterName(SetterSel);
638 PDecl->setPropertyAttributesAsWritten(
678 if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained)
683 if (MethodImplKind == tok::objc_required)
685 else if (MethodImplKind == tok::objc_optional)
708 property->getType());
711 if (propertyLifetime == ivarLifetime)
return;
737 switch (propertyLifetime) {
755 << ((
property->getPropertyAttributesAsWritten()
760 llvm_unreachable(
"properties cannot be autoreleasing");
769 S.
Diag(propertyImplLoc, diag::note_property_synthesize);
781 property->getType());
810 PDecl->collectInheritedProtocolProperties(Property, PropMap);
814 for (
const auto *PI : SDecl->all_referenced_protocols()) {
816 PDecl->collectInheritedProtocolProperties(Property, PropMap);
818 SDecl = SDecl->getSuperClass();
825 bool FirsTime =
true;
827 I = PropMap.begin(),
E = PropMap.end();
I !=
E;
I++) {
831 bool IncompatibleObjC =
false;
834 || IncompatibleObjC) {
845 if (!FirsTime && AtLoc.
isValid())
846 S.
Diag(AtLoc, diag::note_property_synthesize);
865 auto OrigClass =
Category->getClassInterface();
866 for (
auto Found : OrigClass->lookup(Prop->
getDeclName())) {
868 return OrigProp->getPropertyAttributesAsWritten() &
OwnershipMask;
872 for (
const auto *Proto : OrigClass->all_referenced_protocols()) {
875 return OrigProp->getPropertyAttributesAsWritten() &
OwnershipMask;
896 Diag(AtLoc, diag::error_missing_property_context);
900 PropertyIvarLoc = PropertyLoc;
910 if ((IC = dyn_cast<ObjCImplementationDecl>(ClassImpDecl))) {
915 "ActOnPropertyImplDecl - @implementation without @interface");
920 Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->
getDeclName();
923 unsigned PIkind =
property->getPropertyAttributesAsWritten();
927 Diag(AtLoc, diag::warn_implicit_atomic_property);
930 Diag(property->getLocation(), diag::note_property_declare);
934 dyn_cast<ObjCCategoryDecl>(property->getDeclContext())) {
935 if (!CD->IsClassExtension()) {
936 Diag(PropertyLoc, diag::error_category_property) << CD->getDeclName();
937 Diag(property->getLocation(), diag::note_property_declare);
943 property->hasAttr<IBOutletAttr>() &&
945 bool ReadWriteProperty =
false;
952 PIkind = ExtProp->getPropertyAttributesAsWritten();
954 ReadWriteProperty =
true;
960 if (!ReadWriteProperty) {
961 Diag(property->getLocation(), diag::warn_auto_readonly_iboutlet_property)
965 property->getLParenLoc(), readonlyLoc)) {
968 SourceRange ReadonlySourceRange(readonlyLoc, endLoc);
969 Diag(property->getLocation(),
970 diag::note_auto_readonly_iboutlet_fixup_suggest) <<
975 if (Synthesize && isa<ObjCProtocolDecl>(property->getDeclContext()))
978 }
else if ((CatImplClass = dyn_cast<ObjCCategoryImplDecl>(ClassImpDecl))) {
980 Diag(AtLoc, diag::error_synthesize_category_decl);
985 Diag(AtLoc, diag::error_missing_property_interface);
998 Diag(PropertyLoc, diag::error_bad_category_property_decl)
1003 Diag(AtLoc, diag::error_bad_property_context);
1007 bool CompleteTypeErr =
false;
1013 PropertyIvar = PropertyId;
1017 QualType PropType =
property->getType();
1021 diag::err_incomplete_synthesized_property,
1022 property->getDeclName())) {
1023 Diag(property->getLocation(), diag::note_property_declare);
1024 CompleteTypeErr =
true;
1028 (
property->getPropertyAttributesAsWritten() &
1035 =
property->getPropertyAttributes();
1037 bool isARCWeak =
false;
1043 Diag(PropertyDiagLoc, diag::err_gc_weak_property_strong_type);
1044 Diag(property->getLocation(), diag::note_property_declare);
1056 Diag(PropertyDiagLoc,
1058 ? diag::err_synthesizing_arc_weak_property_disabled
1059 : diag::err_synthesizing_arc_weak_property_no_runtime);
1060 Diag(property->getLocation(), diag::note_property_declare);
1062 CompleteTypeErr =
true;
1069 Diag(property->getLocation(),
1070 diag::err_arc_weak_unavailable_property)
1071 << PropertyIvarType;
1090 Diag(PropertyDiagLoc,
1091 diag::warn_autosynthesis_property_ivar_match)
1092 << PropertyId << (Ivar ==
nullptr) << PropertyIvar
1094 Diag(property->getLocation(), diag::note_property_declare);
1102 if ((
getLangOpts().ObjCAutoRefCount || isARCWeak) &&
1110 Diag(PropertyDiagLoc,
1111 diag::err_arc_objc_property_default_assign_on_object);
1112 Diag(property->getLocation(), diag::note_property_declare);
1116 assert(lifetime &&
"no lifetime for property?");
1125 PropertyIvarLoc,PropertyIvarLoc, PropertyIvar,
1126 PropertyIvarType,
nullptr,
1128 (
Expr *)
nullptr,
true);
1131 diag::err_abstract_type_in_decl,
1133 Diag(property->getLocation(), diag::note_property_declare);
1135 }
else if (CompleteTypeErr)
1141 Diag(PropertyDiagLoc, diag::error_missing_property_ivar_decl)
1147 Diag(PropertyDiagLoc, diag::error_ivar_in_superclass_use)
1154 property->setPropertyIvarDecl(Ivar);
1160 if (isa<ObjCObjectPointerType>(PropertyIvarType)
1161 && isa<ObjCObjectPointerType>(IvarType))
1172 Diag(PropertyDiagLoc, diag::error_property_ivar_type)
1173 <<
property->getDeclName() << PropType
1185 if (lhsType != rhsType &&
1187 Diag(PropertyDiagLoc, diag::error_property_ivar_type)
1188 <<
property->getDeclName() << PropType
1197 Diag(PropertyDiagLoc, diag::error_weak_property)
1198 <<
property->getDeclName() << Ivar->
getDeclName();
1203 if ((property->getType()->isObjCObjectPointerType() ||
1206 Diag(PropertyDiagLoc, diag::error_strong_property)
1207 <<
property->getDeclName() << Ivar->
getDeclName();
1211 if (
getLangOpts().ObjCAutoRefCount || isARCWeak ||
1214 }
else if (PropertyIvar)
1216 Diag(PropertyDiagLoc, diag::error_dynamic_property_ivar_decl);
1218 assert (property &&
"ActOnPropertyImplDecl - property declaration missing");
1225 Ivar, PropertyIvarLoc);
1227 if (CompleteTypeErr || !compat)
1230 if (
ObjCMethodDecl *getterMethod = property->getGetterMethodDecl()) {
1231 getterMethod->createImplicitParams(
Context, IDecl);
1243 Expr *LoadSelfExpr =
1252 LoadSelfExpr,
true,
true);
1255 getterMethod->getReturnType(),
1257 PropertyDiagLoc, IvarRefExpr);
1265 if (property->hasAttr<NSReturnsNotRetainedAttr>() &&
1266 !getterMethod->hasAttr<NSReturnsNotRetainedAttr>()) {
1267 Diag(getterMethod->getLocation(),
1268 diag::warn_property_getter_owning_mismatch);
1269 Diag(property->getLocation(), diag::note_property_declare);
1272 switch (getterMethod->getMethodFamily()) {
1277 Diag(getterMethod->getLocation(), diag::err_arc_illegal_method_def)
1278 << 1 << getterMethod->getSelector();
1284 if (
ObjCMethodDecl *setterMethod = property->getSetterMethodDecl()) {
1285 setterMethod->createImplicitParams(
Context, IDecl);
1295 Expr *LoadSelfExpr =
1304 LoadSelfExpr,
true,
true);
1313 if (property->getPropertyAttributes() &
1317 dyn_cast_or_null<CXXOperatorCallExpr>(callExpr))
1318 if (
const FunctionDecl *FuncDecl = CXXCE->getDirectCallee())
1319 if (!FuncDecl->isTrivial())
1320 if (property->getType()->isReferenceType()) {
1321 Diag(PropertyDiagLoc,
1322 diag::err_atomic_property_nontrivial_assign_op)
1323 <<
property->getType();
1324 Diag(FuncDecl->getLocStart(),
1325 diag::note_callee_decl) << FuncDecl;
1336 Diag(PropertyLoc, diag::error_duplicate_ivar_use)
1337 << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier()
1339 Diag(PPIDecl->getLocation(), diag::note_previous_use);
1344 Diag(PropertyLoc, diag::error_property_implemented) << PropertyId;
1345 Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
1360 if (PropertyIvar && PropertyIvar != PropertyId)
1375 Diag(PropertyDiagLoc, diag::error_duplicate_ivar_use)
1376 << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier()
1378 Diag(PPIDecl->getLocation(), diag::note_previous_use);
1383 Diag(PropertyDiagLoc, diag::error_property_implemented) << PropertyId;
1384 Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
1404 bool OverridingProtocolProperty) {
1413 if (!OverridingProtocolProperty &&
1422 != (SAttr & ObjCPropertyDecl::OBJC_PR_copy))
1424 << Property->
getDeclName() <<
"copy" << inheritedName;
1425 else if (!(SAttr & ObjCPropertyDecl::OBJC_PR_readonly)){
1426 unsigned CAttrRetain =
1429 unsigned SAttrRetain =
1432 bool CStrong = (CAttrRetain != 0);
1433 bool SStrong = (SAttrRetain != 0);
1434 if (CStrong != SStrong)
1436 << Property->
getDeclName() <<
"retain (or strong)" << inheritedName;
1446 << Property->
getDeclName() <<
"setter" << inheritedName;
1451 << Property->
getDeclName() <<
"getter" << inheritedName;
1463 bool IncompatibleObjC =
false;
1466 ConvertedType, IncompatibleObjC) ||
1468 Diag(Property->
getLocation(), diag::warn_property_types_are_incompatible)
1469 << Property->
getType() << SuperProperty->
getType() << inheritedName;
1481 QualType PropertyIvarType =
property->getType().getNonReferenceType();
1491 Diag(Loc, diag::error_property_accessor_type)
1492 <<
property->getDeclName() << PropertyIvarType
1506 Diag(Loc, diag::warn_accessor_property_type_mismatch)
1507 <<
property->getDeclName()
1521 bool IncludeProtocols =
true) {
1524 for (
auto *Prop : IDecl->properties())
1525 PropMap[Prop->getIdentifier()] = Prop;
1528 for (
auto *Ext : IDecl->visible_extensions())
1531 if (IncludeProtocols) {
1533 for (
auto *PI : IDecl->all_referenced_protocols())
1538 for (
auto *Prop : CATDecl->properties())
1539 PropMap[Prop->getIdentifier()] = Prop;
1540 if (IncludeProtocols) {
1542 for (
auto *PI : CATDecl->protocols())
1547 for (
auto *Prop : PDecl->properties()) {
1551 if (!PropertyFromSuper ||
1552 PropertyFromSuper->
getIdentifier() != Prop->getIdentifier()) {
1559 for (
auto *PI : PDecl->protocols())
1572 SDecl->collectPropertiesToImplement(PropMap, PO);
1573 SDecl = SDecl->getSuperClass();
1596 (
Property->getPropertyIvarDecl() == IV))
1602 for (
const auto *
Property : Ext->properties())
1605 (
Property->getPropertyIvarDecl() == IV))
1612 bool SuperClassImplementsGetter =
false;
1613 bool SuperClassImplementsSetter =
false;
1615 SuperClassImplementsSetter =
true;
1620 SuperClassImplementsGetter =
true;
1623 SuperClassImplementsSetter =
true;
1624 if (SuperClassImplementsGetter && SuperClassImplementsSetter)
1639 if (PropMap.empty())
1644 for (
unsigned i = 0, e = PropertyOrder.size(); i != e; i++) {
1661 Diag(Prop->
getLocation(), diag::warn_no_autosynthesis_shared_ivar_property)
1663 if (PID->getLocation().isValid())
1664 Diag(PID->getLocation(), diag::note_property_synthesize);
1676 diag::warn_auto_synthesizing_protocol_property)
1683 if (PropInSuperClass) {
1694 Diag(Prop->
getLocation(), diag::warn_autosynthesis_property_in_superclass)
1725 if (!IDecl->isObjCRequiresPropertyDefs())
1741 if (!SMap.count(Method) &&
1742 (PrimaryClass ==
nullptr ||
1745 isa<ObjCCategoryDecl>(CDecl) ?
1746 diag::warn_setter_getter_impl_required_in_category :
1747 diag::warn_setter_getter_impl_required)
1750 diag::note_property_declare);
1751 if (S.
LangOpts.ObjCDefaultSynthProperties &&
1755 S.
Diag(RID->getLocation(), diag::note_suppressed_class_declare);
1761 bool SynthesizeProperties) {
1765 if (!SynthesizeProperties) {
1774 if ((IDecl =
C->getClassInterface())) {
1789 std::unique_ptr<ObjCContainerDecl::PropertyMap> LazyMap;
1792 if (!PDecl->hasAttr<ObjCExplicitProtocolImplAttr>())
1809 for (
auto *PropDecl : PDecl->properties()) {
1810 if ((*LazyMap)[PropDecl->getIdentifier()])
1812 PropMap[PropDecl->getIdentifier()] = PropDecl;
1817 if (PropMap.empty())
1822 PropImplMap.insert(
I->getPropertyDecl());
1827 InsMap.insert(
I->getSelector());
1834 if (
ObjCImplDecl *IMP = PrimaryClass->getImplementation()) {
1838 for (
const auto *
I : IMP->instance_methods())
1839 InsMap.insert(
I->getSelector());
1843 P = PropMap.begin(),
E = PropMap.end();
P !=
E; ++
P) {
1848 PropImplMap.count(Prop) ||
1854 PrimaryClass, Prop->
getGetterName(), IMPDecl, CDecl,
C, Prop, InsMap);
1855 if (!Prop->isReadOnly())
1857 PrimaryClass, Prop->getSetterName(),
1858 IMPDecl, CDecl,
C, Prop, InsMap);
1864 const auto *
property = propertyImpl->getPropertyDecl();
1868 if (propertyImpl->getPropertyImplementation()
1870 (
property->getPropertyAttributes() &
1872 property->getGetterMethodDecl() &&
1873 property->getSetterMethodDecl()) {
1874 auto *getterMethod =
property->getGetterMethodDecl();
1875 auto *setterMethod =
property->getSetterMethodDecl();
1882 Diag(loc, diag::warn_null_resettable_setter)
1883 << setterMethod->getSelector() <<
property->getDeclName();
1897 PM[Prop->getIdentifier()] = Prop;
1899 for (
auto *Prop : Ext->properties())
1900 PM[Prop->getIdentifier()] = Prop;
1907 bool LookedUpGetterSetter =
false;
1916 LookedUpGetterSetter =
true;
1919 diag::warn_default_atomic_custom_getter_setter)
1925 diag::warn_default_atomic_custom_getter_setter)
1932 if ((Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) ||
1939 if (!LookedUpGetterSetter) {
1943 if ((GetterMethod && !SetterMethod) || (!GetterMethod && SetterMethod)) {
1947 Diag(MethodLoc, diag::warn_atomic_property_rule)
1949 << (SetterMethod !=
nullptr);
1956 StringRef NonatomicStr = AttributesAsWritten?
"nonatomic, "
1959 diag::note_atomic_property_fixup_suggest)
1966 diag::note_atomic_property_fixup_suggest)
1970 Diag(MethodLoc, diag::note_atomic_property_fixup_suggest);
1983 if (PD && !PD->
hasAttr<NSReturnsNotRetainedAttr>() &&
2000 for (
auto *getterRedecl : method->
redecls()) {
2001 if (getterRedecl->isImplicit())
2005 noteLoc = getterRedecl->getLocation();
2006 fixItLoc = getterRedecl->getLocEnd();
2011 tok::kw___attribute, tok::l_paren, tok::l_paren,
2014 tok::r_paren, tok::r_paren
2016 StringRef spelling =
"__attribute__((objc_method_family(none)))";
2018 if (!macroName.empty())
2019 spelling = macroName;
2021 auto noteDiag =
Diag(noteLoc, diag::note_cocoa_naming_declare_family)
2025 fixItText += spelling;
2044 InitSelSet.insert(
I->getSelector());
2047 SuperD->getDesignatedInitializers(DesignatedInits);
2049 I = DesignatedInits.begin(),
E = DesignatedInits.end();
I !=
E; ++
I) {
2052 bool Ignore =
false;
2054 Ignore = IMD->isUnavailable();
2058 diag::warn_objc_implementation_missing_designated_init_override)
2071 for (
const auto *A : Property->
attrs()) {
2072 if (isa<DeprecatedAttr>(A) ||
2073 isa<UnavailableAttr>(A) ||
2074 isa<AvailabilityAttr>(A))
2094 if (CatDecl->IsClassExtension())
2101 if (CatDecl->IsClassExtension())
2109 property->getPropertyAttributes();
2113 Diag(SetterMethod->getLocation(), diag::err_setter_type_void);
2114 if (SetterMethod->param_size() != 1 ||
2116 (*SetterMethod->param_begin())->getType().getNonReferenceType(),
2117 property->getType().getNonReferenceType())) {
2119 diag::warn_accessor_property_type_mismatch)
2121 << SetterMethod->getSelector();
2122 Diag(SetterMethod->getLocation(), diag::note_declared_at);
2132 if (!GetterMethod) {
2139 QualType resultTy =
property->getType();
2146 modifiedTy, modifiedTy);
2152 resultTy,
nullptr, CD,
2156 (
property->getPropertyImplementation() ==
2160 CD->addDecl(GetterMethod);
2164 if (property->
hasAttr<NSReturnsNotRetainedAttr>())
2165 GetterMethod->
addAttr(NSReturnsNotRetainedAttr::CreateImplicit(
Context,
2168 if (property->
hasAttr<ObjCReturnsInnerPointerAttr>())
2170 ObjCReturnsInnerPointerAttr::CreateImplicit(
Context, Loc));
2172 if (
const SectionAttr *SA = property->
getAttr<SectionAttr>())
2174 SectionAttr::CreateImplicit(
Context, SectionAttr::GNU_section,
2175 SA->getName(), Loc));
2183 property->setGetterMethodDecl(GetterMethod);
2188 if (!SetterMethod) {
2202 (
property->getPropertyImplementation() ==
2209 QualType paramTy =
property->getType().getUnqualifiedType();
2216 modifiedTy, modifiedTy);
2229 SetterMethod->setMethodParams(
Context, Argument,
None);
2234 if (
const SectionAttr *SA = property->
getAttr<SectionAttr>())
2235 SetterMethod->addAttr(
2236 SectionAttr::CreateImplicit(
Context, SectionAttr::GNU_section,
2237 SA->getName(), Loc));
2245 SetterMethod->setPropertyAccessor(
true);
2246 property->setSetterMethodDecl(SetterMethod);
2266 if (!CurrentClass) {
2268 CurrentClass = Cat->getClassInterface();
2269 else if (
ObjCImplDecl *Impl = dyn_cast<ObjCImplDecl>(CD))
2270 CurrentClass = Impl->getClassInterface();
2280 unsigned &Attributes,
2281 bool propertyInPrimaryClass) {
2288 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2289 <<
"readonly" <<
"readwrite";
2297 !PropertyTy->isObjCRetainableType() &&
2298 !PropertyDecl->
hasAttr<ObjCNSObjectAttr>()) {
2299 Diag(Loc, diag::err_objc_property_requires_object)
2310 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2311 <<
"assign" <<
"copy";
2315 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2316 <<
"assign" <<
"retain";
2320 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2321 <<
"assign" <<
"strong";
2326 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2327 <<
"assign" <<
"weak";
2330 if (PropertyDecl->
hasAttr<IBOutletCollectionAttr>())
2331 Diag(Loc, diag::warn_iboutletcollection_property_assign);
2334 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2335 <<
"unsafe_unretained" <<
"copy";
2339 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2340 <<
"unsafe_unretained" <<
"retain";
2344 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2345 <<
"unsafe_unretained" <<
"strong";
2350 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2351 <<
"unsafe_unretained" <<
"weak";
2356 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2357 <<
"copy" <<
"retain";
2361 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2362 <<
"copy" <<
"strong";
2366 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2367 <<
"copy" <<
"weak";
2373 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2374 <<
"retain" <<
"weak";
2378 (Attributes & ObjCDeclSpec::DQ_PR_weak)) {
2379 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2380 <<
"strong" <<
"weak";
2384 if (Attributes & ObjCDeclSpec::DQ_PR_weak) {
2386 if (
auto nullability = PropertyTy->getNullability(
Context)) {
2388 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2389 <<
"nonnull" <<
"weak";
2395 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2396 <<
"atomic" <<
"nonatomic";
2403 if (Attributes & ObjCDeclSpec::DQ_PR_readonly) {
2409 }
else if (PropertyTy->isObjCObjectPointerType()) {
2411 (PropertyTy->isObjCClassType() ||
2412 PropertyTy->isObjCQualifiedClassType());
2417 else if (propertyInPrimaryClass) {
2422 Diag(Loc, diag::warn_objc_property_no_assignment_attribute);
2426 Diag(Loc, diag::warn_objc_property_default_assign_on_object);
2436 if (!(Attributes & ObjCDeclSpec::DQ_PR_copy)
2439 && PropertyTy->isBlockPointerType())
2440 Diag(Loc, diag::warn_objc_property_copy_missing_on_block);
2441 else if ((Attributes & ObjCDeclSpec::DQ_PR_retain) &&
2443 !(Attributes & ObjCDeclSpec::DQ_PR_strong) &&
2444 PropertyTy->isBlockPointerType())
2445 Diag(Loc, diag::warn_objc_property_retain_of_block);
2447 if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
2449 Diag(Loc, diag::warn_objc_readonly_property_has_setter);
StringRef getLastMacroWithSpelling(SourceLocation Loc, ArrayRef< TokenValue > Tokens) const
Return the name of the macro defined before Loc that has spelling Tokens.
A call to an overloaded operator written using operator syntax.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
CK_LValueToRValue - A conversion which causes the extraction of an r-value from the operand gl-value...
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
protocol_range protocols() const
Lexer - This provides a simple interface that turns a text buffer into a stream of tokens...
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
ObjCInterfaceDecl * getClassInterface()
const ObjCInterfaceDecl * isObjCRequiresPropertyDefs() const
isObjCRequiresPropertyDefs - Checks that a class or one of its super classes must not be auto-synthes...
ObjCInterfaceDecl * getClassInterface()
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
isObjCPointerConversion - Determines whether this is an Objective-C pointer conversion.
PropertyControl getPropertyImplementation() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Defines the SourceManager interface.
IdentifierInfo * getIdentifierInfo(StringRef Name) const
Return information about the specified preprocessor identifier token.
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
void setObjCLifetime(ObjCLifetime type)
static void CollectSuperClassPropertyImplementations(ObjCInterfaceDecl *CDecl, ObjCInterfaceDecl::PropertyMap &PropMap)
CollectSuperClassPropertyImplementations - This routine collects list of properties to be implemented...
bool isRecordType() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
Ensure attributes are consistent with type.
Captures information about "declaration specifiers" specific to Objective-C.
static ObjCPropertyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, SourceLocation AtLocation, SourceLocation LParenLocation, QualType T, TypeSourceInfo *TSI, PropertyControl propControl=None)
void MarkDeclRefReferenced(DeclRefExpr *E)
Perform reference-marking and odr-use handling for a DeclRefExpr.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
A container of type source information.
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed...
bool isArcWeakrefUnavailable() const
isArcWeakrefUnavailable - Checks for a class or one of its super classes to be incompatible with __we...
void setPropertyAccessor(bool isAccessor)
RAII object to handle the state changes required to synthesize a function body.
QualType getUsageType(QualType objectType) const
Retrieve the type of this instance variable when viewed as a member of a specific object type...
llvm::DenseMap< const ObjCProtocolDecl *, ObjCPropertyDecl * > ProtocolPropertyMap
static unsigned getOwnershipRule(unsigned attr)
ObjCMethodDecl - Represents an instance or class method declaration.
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class...
ObjCPropertyDecl * FindPropertyVisibleInPrimaryClass(IdentifierInfo *PropertyId) const
FindPropertyVisibleInPrimaryClass - Finds declaration of the property with name 'PropertyId' in the p...
static InitializedEntity InitializeResult(SourceLocation ReturnLoc, QualType Type, bool NRVO)
Create the initialization entity for the result of a function.
ParmVarDecl - Represents a parameter to a function.
bool isObjCRetainableType() const
Defines the clang::Expr interface and subclasses for C++ expressions.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names the category interface associated with this implementat...
The collection of all-type qualifiers we support.
TypeSourceInfo * getTypeSourceInfo() const
One of these records is kept for each identifier that is lexed.
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The results of name lookup within a DeclContext.
bool isObjCARCImplicitlyUnretainedType() const
Determines if this type, which must satisfy isObjCLifetimeType(), is implicitly __unsafe_unretained r...
ObjCMethodFamily
A family of Objective-C methods.
all_protocol_range all_referenced_protocols() const
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
Token - This structure provides full information about a lexed token.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
This little struct is used to capture information about structure field declarators, which is basically just a bitfield size.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
SourceLocation getBeginLoc() const
Get the begin source location.
bool IsClassExtension() const
void collectPropertiesToImplement(PropertyMap &PM, PropertyDeclOrder &PO) const override
This routine collects list of properties to be implemented in the class.
void setObjCWeakProperty(bool Val=true)
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
ObjCContainerDecl - Represents a container for method declarations.
const LangOptions & getLangOpts() const
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
static ObjCPropertyImplDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation atLoc, SourceLocation L, ObjCPropertyDecl *property, Kind PK, ObjCIvarDecl *ivarDecl, SourceLocation ivarLoc)
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing, variable initialization, and function return values.
Whether values of this type can be null is (explicitly) unspecified.
ObjCPropertyImplDecl * FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const
FindPropertyImplIvarDecl - This method lookup the ivar in the list of properties implemented in this ...
bool hasDesignatedInitializers() const
Returns true if this interface decl contains at least one initializer marked with the 'objc_designate...
Selector getSetterName() const
Values of this type can never be null.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
Scope - A scope is a transient data structure that is used while parsing the program.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
Represents an Objective-C protocol declaration.
Represents an ObjC class declaration.
propimpl_range property_impls() const
llvm::DenseMap< IdentifierInfo *, ObjCPropertyDecl * > PropertyMap
detail::InMemoryDirectory::const_iterator I
PropertyAttributeKind getPropertyAttributes() const
const LangOptions & LangOpts
This object can be modified without requiring retains or releases.
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
void setGetterCXXConstructor(Expr *getterCXXConstructor)
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID)
Lookup a property by name in the specified DeclContext.
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
static void CheckPropertyAgainstProtocol(Sema &S, ObjCPropertyDecl *Prop, ObjCProtocolDecl *Proto, llvm::SmallPtrSetImpl< ObjCProtocolDecl * > &Known)
Check this Objective-C property against a property declared in the given protocol.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
AvailabilityResult getAvailability(std::string *Message=nullptr) const
Determine the availability of the given declaration.
Sema - This implements semantic analysis and AST building for C.
static void AddPropertyAttrs(Sema &S, ObjCMethodDecl *PropertyMethod, ObjCPropertyDecl *Property)
AddPropertyAttrs - Propagates attributes from a property to the implicitly-declared getter or setter ...
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
ObjCPropertyAttributeKind getPropertyAttributes() const
llvm::SmallPtrSet< Selector, 8 > SelectorSet
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
void addObjCLifetime(ObjCLifetime type)
ID
Defines the set of possible language-specific address spaces.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Expr - This represents one expression.
static ObjCMethodDecl * Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, bool isInstance=true, bool isVariadic=false, bool isPropertyAccessor=false, bool isImplicitlyDeclared=false, bool isDefined=false, ImplementationControl impControl=None, bool HasRelatedResultType=false)
static ObjCPropertyDecl::PropertyAttributeKind makePropertyAttributesAsWritten(unsigned Attributes)
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isObjCGCWeak() const
true when Type is objc's weak.
Defines the clang::Preprocessor interface.
DeclContext * getDeclContext()
ParmVarDecl *const * param_iterator
Stores token information for comparing actual tokens with predefined values.
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
bool isInstanceMethod() const
clang::ObjCRuntime ObjCRuntime
Qualifiers Quals
The local qualifiers.
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, Selector SetterSel, const bool isReadWrite, unsigned &Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
Called by ActOnProperty to handle @property declarations in class extensions.
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
SourceLocation getLocEnd() const LLVM_READONLY
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
bool hasObjCLifetime() const
SourceLocation getLocStart() const LLVM_READONLY
static void DiagnoseUnimplementedAccessor(Sema &S, ObjCInterfaceDecl *PrimaryClass, Selector Method, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, ObjCCategoryDecl *C, ObjCPropertyDecl *Prop, Sema::SelectorSet &SMap)
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
There is no lifetime qualification on this type.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ObjCPropertyImplDecl * FindPropertyImplDecl(IdentifierInfo *propertyId) const
FindPropertyImplDecl - This method looks up a previous ObjCPropertyImplDecl added to the list of thos...
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
bool isNonFragile() const
Does this runtime follow the set of implied behaviors for a "non-fragile" ABI?
Assigning into this object requires the old value to be released and the new value to be retained...
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
const TemplateArgument * iterator
bool isValid() const
Return true if this is a valid SourceLocation object.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
bool getSynthesize() const
static Qualifiers::ObjCLifetime getImpliedARCOwnership(ObjCPropertyDecl::PropertyAttributeKind attrs, QualType type)
getImpliedARCOwnership - Given a set of property attributes and a type, infer an expected lifetime...
ObjCCategoryDecl - Represents a category declaration.
const ObjCInterfaceDecl * getClassInterface() const
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, Selector SetterSel, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Called by ActOnProperty and HandlePropertyInClassExtension to handle creating the ObjcPropertyDecl fo...
bool isPropertyAccessor() const
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
Represents one property declaration in an Objective-C interface.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
QualType getReturnType() const
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
const IdentifierInfo * getIdentifier() const
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
Assigning into this object requires a lifetime extension.
QualType getType() const
Return the type wrapped by this type source info.
SourceLocation getLParenLoc() const
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
static bool hasWrittenStorageAttribute(ObjCPropertyDecl *Prop)
Determine whether any storage attributes were written on the property.
llvm::SmallVector< ObjCPropertyDecl *, 8 > PropertyDeclOrder
void setSetterCXXAssignment(Expr *setterCXXAssignment)
static void checkARCPropertyImpl(Sema &S, SourceLocation propertyImplLoc, ObjCPropertyDecl *property, ObjCIvarDecl *ivar)
bool propertyTypesAreCompatible(QualType, QualType)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
instmeth_range instance_methods() const
ObjCCategoryDecl * FindCategoryDeclaration(IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
static void setImpliedPropertyAttributeForReadOnlyProperty(ObjCPropertyDecl *property, ObjCIvarDecl *ivar)
setImpliedPropertyAttributeForReadOnlyProperty - This routine evaludates life-time attributes for a '...
bool HasUserDeclaredSetterMethod(const ObjCPropertyDecl *P) const
This routine returns 'true' if a user declared setter method was found in the class, its protocols, its super classes or categories.
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static bool SuperClassImplementsProperty(ObjCInterfaceDecl *IDecl, ObjCPropertyDecl *Prop)
prop_range properties() const
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
The basic abstraction for the target Objective-C runtime.
SourceLocation getLocStart() const LLVM_READONLY
bool isInvalidDecl() const
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
Selector getGetterName() const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
Selector getSelector() const
detail::InMemoryDirectory::const_iterator E
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
static void DiagnosePropertyMismatchDeclInProtocols(Sema &S, SourceLocation AtLoc, ObjCInterfaceDecl *ClassDecl, ObjCPropertyDecl *Property)
DiagnosePropertyMismatchDeclInProtocols - diagnose properties declared in inherited protocols with mi...
known_extensions_range known_extensions() const
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
Represents a pointer to an Objective C object.
static ObjCIvarDecl * Create(ASTContext &C, ObjCContainerDecl *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW=nullptr, bool synthesized=false)
bool isObjCObjectType() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
ObjCMethodDecl * getGetterMethodDecl() const
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance, bool shallowCategoryLookup=false, bool followSuper=true, const ObjCCategoryDecl *C=nullptr) const
lookupMethod - This method returns an instance/class method by looking in the class, its categories, and its super classes (using a linear search).
const T * getAs() const
Member-template getAs<specific type>'.
void overwritePropertyAttributes(unsigned PRVal)
ObjCPropertyDecl * FindPropertyDeclaration(const IdentifierInfo *PropertyId) const
FindPropertyDeclaration - Finds declaration of the property given its name in 'PropertyId' and return...
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
protocol_range protocols() const
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
void addDecl(Decl *D)
Add the declaration D into this context.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
static void checkAtomicPropertyMismatch(Sema &S, ObjCPropertyDecl *OldProperty, ObjCPropertyDecl *NewProperty, bool PropagateAtomicity)
Check for a mismatch in the atomicity of the given properties.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
SourceManager & getSourceManager()
IdentifierInfo * getIdentifier() const
bool isObjCGCStrong() const
true when Type is objc's strong.
AccessControl getAccessControl() const
static bool LocPropertyAttribute(ASTContext &Context, const char *attrName, SourceLocation LParenLoc, SourceLocation &Loc)
Reading or writing from this object requires a barrier call.
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups, surround it with a ExprWithCleanups node.
SourceLocation getIdentifierLoc() const
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D...
Compatible - the types are compatible according to the standard.
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
ObjCMethodDecl * lookupPropertyAccessor(const Selector Sel, const ObjCCategoryDecl *Cat) const
Lookup a setter or getter in the class hierarchy, including in all categories except for category pas...
ObjCIvarDecl - Represents an ObjC instance variable.
static unsigned deducePropertyOwnershipFromType(Sema &S, QualType T)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
void setPropertyAttributes(PropertyAttributeKind PRVal)
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, ObjCPropertyDecl *SuperProperty, const IdentifierInfo *Name, bool OverridingProtocolProperty)
DiagnosePropertyMismatch - Compares two properties for their attributes and types and warns on a vari...
ObjCInterfaceDecl * getSuperClass() const
PropertyAttributeKind getPropertyAttributesAsWritten() const
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
bool isFragile() const
The inverse of isNonFragile(): does this runtime follow the set of implied behaviors for a "fragile" ...
static const unsigned OwnershipMask
A reference to a declared variable, function, enum, etc.
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file. ...
void addPropertyImplementation(ObjCPropertyImplDecl *property)
An l-value expression is a reference to an object with independent storage.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
void setLexicalDeclContext(DeclContext *DC)
bool isArithmeticType() const
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
llvm::DenseMap< const Stmt *, CFGBlock * > SMap
IdentifierInfo * getDefaultSynthIvarName(ASTContext &Ctx) const
Get the default name of the synthesized ivar.
void setType(QualType newType)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
This class handles loading and caching of source files into memory.
Preprocessor & getPreprocessor() const
static void CollectImmediateProperties(ObjCContainerDecl *CDecl, ObjCContainerDecl::PropertyMap &PropMap, ObjCContainerDecl::PropertyMap &SuperPropMap, bool IncludeProtocols=true)
CollectImmediateProperties - This routine collects all properties in the class and its conforming pro...
static void checkPropertyDeclWithOwnership(Sema &S, ObjCPropertyDecl *property)
Check the internal consistency of a property declaration with an explicit ownership qualifier...
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.