forked from OSchip/llvm-project
[C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() with iterator_range props(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203830
This commit is contained in:
parent
8d62008ecb
commit
dc4bea4676
|
@ -521,6 +521,10 @@ public:
|
||||||
|
|
||||||
// Iterator access to properties.
|
// Iterator access to properties.
|
||||||
typedef specific_decl_iterator<ObjCPropertyDecl> prop_iterator;
|
typedef specific_decl_iterator<ObjCPropertyDecl> prop_iterator;
|
||||||
|
typedef llvm::iterator_range<specific_decl_iterator<ObjCPropertyDecl>>
|
||||||
|
prop_range;
|
||||||
|
|
||||||
|
prop_range props() const { return prop_range(prop_begin(), prop_end()); }
|
||||||
prop_iterator prop_begin() const {
|
prop_iterator prop_begin() const {
|
||||||
return prop_iterator(decls_begin());
|
return prop_iterator(decls_begin());
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,9 +488,7 @@ void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx,
|
||||||
if (!(ASTMigrateActions & FrontendOptions::ObjCMT_ReturnsInnerPointerProperty))
|
if (!(ASTMigrateActions & FrontendOptions::ObjCMT_ReturnsInnerPointerProperty))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (ObjCContainerDecl::prop_iterator P = D->prop_begin(),
|
for (auto *Prop : D->props()) {
|
||||||
E = D->prop_end(); P != E; ++P) {
|
|
||||||
ObjCPropertyDecl *Prop = *P;
|
|
||||||
if ((ASTMigrateActions & FrontendOptions::ObjCMT_Annotation) &&
|
if ((ASTMigrateActions & FrontendOptions::ObjCMT_Annotation) &&
|
||||||
!Prop->isDeprecated())
|
!Prop->isDeprecated())
|
||||||
migratePropertyNsReturnsInnerPointer(Ctx, Prop);
|
migratePropertyNsReturnsInnerPointer(Ctx, Prop);
|
||||||
|
@ -507,9 +505,7 @@ ClassImplementsAllMethodsAndProperties(ASTContext &Ctx,
|
||||||
// in class interface.
|
// in class interface.
|
||||||
bool HasAtleastOneRequiredProperty = false;
|
bool HasAtleastOneRequiredProperty = false;
|
||||||
if (const ObjCProtocolDecl *PDecl = Protocol->getDefinition())
|
if (const ObjCProtocolDecl *PDecl = Protocol->getDefinition())
|
||||||
for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(),
|
for (const auto *Property : PDecl->props()) {
|
||||||
E = PDecl->prop_end(); P != E; ++P) {
|
|
||||||
ObjCPropertyDecl *Property = *P;
|
|
||||||
if (Property->getPropertyImplementation() == ObjCPropertyDecl::Optional)
|
if (Property->getPropertyImplementation() == ObjCPropertyDecl::Optional)
|
||||||
continue;
|
continue;
|
||||||
HasAtleastOneRequiredProperty = true;
|
HasAtleastOneRequiredProperty = true;
|
||||||
|
|
|
@ -75,17 +75,15 @@ public:
|
||||||
|
|
||||||
static void collectProperties(ObjCContainerDecl *D, AtPropDeclsTy &AtProps,
|
static void collectProperties(ObjCContainerDecl *D, AtPropDeclsTy &AtProps,
|
||||||
AtPropDeclsTy *PrevAtProps = 0) {
|
AtPropDeclsTy *PrevAtProps = 0) {
|
||||||
for (ObjCInterfaceDecl::prop_iterator
|
for (auto *Prop : D->props()) {
|
||||||
propI = D->prop_begin(),
|
if (Prop->getAtLoc().isInvalid())
|
||||||
propE = D->prop_end(); propI != propE; ++propI) {
|
|
||||||
if (propI->getAtLoc().isInvalid())
|
|
||||||
continue;
|
continue;
|
||||||
unsigned RawLoc = propI->getAtLoc().getRawEncoding();
|
unsigned RawLoc = Prop->getAtLoc().getRawEncoding();
|
||||||
if (PrevAtProps)
|
if (PrevAtProps)
|
||||||
if (PrevAtProps->find(RawLoc) != PrevAtProps->end())
|
if (PrevAtProps->find(RawLoc) != PrevAtProps->end())
|
||||||
continue;
|
continue;
|
||||||
PropsTy &props = AtProps[RawLoc];
|
PropsTy &props = AtProps[RawLoc];
|
||||||
props.push_back(*propI);
|
props.push_back(Prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,8 +125,7 @@ ObjCContainerDecl::HasUserDeclaredSetterMethod(const ObjCPropertyDecl *Property)
|
||||||
// Also search through the categories looking for a 'readwrite' declaration
|
// Also search through the categories looking for a 'readwrite' declaration
|
||||||
// of this property. If one found, presumably a setter will be provided
|
// of this property. If one found, presumably a setter will be provided
|
||||||
// (properties declared in categories will not get auto-synthesized).
|
// (properties declared in categories will not get auto-synthesized).
|
||||||
for (ObjCContainerDecl::prop_iterator P = Cat->prop_begin(),
|
for (const auto *P : Cat->props())
|
||||||
E = Cat->prop_end(); P != E; ++P)
|
|
||||||
if (P->getIdentifier() == Property->getIdentifier()) {
|
if (P->getIdentifier() == Property->getIdentifier()) {
|
||||||
if (P->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite)
|
if (P->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite)
|
||||||
return true;
|
return true;
|
||||||
|
@ -286,9 +285,7 @@ ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass(
|
||||||
|
|
||||||
void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap &PM,
|
void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap &PM,
|
||||||
PropertyDeclOrder &PO) const {
|
PropertyDeclOrder &PO) const {
|
||||||
for (ObjCContainerDecl::prop_iterator P = prop_begin(),
|
for (auto *Prop : props()) {
|
||||||
E = prop_end(); P != E; ++P) {
|
|
||||||
ObjCPropertyDecl *Prop = *P;
|
|
||||||
PM[Prop->getIdentifier()] = Prop;
|
PM[Prop->getIdentifier()] = Prop;
|
||||||
PO.push_back(Prop);
|
PO.push_back(Prop);
|
||||||
}
|
}
|
||||||
|
@ -1114,13 +1111,11 @@ ObjCMethodDecl::findPropertyDecl(bool CheckOverrides) const {
|
||||||
|
|
||||||
bool IsGetter = (NumArgs == 0);
|
bool IsGetter = (NumArgs == 0);
|
||||||
|
|
||||||
for (ObjCContainerDecl::prop_iterator I = Container->prop_begin(),
|
for (const auto *I : Container->props()) {
|
||||||
E = Container->prop_end();
|
Selector NextSel = IsGetter ? I->getGetterName()
|
||||||
I != E; ++I) {
|
: I->getSetterName();
|
||||||
Selector NextSel = IsGetter ? (*I)->getGetterName()
|
|
||||||
: (*I)->getSetterName();
|
|
||||||
if (NextSel == Sel)
|
if (NextSel == Sel)
|
||||||
return *I;
|
return I;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm_unreachable("Marked as a property accessor but no property found!");
|
llvm_unreachable("Marked as a property accessor but no property found!");
|
||||||
|
@ -1606,9 +1601,7 @@ void ObjCProtocolDecl::collectPropertiesToImplement(PropertyMap &PM,
|
||||||
PropertyDeclOrder &PO) const {
|
PropertyDeclOrder &PO) const {
|
||||||
|
|
||||||
if (const ObjCProtocolDecl *PDecl = getDefinition()) {
|
if (const ObjCProtocolDecl *PDecl = getDefinition()) {
|
||||||
for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(),
|
for (auto *Prop : PDecl->props()) {
|
||||||
E = PDecl->prop_end(); P != E; ++P) {
|
|
||||||
ObjCPropertyDecl *Prop = *P;
|
|
||||||
// Insert into PM if not there already.
|
// Insert into PM if not there already.
|
||||||
PM.insert(std::make_pair(Prop->getIdentifier(), Prop));
|
PM.insert(std::make_pair(Prop->getIdentifier(), Prop));
|
||||||
PO.push_back(Prop);
|
PO.push_back(Prop);
|
||||||
|
@ -1626,9 +1619,7 @@ void ObjCProtocolDecl::collectInheritedProtocolProperties(
|
||||||
ProtocolPropertyMap &PM) const {
|
ProtocolPropertyMap &PM) const {
|
||||||
if (const ObjCProtocolDecl *PDecl = getDefinition()) {
|
if (const ObjCProtocolDecl *PDecl = getDefinition()) {
|
||||||
bool MatchFound = false;
|
bool MatchFound = false;
|
||||||
for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(),
|
for (auto *Prop : PDecl->props()) {
|
||||||
E = PDecl->prop_end(); P != E; ++P) {
|
|
||||||
ObjCPropertyDecl *Prop = *P;
|
|
||||||
if (Prop == Property)
|
if (Prop == Property)
|
||||||
continue;
|
continue;
|
||||||
if (Prop->getIdentifier() == Property->getIdentifier()) {
|
if (Prop->getIdentifier() == Property->getIdentifier()) {
|
||||||
|
|
|
@ -1668,9 +1668,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create entries for all of the properties.
|
// Create entries for all of the properties.
|
||||||
for (ObjCContainerDecl::prop_iterator I = ID->prop_begin(),
|
for (const auto *PD : ID->props()) {
|
||||||
E = ID->prop_end(); I != E; ++I) {
|
|
||||||
const ObjCPropertyDecl *PD = *I;
|
|
||||||
SourceLocation Loc = PD->getLocation();
|
SourceLocation Loc = PD->getLocation();
|
||||||
llvm::DIFile PUnit = getOrCreateFile(Loc);
|
llvm::DIFile PUnit = getOrCreateFile(Loc);
|
||||||
unsigned PLine = getLineNumber(Loc);
|
unsigned PLine = getLineNumber(Loc);
|
||||||
|
|
|
@ -1822,11 +1822,8 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
|
||||||
|
|
||||||
// Add all of the property methods need adding to the method list and to the
|
// Add all of the property methods need adding to the method list and to the
|
||||||
// property metadata list.
|
// property metadata list.
|
||||||
for (ObjCContainerDecl::prop_iterator
|
for (auto *property : PD->props()) {
|
||||||
iter = PD->prop_begin(), endIter = PD->prop_end();
|
|
||||||
iter != endIter ; iter++) {
|
|
||||||
std::vector<llvm::Constant*> Fields;
|
std::vector<llvm::Constant*> Fields;
|
||||||
ObjCPropertyDecl *property = *iter;
|
|
||||||
|
|
||||||
Fields.push_back(MakePropertyEncodingString(property, 0));
|
Fields.push_back(MakePropertyEncodingString(property, 0));
|
||||||
PushPropertyAttributes(Fields, property);
|
PushPropertyAttributes(Fields, property);
|
||||||
|
|
|
@ -999,7 +999,7 @@ protected:
|
||||||
llvm::SmallPtrSet<const IdentifierInfo*, 16> &PropertySet,
|
llvm::SmallPtrSet<const IdentifierInfo*, 16> &PropertySet,
|
||||||
SmallVectorImpl<llvm::Constant*> &Properties,
|
SmallVectorImpl<llvm::Constant*> &Properties,
|
||||||
const Decl *Container,
|
const Decl *Container,
|
||||||
const ObjCProtocolDecl *PROTO,
|
const ObjCProtocolDecl *Proto,
|
||||||
const ObjCCommonTypesHelper &ObjCTypes);
|
const ObjCCommonTypesHelper &ObjCTypes);
|
||||||
|
|
||||||
/// GetProtocolRef - Return a reference to the internal protocol
|
/// GetProtocolRef - Return a reference to the internal protocol
|
||||||
|
@ -2773,14 +2773,12 @@ void CGObjCCommonMac::
|
||||||
PushProtocolProperties(llvm::SmallPtrSet<const IdentifierInfo*,16> &PropertySet,
|
PushProtocolProperties(llvm::SmallPtrSet<const IdentifierInfo*,16> &PropertySet,
|
||||||
SmallVectorImpl<llvm::Constant *> &Properties,
|
SmallVectorImpl<llvm::Constant *> &Properties,
|
||||||
const Decl *Container,
|
const Decl *Container,
|
||||||
const ObjCProtocolDecl *PROTO,
|
const ObjCProtocolDecl *Proto,
|
||||||
const ObjCCommonTypesHelper &ObjCTypes) {
|
const ObjCCommonTypesHelper &ObjCTypes) {
|
||||||
for (ObjCProtocolDecl::protocol_iterator P = PROTO->protocol_begin(),
|
for (ObjCProtocolDecl::protocol_iterator P = Proto->protocol_begin(),
|
||||||
E = PROTO->protocol_end(); P != E; ++P)
|
E = Proto->protocol_end(); P != E; ++P)
|
||||||
PushProtocolProperties(PropertySet, Properties, Container, (*P), ObjCTypes);
|
PushProtocolProperties(PropertySet, Properties, Container, (*P), ObjCTypes);
|
||||||
for (ObjCContainerDecl::prop_iterator I = PROTO->prop_begin(),
|
for (const auto *PD : Proto->props()) {
|
||||||
E = PROTO->prop_end(); I != E; ++I) {
|
|
||||||
const ObjCPropertyDecl *PD = *I;
|
|
||||||
if (!PropertySet.insert(PD->getIdentifier()))
|
if (!PropertySet.insert(PD->getIdentifier()))
|
||||||
continue;
|
continue;
|
||||||
llvm::Constant *Prop[] = {
|
llvm::Constant *Prop[] = {
|
||||||
|
@ -2809,9 +2807,7 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(Twine Name,
|
||||||
const ObjCCommonTypesHelper &ObjCTypes) {
|
const ObjCCommonTypesHelper &ObjCTypes) {
|
||||||
SmallVector<llvm::Constant *, 16> Properties;
|
SmallVector<llvm::Constant *, 16> Properties;
|
||||||
llvm::SmallPtrSet<const IdentifierInfo*, 16> PropertySet;
|
llvm::SmallPtrSet<const IdentifierInfo*, 16> PropertySet;
|
||||||
for (ObjCContainerDecl::prop_iterator I = OCD->prop_begin(),
|
for (const auto *PD : OCD->props()) {
|
||||||
E = OCD->prop_end(); I != E; ++I) {
|
|
||||||
const ObjCPropertyDecl *PD = *I;
|
|
||||||
PropertySet.insert(PD->getIdentifier());
|
PropertySet.insert(PD->getIdentifier());
|
||||||
llvm::Constant *Prop[] = {
|
llvm::Constant *Prop[] = {
|
||||||
GetPropertyName(PD->getIdentifier()),
|
GetPropertyName(PD->getIdentifier()),
|
||||||
|
|
|
@ -1160,9 +1160,8 @@ void RewriteModernObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
|
||||||
ReplaceText(LocStart, 0, "// ");
|
ReplaceText(LocStart, 0, "// ");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ObjCCategoryDecl::prop_iterator I = CatDecl->prop_begin(),
|
for (auto *I : CatDecl->props())
|
||||||
E = CatDecl->prop_end(); I != E; ++I)
|
RewriteProperty(I);
|
||||||
RewriteProperty(*I);
|
|
||||||
|
|
||||||
for (ObjCCategoryDecl::instmeth_iterator
|
for (ObjCCategoryDecl::instmeth_iterator
|
||||||
I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end();
|
I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end();
|
||||||
|
@ -1194,9 +1193,8 @@ void RewriteModernObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
RewriteMethodDeclaration(*I);
|
RewriteMethodDeclaration(*I);
|
||||||
|
|
||||||
for (ObjCInterfaceDecl::prop_iterator I = PDecl->prop_begin(),
|
for (auto *I : PDecl->props())
|
||||||
E = PDecl->prop_end(); I != E; ++I)
|
RewriteProperty(I);
|
||||||
RewriteProperty(*I);
|
|
||||||
|
|
||||||
// Lastly, comment out the @end.
|
// Lastly, comment out the @end.
|
||||||
SourceLocation LocEnd = PDecl->getAtEndRange().getBegin();
|
SourceLocation LocEnd = PDecl->getAtEndRange().getBegin();
|
||||||
|
@ -1453,9 +1451,8 @@ void RewriteModernObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) {
|
||||||
// Mark this typedef as having been written into its c++ equivalent.
|
// Mark this typedef as having been written into its c++ equivalent.
|
||||||
ObjCWrittenInterfaces.insert(ClassDecl->getCanonicalDecl());
|
ObjCWrittenInterfaces.insert(ClassDecl->getCanonicalDecl());
|
||||||
|
|
||||||
for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(),
|
for (auto *I : ClassDecl->props())
|
||||||
E = ClassDecl->prop_end(); I != E; ++I)
|
RewriteProperty(I);
|
||||||
RewriteProperty(*I);
|
|
||||||
for (ObjCInterfaceDecl::instmeth_iterator
|
for (ObjCInterfaceDecl::instmeth_iterator
|
||||||
I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end();
|
I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
|
@ -7089,11 +7086,7 @@ void RewriteModernObjC::RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl,
|
||||||
PDecl->getNameAsString(), false);
|
PDecl->getNameAsString(), false);
|
||||||
|
|
||||||
// Protocol's property metadata.
|
// Protocol's property metadata.
|
||||||
std::vector<ObjCPropertyDecl *> ProtocolProperties;
|
SmallVector<ObjCPropertyDecl *, 8> ProtocolProperties(PDecl->props());
|
||||||
for (ObjCContainerDecl::prop_iterator I = PDecl->prop_begin(),
|
|
||||||
E = PDecl->prop_end(); I != E; ++I)
|
|
||||||
ProtocolProperties.push_back(*I);
|
|
||||||
|
|
||||||
Write_prop_list_t_initializer(*this, Context, Result, ProtocolProperties,
|
Write_prop_list_t_initializer(*this, Context, Result, ProtocolProperties,
|
||||||
/* Container */0,
|
/* Container */0,
|
||||||
"_OBJC_PROTOCOL_PROPERTIES_",
|
"_OBJC_PROTOCOL_PROPERTIES_",
|
||||||
|
@ -7310,11 +7303,7 @@ void RewriteModernObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl,
|
||||||
IDecl->getNameAsString());
|
IDecl->getNameAsString());
|
||||||
|
|
||||||
// Protocol's property metadata.
|
// Protocol's property metadata.
|
||||||
std::vector<ObjCPropertyDecl *> ClassProperties;
|
SmallVector<ObjCPropertyDecl *, 8> ClassProperties(CDecl->props());
|
||||||
for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(),
|
|
||||||
E = CDecl->prop_end(); I != E; ++I)
|
|
||||||
ClassProperties.push_back(*I);
|
|
||||||
|
|
||||||
Write_prop_list_t_initializer(*this, Context, Result, ClassProperties,
|
Write_prop_list_t_initializer(*this, Context, Result, ClassProperties,
|
||||||
/* Container */IDecl,
|
/* Container */IDecl,
|
||||||
"_OBJC_$_PROP_LIST_",
|
"_OBJC_$_PROP_LIST_",
|
||||||
|
@ -7569,11 +7558,7 @@ void RewriteModernObjC::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl,
|
||||||
FullCategoryName);
|
FullCategoryName);
|
||||||
|
|
||||||
// Protocol's property metadata.
|
// Protocol's property metadata.
|
||||||
std::vector<ObjCPropertyDecl *> ClassProperties;
|
SmallVector<ObjCPropertyDecl *, 8> ClassProperties(CDecl->props());
|
||||||
for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(),
|
|
||||||
E = CDecl->prop_end(); I != E; ++I)
|
|
||||||
ClassProperties.push_back(*I);
|
|
||||||
|
|
||||||
Write_prop_list_t_initializer(*this, Context, Result, ClassProperties,
|
Write_prop_list_t_initializer(*this, Context, Result, ClassProperties,
|
||||||
/* Container */IDecl,
|
/* Container */IDecl,
|
||||||
"_OBJC_$_PROP_LIST_",
|
"_OBJC_$_PROP_LIST_",
|
||||||
|
|
|
@ -980,9 +980,8 @@ void RewriteObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) {
|
||||||
// FIXME: handle category headers that are declared across multiple lines.
|
// FIXME: handle category headers that are declared across multiple lines.
|
||||||
ReplaceText(LocStart, 0, "// ");
|
ReplaceText(LocStart, 0, "// ");
|
||||||
|
|
||||||
for (ObjCCategoryDecl::prop_iterator I = CatDecl->prop_begin(),
|
for (auto *I : CatDecl->props())
|
||||||
E = CatDecl->prop_end(); I != E; ++I)
|
RewriteProperty(I);
|
||||||
RewriteProperty(*I);
|
|
||||||
|
|
||||||
for (ObjCCategoryDecl::instmeth_iterator
|
for (ObjCCategoryDecl::instmeth_iterator
|
||||||
I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end();
|
I = CatDecl->instmeth_begin(), E = CatDecl->instmeth_end();
|
||||||
|
@ -1014,9 +1013,8 @@ void RewriteObjC::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) {
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
RewriteMethodDeclaration(*I);
|
RewriteMethodDeclaration(*I);
|
||||||
|
|
||||||
for (ObjCInterfaceDecl::prop_iterator I = PDecl->prop_begin(),
|
for (auto *I : PDecl->props())
|
||||||
E = PDecl->prop_end(); I != E; ++I)
|
RewriteProperty(I);
|
||||||
RewriteProperty(*I);
|
|
||||||
|
|
||||||
// Lastly, comment out the @end.
|
// Lastly, comment out the @end.
|
||||||
SourceLocation LocEnd = PDecl->getAtEndRange().getBegin();
|
SourceLocation LocEnd = PDecl->getAtEndRange().getBegin();
|
||||||
|
@ -1245,9 +1243,8 @@ void RewriteObjC::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) {
|
||||||
}
|
}
|
||||||
RewriteObjCInternalStruct(ClassDecl, ResultStr);
|
RewriteObjCInternalStruct(ClassDecl, ResultStr);
|
||||||
|
|
||||||
for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(),
|
for (auto *I : ClassDecl->props())
|
||||||
E = ClassDecl->prop_end(); I != E; ++I)
|
RewriteProperty(I);
|
||||||
RewriteProperty(*I);
|
|
||||||
for (ObjCInterfaceDecl::instmeth_iterator
|
for (ObjCInterfaceDecl::instmeth_iterator
|
||||||
I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end();
|
I = ClassDecl->instmeth_begin(), E = ClassDecl->instmeth_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
|
|
|
@ -3458,14 +3458,10 @@ static void AddObjCProperties(ObjCContainerDecl *Container,
|
||||||
Container = getContainerDef(Container);
|
Container = getContainerDef(Container);
|
||||||
|
|
||||||
// Add properties in this container.
|
// Add properties in this container.
|
||||||
for (ObjCContainerDecl::prop_iterator P = Container->prop_begin(),
|
for (const auto *P : Container->props())
|
||||||
PEnd = Container->prop_end();
|
|
||||||
P != PEnd;
|
|
||||||
++P) {
|
|
||||||
if (AddedProperties.insert(P->getIdentifier()))
|
if (AddedProperties.insert(P->getIdentifier()))
|
||||||
Results.MaybeAddResult(Result(*P, Results.getBasePriority(*P), 0),
|
Results.MaybeAddResult(Result(P, Results.getBasePriority(P), 0),
|
||||||
CurContext);
|
CurContext);
|
||||||
}
|
|
||||||
|
|
||||||
// Add nullary methods
|
// Add nullary methods
|
||||||
if (AllowNullaryMethods) {
|
if (AllowNullaryMethods) {
|
||||||
|
@ -6981,14 +6977,10 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned I = 0, N = Containers.size(); I != N; ++I) {
|
for (unsigned I = 0, N = Containers.size(); I != N; ++I)
|
||||||
for (ObjCContainerDecl::prop_iterator P = Containers[I]->prop_begin(),
|
for (auto *P : Containers[I]->props())
|
||||||
PEnd = Containers[I]->prop_end();
|
AddObjCKeyValueCompletions(P, IsInstanceMethod, ReturnType, Context,
|
||||||
P != PEnd; ++P) {
|
|
||||||
AddObjCKeyValueCompletions(*P, IsInstanceMethod, ReturnType, Context,
|
|
||||||
KnownSelectors, Results);
|
KnownSelectors, Results);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Results.ExitScope();
|
Results.ExitScope();
|
||||||
|
|
|
@ -2680,10 +2680,8 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods,
|
||||||
// ProcessPropertyDecl is responsible for diagnosing conflicts with any
|
// ProcessPropertyDecl is responsible for diagnosing conflicts with any
|
||||||
// user-defined setter/getter. It also synthesizes setter/getter methods
|
// user-defined setter/getter. It also synthesizes setter/getter methods
|
||||||
// and adds them to the DeclContext and global method pools.
|
// and adds them to the DeclContext and global method pools.
|
||||||
for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(),
|
for (auto *I : CDecl->props())
|
||||||
E = CDecl->prop_end();
|
ProcessPropertyDecl(I, CDecl);
|
||||||
I != E; ++I)
|
|
||||||
ProcessPropertyDecl(*I, CDecl);
|
|
||||||
CDecl->setAtEndRange(AtEnd);
|
CDecl->setAtEndRange(AtEnd);
|
||||||
}
|
}
|
||||||
if (ObjCImplementationDecl *IC=dyn_cast<ObjCImplementationDecl>(ClassDecl)) {
|
if (ObjCImplementationDecl *IC=dyn_cast<ObjCImplementationDecl>(ClassDecl)) {
|
||||||
|
@ -2698,9 +2696,7 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods,
|
||||||
Ext = IDecl->visible_extensions_begin(),
|
Ext = IDecl->visible_extensions_begin(),
|
||||||
ExtEnd = IDecl->visible_extensions_end();
|
ExtEnd = IDecl->visible_extensions_end();
|
||||||
Ext != ExtEnd; ++Ext) {
|
Ext != ExtEnd; ++Ext) {
|
||||||
for (ObjCContainerDecl::prop_iterator I = Ext->prop_begin(),
|
for (const auto *Property : Ext->props()) {
|
||||||
E = Ext->prop_end(); I != E; ++I) {
|
|
||||||
ObjCPropertyDecl *Property = *I;
|
|
||||||
// Skip over properties declared @dynamic
|
// Skip over properties declared @dynamic
|
||||||
if (const ObjCPropertyImplDecl *PIDecl
|
if (const ObjCPropertyImplDecl *PIDecl
|
||||||
= IC->FindPropertyImplDecl(Property->getIdentifier()))
|
= IC->FindPropertyImplDecl(Property->getIdentifier()))
|
||||||
|
|
|
@ -1446,11 +1446,8 @@ static void CollectImmediateProperties(ObjCContainerDecl *CDecl,
|
||||||
bool IncludeProtocols = true) {
|
bool IncludeProtocols = true) {
|
||||||
|
|
||||||
if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
|
if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
|
||||||
for (ObjCContainerDecl::prop_iterator P = IDecl->prop_begin(),
|
for (auto *Prop : IDecl->props())
|
||||||
E = IDecl->prop_end(); P != E; ++P) {
|
|
||||||
ObjCPropertyDecl *Prop = *P;
|
|
||||||
PropMap[Prop->getIdentifier()] = Prop;
|
PropMap[Prop->getIdentifier()] = Prop;
|
||||||
}
|
|
||||||
if (IncludeProtocols) {
|
if (IncludeProtocols) {
|
||||||
// Scan through class's protocols.
|
// Scan through class's protocols.
|
||||||
for (ObjCInterfaceDecl::all_protocol_iterator
|
for (ObjCInterfaceDecl::all_protocol_iterator
|
||||||
|
@ -1461,11 +1458,8 @@ static void CollectImmediateProperties(ObjCContainerDecl *CDecl,
|
||||||
}
|
}
|
||||||
if (ObjCCategoryDecl *CATDecl = dyn_cast<ObjCCategoryDecl>(CDecl)) {
|
if (ObjCCategoryDecl *CATDecl = dyn_cast<ObjCCategoryDecl>(CDecl)) {
|
||||||
if (!CATDecl->IsClassExtension())
|
if (!CATDecl->IsClassExtension())
|
||||||
for (ObjCContainerDecl::prop_iterator P = CATDecl->prop_begin(),
|
for (auto *Prop : CATDecl->props())
|
||||||
E = CATDecl->prop_end(); P != E; ++P) {
|
|
||||||
ObjCPropertyDecl *Prop = *P;
|
|
||||||
PropMap[Prop->getIdentifier()] = Prop;
|
PropMap[Prop->getIdentifier()] = Prop;
|
||||||
}
|
|
||||||
if (IncludeProtocols) {
|
if (IncludeProtocols) {
|
||||||
// Scan through class's protocols.
|
// Scan through class's protocols.
|
||||||
for (ObjCCategoryDecl::protocol_iterator PI = CATDecl->protocol_begin(),
|
for (ObjCCategoryDecl::protocol_iterator PI = CATDecl->protocol_begin(),
|
||||||
|
@ -1474,9 +1468,7 @@ static void CollectImmediateProperties(ObjCContainerDecl *CDecl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ObjCProtocolDecl *PDecl = dyn_cast<ObjCProtocolDecl>(CDecl)) {
|
else if (ObjCProtocolDecl *PDecl = dyn_cast<ObjCProtocolDecl>(CDecl)) {
|
||||||
for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(),
|
for (auto *Prop : PDecl->props()) {
|
||||||
E = PDecl->prop_end(); P != E; ++P) {
|
|
||||||
ObjCPropertyDecl *Prop = *P;
|
|
||||||
ObjCPropertyDecl *PropertyFromSuper = SuperPropMap[Prop->getIdentifier()];
|
ObjCPropertyDecl *PropertyFromSuper = SuperPropMap[Prop->getIdentifier()];
|
||||||
// Exclude property for protocols which conform to class's super-class,
|
// Exclude property for protocols which conform to class's super-class,
|
||||||
// as super-class has to implement the property.
|
// as super-class has to implement the property.
|
||||||
|
@ -1523,12 +1515,10 @@ Sema::IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace,
|
||||||
|
|
||||||
// look up a property declaration whose one of its accessors is implemented
|
// look up a property declaration whose one of its accessors is implemented
|
||||||
// by this method.
|
// by this method.
|
||||||
for (ObjCContainerDecl::prop_iterator P = IFace->prop_begin(),
|
for (const auto *Property : IFace->props()) {
|
||||||
E = IFace->prop_end(); P != E; ++P) {
|
if ((Property->getGetterName() == IMD->getSelector() ||
|
||||||
ObjCPropertyDecl *property = *P;
|
Property->getSetterName() == IMD->getSelector()) &&
|
||||||
if ((property->getGetterName() == IMD->getSelector() ||
|
(Property->getPropertyIvarDecl() == IV))
|
||||||
property->getSetterName() == IMD->getSelector()) &&
|
|
||||||
(property->getPropertyIvarDecl() == IV))
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1733,13 +1723,10 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl,
|
||||||
}
|
}
|
||||||
// Add the properties of 'PDecl' to the list of properties that
|
// Add the properties of 'PDecl' to the list of properties that
|
||||||
// need to be implemented.
|
// need to be implemented.
|
||||||
for (ObjCProtocolDecl::prop_iterator
|
for (auto *PropDecl : PDecl->props()) {
|
||||||
PRI = PDecl->prop_begin(), PRE = PDecl->prop_end();
|
if ((*LazyMap)[PropDecl->getIdentifier()])
|
||||||
PRI != PRE; ++PRI) {
|
|
||||||
ObjCPropertyDecl *PropDecl = *PRI;
|
|
||||||
if ((*LazyMap)[PRI->getIdentifier()])
|
|
||||||
continue;
|
continue;
|
||||||
PropMap[PRI->getIdentifier()] = PropDecl;
|
PropMap[PropDecl->getIdentifier()] = PropDecl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1799,10 +1786,7 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl,
|
||||||
// Rules apply in non-GC mode only
|
// Rules apply in non-GC mode only
|
||||||
if (getLangOpts().getGC() != LangOptions::NonGC)
|
if (getLangOpts().getGC() != LangOptions::NonGC)
|
||||||
return;
|
return;
|
||||||
for (ObjCContainerDecl::prop_iterator I = IDecl->prop_begin(),
|
for (const auto *Property : IDecl->props()) {
|
||||||
E = IDecl->prop_end();
|
|
||||||
I != E; ++I) {
|
|
||||||
ObjCPropertyDecl *Property = *I;
|
|
||||||
ObjCMethodDecl *GetterMethod = 0;
|
ObjCMethodDecl *GetterMethod = 0;
|
||||||
ObjCMethodDecl *SetterMethod = 0;
|
ObjCMethodDecl *SetterMethod = 0;
|
||||||
bool LookedUpGetterSetter = false;
|
bool LookedUpGetterSetter = false;
|
||||||
|
|
|
@ -124,10 +124,7 @@ void DirectIvarAssignment::checkASTDecl(const ObjCImplementationDecl *D,
|
||||||
IvarToPropertyMapTy IvarToPropMap;
|
IvarToPropertyMapTy IvarToPropMap;
|
||||||
|
|
||||||
// Find all properties for this class.
|
// Find all properties for this class.
|
||||||
for (ObjCInterfaceDecl::prop_iterator I = InterD->prop_begin(),
|
for (const auto *PD : InterD->props()) {
|
||||||
E = InterD->prop_end(); I != E; ++I) {
|
|
||||||
ObjCPropertyDecl *PD = *I;
|
|
||||||
|
|
||||||
// Find the corresponding IVar.
|
// Find the corresponding IVar.
|
||||||
const ObjCIvarDecl *ID = findPropertyBackingIvar(PD, InterD,
|
const ObjCIvarDecl *ID = findPropertyBackingIvar(PD, InterD,
|
||||||
Mgr.getASTContext());
|
Mgr.getASTContext());
|
||||||
|
|
Loading…
Reference in New Issue