24 #include "llvm/ADT/DenseSet.h"
25 #include "llvm/ADT/SmallString.h"
27 using namespace clang;
69 =
property->getPropertyAttributes();
71 =
property->getType().getObjCLifetime();
78 if (!expectedLifetime) {
92 property->setPropertyAttributes(attr);
96 if (propertyLifetime == expectedLifetime)
return;
98 property->setInvalidDecl();
100 diag::err_arc_inconsistent_property_ownership)
111 llvm::SmallPtrSetImpl<ObjCProtocolDecl *> &Known) {
113 if (!Known.insert(Proto).second)
118 for (
unsigned I = 0, N = R.
size(); I != N; ++I) {
136 bool *isOverridingProperty,
155 !(Attributes & ObjCDeclSpec::DQ_PR_weak)));
161 if (CDecl->IsClassExtension()) {
163 FD, GetterSel, SetterSel,
164 isAssign, isReadWrite,
167 isOverridingProperty, T, TSI,
176 GetterSel, SetterSel, isAssign, isReadWrite,
178 T, TSI, MethodImplKind);
185 (isa<ObjCInterfaceDecl>(ClassDecl) ||
186 isa<ObjCProtocolDecl>(ClassDecl)));
191 llvm::SmallPtrSet<ObjCProtocolDecl *, 16> KnownProtos;
194 bool FoundInSuper =
false;
198 for (
unsigned I = 0, N = R.
size(); I != N; ++I) {
208 CurrentInterfaceDecl = Super;
213 for (
auto *
P : CurrentInterfaceDecl->
protocols()) {
218 for (
auto *
P : IFace->all_referenced_protocols()) {
223 for (
auto *
P : Cat->protocols())
237 unsigned attributesAsWritten = 0;
274 bool invalidTemp =
false;
275 StringRef file = SM.
getBufferData(locInfo.first, &invalidTemp);
278 const char *tokenBegin = file.data() + locInfo.second;
283 file.begin(), tokenBegin, file.end());
286 lexer.LexFromRawLexer(Tok);
287 if (Tok.is(tok::raw_identifier) && Tok.getRawIdentifier() == attrName) {
288 Loc = Tok.getLocation();
291 }
while (Tok.isNot(tok::r_paren));
312 const bool isReadWrite,
313 const unsigned Attributes,
314 const unsigned AttributesAsWritten,
315 bool *isOverridingProperty,
331 Diag(AtLoc, diag::err_duplicate_property);
332 Diag(prevDecl->getLocation(), diag::note_property_declare);
343 PropertyId, AtLoc, LParenLoc, T, TSI);
369 *isOverridingProperty =
true;
382 FD, GetterSel, SetterSel, isAssign, isReadWrite,
383 Attributes,AttributesAsWritten, T, TSI, MethodImplKind,
395 L->AddedObjCPropertyInClassExtension(PrimaryPDecl,
nullptr,
400 bool IncompatibleObjC =
false;
410 if (!isa<ObjCObjectPointerType>(PrimaryClassPropertyT) ||
411 !isa<ObjCObjectPointerType>(ClassExtPropertyT) ||
413 ConvertedType, IncompatibleObjC))
414 || IncompatibleObjC) {
416 diag::err_type_mismatch_continuation_class) << PDecl->
getType();
431 if (PrimaryClassMemoryModel && ClassExtensionMemoryModel &&
432 (PrimaryClassMemoryModel != ClassExtensionMemoryModel)) {
433 Diag(AtLoc, diag::warn_property_attr_mismatch);
439 if (isa<ObjCObjectPointerType>(PrimaryPropertyQT)) {
446 Diag(AtLoc, diag::warn_property_implicitly_mismatched);
479 Decl *ProtocolPtrTy =
483 isOverridingProperty,
486 PIDecl = cast<ObjCPropertyDecl>(ProtocolPtrTy);
504 ? diag::err_use_continuation_class_redeclaration_readwrite
505 : diag::err_use_continuation_class;
511 *isOverridingProperty =
true;
517 L->AddedObjCPropertyInClassExtension(PDecl, PIDecl, CDecl);
529 const bool isReadWrite,
530 const unsigned Attributes,
531 const unsigned AttributesAsWritten,
549 Diag(AtLoc, diag::warn_implements_nscopying) << PropertyId;
566 LParenLoc, T, TInfo);
570 Diag(PDecl->getLocation(), diag::err_duplicate_property);
571 Diag(prevDecl->getLocation(), diag::note_property_declare);
572 PDecl->setInvalidDecl();
577 PDecl->setLexicalDeclContext(lexicalDC);
580 if (T->isArrayType() || T->isFunctionType()) {
581 Diag(AtLoc, diag::err_property_type) << T;
582 PDecl->setInvalidDecl();
589 PDecl->setGetterName(GetterSel);
590 PDecl->setSetterName(SetterSel);
591 PDecl->setPropertyAttributesAsWritten(
631 if (Attributes & ObjCDeclSpec::DQ_PR_unsafe_unretained)
636 if (MethodImplKind == tok::objc_required)
638 else if (MethodImplKind == tok::objc_optional)
661 property->getType());
664 if (propertyLifetime == ivarLifetime)
return;
688 switch (propertyLifetime) {
706 << ((
property->getPropertyAttributesAsWritten()
711 llvm_unreachable(
"properties cannot be autoreleasing");
720 S.
Diag(propertyImplLoc, diag::note_property_synthesize);
732 property->getType());
761 PDecl->collectInheritedProtocolProperties(Property, PropMap);
765 for (
const auto *PI : SDecl->all_referenced_protocols()) {
767 PDecl->collectInheritedProtocolProperties(Property, PropMap);
769 SDecl = SDecl->getSuperClass();
776 bool FirsTime =
true;
777 for (ObjCInterfaceDecl::ProtocolPropertyMap::iterator
778 I = PropMap.begin(), E = PropMap.end(); I != E; I++) {
782 bool IncompatibleObjC =
false;
785 || IncompatibleObjC) {
796 if (!FirsTime && AtLoc.
isValid())
797 S.
Diag(AtLoc, diag::note_property_synthesize);
815 Diag(AtLoc, diag::error_missing_property_context);
819 PropertyIvarLoc = PropertyLoc;
829 if ((IC = dyn_cast<ObjCImplementationDecl>(ClassImpDecl))) {
834 "ActOnPropertyImplDecl - @implementation without @interface");
839 Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->
getDeclName();
842 unsigned PIkind =
property->getPropertyAttributesAsWritten();
846 Diag(AtLoc, diag::warn_implicit_atomic_property);
849 Diag(property->getLocation(), diag::note_property_declare);
853 dyn_cast<ObjCCategoryDecl>(property->getDeclContext())) {
854 if (!CD->IsClassExtension()) {
855 Diag(PropertyLoc, diag::error_category_property) << CD->getDeclName();
856 Diag(property->getLocation(), diag::note_property_declare);
862 property->hasAttr<IBOutletAttr>() &&
864 bool ReadWriteProperty =
false;
871 PIkind = ExtProp->getPropertyAttributesAsWritten();
873 ReadWriteProperty =
true;
879 if (!ReadWriteProperty) {
880 Diag(property->getLocation(), diag::warn_auto_readonly_iboutlet_property)
884 property->getLParenLoc(), readonlyLoc)) {
887 SourceRange ReadonlySourceRange(readonlyLoc, endLoc);
888 Diag(property->getLocation(),
889 diag::note_auto_readonly_iboutlet_fixup_suggest) <<
894 if (Synthesize && isa<ObjCProtocolDecl>(property->getDeclContext()))
897 }
else if ((CatImplClass = dyn_cast<ObjCCategoryImplDecl>(ClassImpDecl))) {
899 Diag(AtLoc, diag::error_synthesize_category_decl);
904 Diag(AtLoc, diag::error_missing_property_interface);
917 Diag(PropertyLoc, diag::error_bad_category_property_decl)
922 Diag(AtLoc, diag::error_bad_property_context);
926 bool CompleteTypeErr =
false;
932 PropertyIvar = PropertyId;
936 QualType PropType =
property->getType();
940 diag::err_incomplete_synthesized_property,
941 property->getDeclName())) {
942 Diag(property->getLocation(), diag::note_property_declare);
943 CompleteTypeErr =
true;
947 (
property->getPropertyAttributesAsWritten() &
954 =
property->getPropertyAttributes();
961 Diag(PropertyDiagLoc, diag::err_gc_weak_property_strong_type);
962 Diag(property->getLocation(), diag::note_property_declare);
978 Diag(PropertyDiagLoc,
979 diag::warn_autosynthesis_property_ivar_match)
980 << PropertyId << (Ivar ==
nullptr) << PropertyIvar
982 Diag(property->getLocation(), diag::note_property_declare);
996 if (!property->hasWrittenStorageAttribute() &&
998 Diag(PropertyDiagLoc,
999 diag::err_arc_objc_property_default_assign_on_object);
1000 Diag(property->getLocation(), diag::note_property_declare);
1004 assert(lifetime &&
"no lifetime for property?");
1011 Diag(property->getLocation(),
1012 diag::err_arc_weak_unavailable_property) << PropertyIvarType;
1019 Diag(PropertyDiagLoc, diag::err_arc_weak_no_runtime);
1020 Diag(property->getLocation(), diag::note_property_declare);
1030 if (kind & ObjCPropertyDecl::OBJC_PR_weak &&
1033 Diag(PropertyDiagLoc, diag::error_synthesize_weak_non_arc_or_gc);
1034 Diag(property->getLocation(), diag::note_property_declare);
1038 PropertyIvarLoc,PropertyIvarLoc, PropertyIvar,
1039 PropertyIvarType,
nullptr,
1041 (
Expr *)
nullptr,
true);
1044 diag::err_abstract_type_in_decl,
1046 Diag(property->getLocation(), diag::note_property_declare);
1048 }
else if (CompleteTypeErr)
1054 Diag(PropertyDiagLoc, diag::error_missing_property_ivar_decl)
1060 Diag(PropertyDiagLoc, diag::error_ivar_in_superclass_use)
1067 property->setPropertyIvarDecl(Ivar);
1073 if (isa<ObjCObjectPointerType>(PropertyIvarType)
1074 && isa<ObjCObjectPointerType>(IvarType))
1085 Diag(PropertyDiagLoc, diag::error_property_ivar_type)
1086 <<
property->getDeclName() << PropType
1098 if (lhsType != rhsType &&
1100 Diag(PropertyDiagLoc, diag::error_property_ivar_type)
1101 <<
property->getDeclName() << PropType
1110 Diag(PropertyDiagLoc, diag::error_weak_property)
1111 <<
property->getDeclName() << Ivar->
getDeclName();
1116 if ((property->getType()->isObjCObjectPointerType() ||
1119 Diag(PropertyDiagLoc, diag::error_strong_property)
1120 <<
property->getDeclName() << Ivar->
getDeclName();
1126 }
else if (PropertyIvar)
1128 Diag(PropertyDiagLoc, diag::error_dynamic_property_ivar_decl);
1130 assert (property &&
"ActOnPropertyImplDecl - property declaration missing");
1137 Ivar, PropertyIvarLoc);
1139 if (CompleteTypeErr || !compat)
1142 if (
ObjCMethodDecl *getterMethod = property->getGetterMethodDecl()) {
1143 getterMethod->createImplicitParams(
Context, IDecl);
1155 Expr *LoadSelfExpr =
1164 LoadSelfExpr,
true,
true);
1167 getterMethod->getReturnType(),
1169 PropertyDiagLoc, IvarRefExpr);
1177 if (property->hasAttr<NSReturnsNotRetainedAttr>() &&
1178 !getterMethod->hasAttr<NSReturnsNotRetainedAttr>()) {
1179 Diag(getterMethod->getLocation(),
1180 diag::warn_property_getter_owning_mismatch);
1181 Diag(property->getLocation(), diag::note_property_declare);
1184 switch (getterMethod->getMethodFamily()) {
1189 Diag(getterMethod->getLocation(), diag::err_arc_illegal_method_def)
1190 << 1 << getterMethod->getSelector();
1196 if (
ObjCMethodDecl *setterMethod = property->getSetterMethodDecl()) {
1197 setterMethod->createImplicitParams(
Context, IDecl);
1207 Expr *LoadSelfExpr =
1216 LoadSelfExpr,
true,
true);
1225 if (property->getPropertyAttributes() &
1229 dyn_cast_or_null<CXXOperatorCallExpr>(callExpr))
1230 if (
const FunctionDecl *FuncDecl = CXXCE->getDirectCallee())
1231 if (!FuncDecl->isTrivial())
1232 if (property->getType()->isReferenceType()) {
1233 Diag(PropertyDiagLoc,
1234 diag::err_atomic_property_nontrivial_assign_op)
1235 <<
property->getType();
1236 Diag(FuncDecl->getLocStart(),
1237 diag::note_callee_decl) << FuncDecl;
1248 Diag(PropertyLoc, diag::error_duplicate_ivar_use)
1249 << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier()
1251 Diag(PPIDecl->getLocation(), diag::note_previous_use);
1256 Diag(PropertyLoc, diag::error_property_implemented) << PropertyId;
1257 Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
1272 if (PropertyIvar && PropertyIvar != PropertyId)
1287 Diag(PropertyDiagLoc, diag::error_duplicate_ivar_use)
1288 << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier()
1290 Diag(PPIDecl->getLocation(), diag::note_previous_use);
1295 Diag(PropertyDiagLoc, diag::error_property_implemented) << PropertyId;
1296 Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
1316 bool OverridingProtocolProperty) {
1325 if (!OverridingProtocolProperty &&
1334 != (SAttr & ObjCPropertyDecl::OBJC_PR_copy))
1336 << Property->
getDeclName() <<
"copy" << inheritedName;
1337 else if (!(SAttr & ObjCPropertyDecl::OBJC_PR_readonly)){
1338 unsigned CAttrRetain =
1341 unsigned SAttrRetain =
1344 bool CStrong = (CAttrRetain != 0);
1345 bool SStrong = (SAttrRetain != 0);
1346 if (CStrong != SStrong)
1348 << Property->
getDeclName() <<
"retain (or strong)" << inheritedName;
1353 != (SAttr & ObjCPropertyDecl::OBJC_PR_nonatomic)) {
1355 << Property->
getDeclName() <<
"atomic" << inheritedName;
1360 << Property->
getDeclName() <<
"setter" << inheritedName;
1365 << Property->
getDeclName() <<
"getter" << inheritedName;
1377 bool IncompatibleObjC =
false;
1380 ConvertedType, IncompatibleObjC) ||
1382 Diag(Property->
getLocation(), diag::warn_property_types_are_incompatible)
1383 << Property->
getType() << SuperProperty->
getType() << inheritedName;
1395 QualType PropertyIvarType =
property->getType().getNonReferenceType();
1398 if (isa<ObjCObjectPointerType>(PropertyIvarType) &&
1399 isa<ObjCObjectPointerType>(GetterType))
1406 Diag(Loc, diag::error_property_accessor_type)
1407 <<
property->getDeclName() << PropertyIvarType
1421 Diag(Loc, diag::warn_accessor_property_type_mismatch)
1422 <<
property->getDeclName()
1436 bool IncludeProtocols =
true) {
1439 for (
auto *Prop : IDecl->properties())
1440 PropMap[Prop->getIdentifier()] = Prop;
1441 if (IncludeProtocols) {
1443 for (
auto *PI : IDecl->all_referenced_protocols())
1448 if (!CATDecl->IsClassExtension())
1449 for (
auto *Prop : CATDecl->properties())
1450 PropMap[Prop->getIdentifier()] = Prop;
1451 if (IncludeProtocols) {
1453 for (
auto *PI : CATDecl->protocols())
1458 for (
auto *Prop : PDecl->properties()) {
1462 if (!PropertyFromSuper ||
1463 PropertyFromSuper->
getIdentifier() != Prop->getIdentifier()) {
1470 for (
auto *PI : PDecl->protocols())
1483 SDecl->collectPropertiesToImplement(PropMap, PO);
1484 SDecl = SDecl->getSuperClass();
1507 (
Property->getPropertyIvarDecl() == IV))
1515 bool SuperClassImplementsGetter =
false;
1516 bool SuperClassImplementsSetter =
false;
1518 SuperClassImplementsSetter =
true;
1523 SuperClassImplementsGetter =
true;
1526 SuperClassImplementsSetter =
true;
1527 if (SuperClassImplementsGetter && SuperClassImplementsSetter)
1542 if (PropMap.empty())
1547 for (
unsigned i = 0, e = PropertyOrder.size(); i != e; i++) {
1564 Diag(Prop->
getLocation(), diag::warn_no_autosynthesis_shared_ivar_property)
1566 if (!PID->getLocation().isInvalid())
1567 Diag(PID->getLocation(), diag::note_property_synthesize);
1579 diag::warn_auto_synthesizing_protocol_property)
1586 if (PropInSuperClass) {
1597 Diag(Prop->
getLocation(), diag::warn_autosynthesis_property_in_superclass)
1628 if (!IDecl->isObjCRequiresPropertyDefs())
1644 if (!SMap.count(Method) &&
1645 (PrimaryClass ==
nullptr ||
1648 isa<ObjCCategoryDecl>(CDecl) ?
1649 diag::warn_setter_getter_impl_required_in_category :
1650 diag::warn_setter_getter_impl_required)
1653 diag::note_property_declare);
1654 if (S.
LangOpts.ObjCDefaultSynthProperties &&
1658 S.
Diag(RID->getLocation(), diag::note_suppressed_class_declare);
1664 bool SynthesizeProperties) {
1668 if (!SynthesizeProperties) {
1677 if ((IDecl =
C->getClassInterface())) {
1692 std::unique_ptr<ObjCContainerDecl::PropertyMap> LazyMap;
1695 if (!PDecl->hasAttr<ObjCExplicitProtocolImplAttr>())
1712 for (
auto *PropDecl : PDecl->properties()) {
1713 if ((*LazyMap)[PropDecl->getIdentifier()])
1715 PropMap[PropDecl->getIdentifier()] = PropDecl;
1720 if (PropMap.empty())
1725 PropImplMap.insert(I->getPropertyDecl());
1730 InsMap.insert(I->getSelector());
1737 if (
ObjCImplDecl *IMP = PrimaryClass->getImplementation()) {
1741 for (
const auto *I : IMP->instance_methods())
1742 InsMap.insert(I->getSelector());
1745 for (ObjCContainerDecl::PropertyMap::iterator
1746 P = PropMap.begin(), E = PropMap.end();
P != E; ++
P) {
1751 PropImplMap.count(Prop) ||
1757 PrimaryClass, Prop->
getGetterName(), IMPDecl, CDecl,
C, Prop, InsMap);
1758 if (!Prop->isReadOnly())
1760 PrimaryClass, Prop->getSetterName(),
1761 IMPDecl, CDecl,
C, Prop, InsMap);
1767 const auto *
property = propertyImpl->getPropertyDecl();
1771 if (propertyImpl->getPropertyImplementation()
1773 (
property->getPropertyAttributes() &
1775 property->getGetterMethodDecl() &&
1776 property->getSetterMethodDecl()) {
1777 auto *getterMethod =
property->getGetterMethodDecl();
1778 auto *setterMethod =
property->getSetterMethodDecl();
1785 Diag(loc, diag::warn_null_resettable_setter)
1786 << setterMethod->getSelector() <<
property->getDeclName();
1801 bool LookedUpGetterSetter =
false;
1803 unsigned Attributes =
Property->getPropertyAttributes();
1804 unsigned AttributesAsWritten =
Property->getPropertyAttributesAsWritten();
1810 LookedUpGetterSetter =
true;
1813 diag::warn_default_atomic_custom_getter_setter)
1815 Diag(
Property->getLocation(), diag::note_property_declare);
1819 diag::warn_default_atomic_custom_getter_setter)
1821 Diag(
Property->getLocation(), diag::note_property_declare);
1826 if ((Attributes & ObjCPropertyDecl::OBJC_PR_nonatomic) ||
1833 if (!LookedUpGetterSetter) {
1837 if ((GetterMethod && !SetterMethod) || (!GetterMethod && SetterMethod)) {
1841 Diag(MethodLoc, diag::warn_atomic_property_rule)
1842 <<
Property->getIdentifier() << (GetterMethod !=
nullptr)
1843 << (SetterMethod !=
nullptr);
1845 if (!AttributesAsWritten) {
1846 if (
Property->getLParenLoc().isValid()) {
1850 Diag(
Property->getLocation(), diag::note_atomic_property_fixup_suggest) <<
1856 Property->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
1859 Diag(
Property->getLocation(), diag::note_atomic_property_fixup_suggest) <<
1863 else if (!(AttributesAsWritten & ObjCPropertyDecl::OBJC_PR_atomic)) {
1867 Diag(
Property->getLocation(), diag::note_atomic_property_fixup_suggest) <<
1871 Diag(MethodLoc, diag::note_atomic_property_fixup_suggest);
1872 Diag(
Property->getLocation(), diag::note_property_declare);
1884 if (PD && !PD->
hasAttr<NSReturnsNotRetainedAttr>() &&
1901 for (
auto *getterRedecl : method->
redecls()) {
1902 if (getterRedecl->isImplicit())
1906 noteLoc = getterRedecl->getLocation();
1907 fixItLoc = getterRedecl->getLocEnd();
1912 tok::kw___attribute, tok::l_paren, tok::l_paren,
1915 tok::r_paren, tok::r_paren
1917 StringRef spelling =
"__attribute__((objc_method_family(none)))";
1919 if (!macroName.empty())
1920 spelling = macroName;
1922 auto noteDiag =
Diag(noteLoc, diag::note_cocoa_naming_declare_family)
1926 fixItText += spelling;
1944 if (I->getMethodFamily() ==
OMF_init)
1945 InitSelSet.insert(I->getSelector());
1948 SuperD->getDesignatedInitializers(DesignatedInits);
1950 I = DesignatedInits.begin(), E = DesignatedInits.end(); I != E; ++I) {
1954 diag::warn_objc_implementation_missing_designated_init_override)
1966 for (
const auto *A : Property->
attrs()) {
1967 if (isa<DeprecatedAttr>(A) ||
1968 isa<UnavailableAttr>(A) ||
1969 isa<AvailabilityAttr>(A))
1996 property->getPropertyAttributes();
2003 (*SetterMethod->
param_begin())->getType().getNonReferenceType(),
2004 property->getType().getNonReferenceType())) {
2006 diag::warn_accessor_property_type_mismatch)
2019 if (!GetterMethod) {
2025 property->getLocation();
2028 QualType resultTy =
property->getType();
2035 modifiedTy, modifiedTy);
2041 resultTy,
nullptr, CD,
2045 (
property->getPropertyImplementation() ==
2049 CD->addDecl(GetterMethod);
2057 if (property->
hasAttr<NSReturnsNotRetainedAttr>())
2058 GetterMethod->
addAttr(NSReturnsNotRetainedAttr::CreateImplicit(
Context,
2061 if (property->
hasAttr<ObjCReturnsInnerPointerAttr>())
2063 ObjCReturnsInnerPointerAttr::CreateImplicit(
Context, Loc));
2065 if (
const SectionAttr *SA = property->
getAttr<SectionAttr>())
2067 SectionAttr::CreateImplicit(
Context, SectionAttr::GNU_section,
2068 SA->getName(), Loc));
2076 property->setGetterMethodDecl(GetterMethod);
2081 if (!SetterMethod) {
2087 property->getLocation();
2097 (
property->getPropertyImplementation() ==
2104 QualType paramTy =
property->getType().getUnqualifiedType();
2111 modifiedTy, modifiedTy);
2133 if (
const SectionAttr *SA = property->
getAttr<SectionAttr>())
2135 SectionAttr::CreateImplicit(
Context, SectionAttr::GNU_section,
2136 SA->getName(), Loc));
2145 property->setSetterMethodDecl(SetterMethod);
2165 if (!CurrentClass) {
2167 CurrentClass = Cat->getClassInterface();
2168 else if (
ObjCImplDecl *Impl = dyn_cast<ObjCImplDecl>(CD))
2169 CurrentClass = Impl->getClassInterface();
2179 unsigned &Attributes,
2180 bool propertyInPrimaryClass) {
2187 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2188 <<
"readonly" <<
"readwrite";
2197 Attributes & ObjCDeclSpec::DQ_PR_readonly &&
2198 PropertyTy->isObjCRetainableType() &&
2205 !PropertyTy->isObjCRetainableType() &&
2206 !PropertyDecl->
hasAttr<ObjCNSObjectAttr>()) {
2207 Diag(Loc, diag::err_objc_property_requires_object)
2218 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2219 <<
"assign" <<
"copy";
2223 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2224 <<
"assign" <<
"retain";
2228 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2229 <<
"assign" <<
"strong";
2234 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2235 <<
"assign" <<
"weak";
2238 if (PropertyDecl->
hasAttr<IBOutletCollectionAttr>())
2239 Diag(Loc, diag::warn_iboutletcollection_property_assign);
2242 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2243 <<
"unsafe_unretained" <<
"copy";
2247 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2248 <<
"unsafe_unretained" <<
"retain";
2252 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2253 <<
"unsafe_unretained" <<
"strong";
2258 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2259 <<
"unsafe_unretained" <<
"weak";
2264 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2265 <<
"copy" <<
"retain";
2269 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2270 <<
"copy" <<
"strong";
2274 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2275 <<
"copy" <<
"weak";
2281 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2282 <<
"retain" <<
"weak";
2286 (Attributes & ObjCDeclSpec::DQ_PR_weak)) {
2287 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2288 <<
"strong" <<
"weak";
2292 if (Attributes & ObjCDeclSpec::DQ_PR_weak) {
2294 if (
auto nullability = PropertyTy->getNullability(
Context)) {
2296 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2297 <<
"nonnull" <<
"weak";
2302 PropertyTy, PropertyTy);
2304 PropertyDecl->
setType(PropertyTy, TSInfo);
2310 Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
2311 <<
"atomic" <<
"nonatomic";
2317 if (!(Attributes & (ObjCDeclSpec::DQ_PR_assign | ObjCDeclSpec::DQ_PR_copy |
2318 ObjCDeclSpec::DQ_PR_unsafe_unretained |
2319 ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong |
2320 ObjCDeclSpec::DQ_PR_weak)) &&
2321 PropertyTy->isObjCObjectPointerType()) {
2326 else if (!(Attributes & ObjCDeclSpec::DQ_PR_readonly)) {
2328 (PropertyTy->isObjCClassType() ||
2329 PropertyTy->isObjCQualifiedClassType());
2334 else if (propertyInPrimaryClass) {
2339 Diag(Loc, diag::warn_objc_property_no_assignment_attribute);
2343 Diag(Loc, diag::warn_objc_property_default_assign_on_object);
2353 if (!(Attributes & ObjCDeclSpec::DQ_PR_copy)
2356 && PropertyTy->isBlockPointerType())
2357 Diag(Loc, diag::warn_objc_property_copy_missing_on_block);
2358 else if ((Attributes & ObjCDeclSpec::DQ_PR_retain) &&
2360 !(Attributes & ObjCDeclSpec::DQ_PR_strong) &&
2361 PropertyTy->isBlockPointerType())
2362 Diag(Loc, diag::warn_objc_property_retain_of_block);
2364 if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
2366 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. If there are multiple macro...
A call to an overloaded operator written using operator syntax.
param_const_iterator param_begin() const
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs=llvm::None)
Sets the method's parameters and selector source locations. If the method is implicit (not coming fro...
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
StringRef getName() const
protocol_range protocols() const
Smart pointer class that efficiently represents Objective-C method names.
ObjCInterfaceDecl * getClassInterface()
const ObjCInterfaceDecl * isObjCRequiresPropertyDefs() const
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IdentifierInfo * getIdentifier() const
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
PropertyControl getPropertyImplementation() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
const LangOptions & getLangOpts() const
unsigned deduceWeakPropertyFromType(QualType T)
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Defines the SourceManager interface.
IdentifierInfo * getIdentifierInfo(StringRef Name) const
void ActOnDocumentableDecl(Decl *D)
void setObjCLifetime(ObjCLifetime type)
static void CollectSuperClassPropertyImplementations(ObjCInterfaceDecl *CDecl, ObjCInterfaceDecl::PropertyMap &PropMap)
bool isRecordType() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
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)
IdentifierInfo * getAsIdentifierInfo() const
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.
bool isArcWeakrefUnavailable() const
void setPropertyAccessor(bool isAccessor)
RAII object to handle the state changes required to synthesize a function body.
QualType getUsageType(QualType objectType) const
llvm::DenseMap< const ObjCProtocolDecl *, ObjCPropertyDecl * > ProtocolPropertyMap
static unsigned getOwnershipRule(unsigned attr)
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ObjCPropertyDecl * FindPropertyVisibleInPrimaryClass(IdentifierInfo *PropertyId) const
static InitializedEntity InitializeResult(SourceLocation ReturnLoc, QualType Type, bool NRVO)
Create the initialization entity for the result of a function.
unsigned param_size() const
ParmVarDecl - Represents a parameter to a function.
bool isObjCRetainableType() const
Defines the clang::Expr interface and subclasses for C++ expressions.
IdentifierInfo * getIdentifier() const
TypeSourceInfo * getTypeSourceInfo() const
void ProcessPropertyDecl(ObjCPropertyDecl *property, ObjCContainerDecl *CD, ObjCPropertyDecl *redeclaredProperty=nullptr, ObjCContainerDecl *lexicalDC=nullptr)
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. This is either a single result (with no stable stora...
bool isObjCARCImplicitlyUnretainedType() const
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.
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.
Values of this type can be null.
bool IsClassExtension() const
void collectPropertiesToImplement(PropertyMap &PM, PropertyDeclOrder &PO) const override
void setObjCWeakProperty(bool Val=true)
ObjCPropertyAttributeKind
PropertyAttributeKind - list of property attributes.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
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)
ObjCPropertyImplDecl * FindPropertyImplIvarDecl(IdentifierInfo *ivarId) const
bool hasDesignatedInitializers() const
Selector getSetterName() const
Values of this type can never be null.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
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
PropertyAttributeKind getPropertyAttributes() const
const LangOptions & LangOpts
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, Selector SetterSel, const bool isAssign, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, bool *isOverridingProperty, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
void setGetterCXXConstructor(Expr *getterCXXConstructor)
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
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.
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)
Qualifiers::ObjCLifetime getObjCLifetime() const
getObjCLifetime - 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.
void setType(QualType T, TypeSourceInfo *TSI)
SplitQualType split() const
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
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 Kind getNullabilityAttrKind(NullabilityKind kind)
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
static ObjCPropertyDecl::PropertyAttributeKind makePropertyAttributesAsWritten(unsigned Attributes)
void setInvalidDecl(bool Invalid=true)
bool isObjCGCWeak() const
isObjCGCWeak true when Type is objc's weak.
Defines the clang::Preprocessor interface.
DeclContext * getDeclContext()
ParmVarDecl *const * param_iterator
void setGetterName(Selector Sel)
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Stores token information for comparing actual tokens with predefined values. Only handles simple toke...
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
bool isInstanceMethod() const
clang::ObjCRuntime ObjCRuntime
Qualifiers Quals
The local qualifiers.
DeclarationName getDeclName() const
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)
Default synthesizes all properties which must be synthesized in class's @implementation.
bool hasObjCLifetime() const
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl)
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)
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
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?
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
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.
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
bool getSynthesize() const
static Qualifiers::ObjCLifetime getImpliedARCOwnership(ObjCPropertyDecl::PropertyAttributeKind attrs, QualType type)
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.
bool isPropertyAccessor() const
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
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
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
Assigning into this object requires a lifetime extension.
QualType getType() const
Return the type wrapped by this type source info.
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
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. It will iterate at least once ...
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
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)
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. It also returns 'true' if one of its categories has declared a 'readwrite' property. This is because, user must provide a setter method for the category's 'readwrite' property.
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
static bool SuperClassImplementsProperty(ObjCInterfaceDecl *IDecl, ObjCPropertyDecl *Prop)
static void checkARCPropertyDecl(Sema &S, ObjCPropertyDecl *property)
Check the internal consistency of a property declaration.
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.
void makeitReadWriteAttribute()
Selector getSelector() const
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)
known_extensions_range known_extensions() const
QualType getNonReferenceType() const
static ObjCIvarDecl * Create(ASTContext &C, ObjCContainerDecl *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW=nullptr, bool synthesized=false)
bool isObjCObjectType() const
ObjCMethodDecl * getGetterMethodDecl() const
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance, bool shallowCategoryLookup=false, bool followSuper=true, const ObjCCategoryDecl *C=nullptr) const
ObjCMethodDecl * getSetterMethodDecl() const
ObjCPropertyDecl * FindPropertyDeclaration(const IdentifierInfo *PropertyId) const
void setSetterName(Selector Sel)
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)
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
ObjCIvarRefExpr - A reference to an ObjC instance variable.
SourceManager & getSourceManager()
IdentifierInfo * getIdentifier() const
bool isObjCGCStrong() const
isObjCGCStrong 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)
SourceLocation getIdentifierLoc() const
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
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...
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, Selector SetterSel, const bool isAssign, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
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)
ObjCInterfaceDecl * getSuperClass() const
PropertyAttributeKind getPropertyAttributesAsWritten() const
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2].
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)
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, bool *OverridingProperty, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
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)
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
Engages in a tight little dance with the lexer to efficiently preprocess tokens.