Author: mren Date: Tue Jan 26 12:05:23 2016 New Revision: 258824 URL: http://llvm.org/viewvc/llvm-project?rev=258824&view=rev Log: Use instance_properties instead of properties. NFC.
All current properties are instance properties. This is the second patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 Modified: cfe/trunk/include/clang/AST/DeclObjC.h cfe/trunk/lib/ARCMigrate/ObjCMT.cpp cfe/trunk/lib/ARCMigrate/TransProperties.cpp cfe/trunk/lib/AST/DeclObjC.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGObjCGNU.cpp cfe/trunk/lib/CodeGen/CGObjCMac.cpp cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp cfe/trunk/lib/Sema/SemaCodeComplete.cpp cfe/trunk/lib/Sema/SemaDeclObjC.cpp cfe/trunk/lib/Sema/SemaObjCProperty.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp Modified: cfe/trunk/include/clang/AST/DeclObjC.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/include/clang/AST/DeclObjC.h (original) +++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Jan 26 12:05:23 2016 @@ -904,11 +904,13 @@ public: typedef llvm::iterator_range<specific_decl_iterator<ObjCPropertyDecl>> prop_range; - prop_range properties() const { return prop_range(prop_begin(), prop_end()); } - prop_iterator prop_begin() const { + prop_range instance_properties() const { + return prop_range(instprop_begin(), instprop_end()); + } + prop_iterator instprop_begin() const { return prop_iterator(decls_begin()); } - prop_iterator prop_end() const { + prop_iterator instprop_end() const { return prop_iterator(decls_end()); } Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original) +++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Jan 26 12:05:23 2016 @@ -588,7 +588,7 @@ void ObjCMigrateASTConsumer::migrateObjC if (!(ASTMigrateActions & FrontendOptions::ObjCMT_ReturnsInnerPointerProperty)) return; - for (auto *Prop : D->properties()) { + for (auto *Prop : D->instance_properties()) { if ((ASTMigrateActions & FrontendOptions::ObjCMT_Annotation) && !Prop->isDeprecated()) migratePropertyNsReturnsInnerPointer(Ctx, Prop); @@ -605,7 +605,7 @@ ClassImplementsAllMethodsAndProperties(A // in class interface. bool HasAtleastOneRequiredProperty = false; if (const ObjCProtocolDecl *PDecl = Protocol->getDefinition()) - for (const auto *Property : PDecl->properties()) { + for (const auto *Property : PDecl->instance_properties()) { if (Property->getPropertyImplementation() == ObjCPropertyDecl::Optional) continue; HasAtleastOneRequiredProperty = true; Modified: cfe/trunk/lib/ARCMigrate/TransProperties.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransProperties.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/ARCMigrate/TransProperties.cpp (original) +++ cfe/trunk/lib/ARCMigrate/TransProperties.cpp Tue Jan 26 12:05:23 2016 @@ -76,7 +76,7 @@ public: static void collectProperties(ObjCContainerDecl *D, AtPropDeclsTy &AtProps, AtPropDeclsTy *PrevAtProps = nullptr) { - for (auto *Prop : D->properties()) { + for (auto *Prop : D->instance_properties()) { if (Prop->getAtLoc().isInvalid()) continue; unsigned RawLoc = Prop->getAtLoc().getRawEncoding(); Modified: cfe/trunk/lib/AST/DeclObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/AST/DeclObjC.cpp (original) +++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Jan 26 12:05:23 2016 @@ -122,7 +122,7 @@ bool ObjCContainerDecl::HasUserDeclaredS // declaration of this property. If one found, presumably a setter will // be provided (properties declared in categories will not get // auto-synthesized). - for (const auto *P : Cat->properties()) + for (const auto *P : Cat->instance_properties()) if (P->getIdentifier() == Property->getIdentifier()) { if (P->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) return true; @@ -341,13 +341,13 @@ ObjCInterfaceDecl::FindPropertyVisibleIn void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap &PM, PropertyDeclOrder &PO) const { - for (auto *Prop : properties()) { + for (auto *Prop : instance_properties()) { PM[Prop->getIdentifier()] = Prop; PO.push_back(Prop); } for (const auto *Ext : known_extensions()) { const ObjCCategoryDecl *ClassExt = Ext; - for (auto *Prop : ClassExt->properties()) { + for (auto *Prop : ClassExt->instance_properties()) { PM[Prop->getIdentifier()] = Prop; PO.push_back(Prop); } @@ -1218,7 +1218,7 @@ ObjCMethodDecl::findPropertyDecl(bool Ch auto findMatchingProperty = [&](const ObjCContainerDecl *Container) -> const ObjCPropertyDecl * { - for (const auto *I : Container->properties()) { + for (const auto *I : Container->instance_properties()) { Selector NextSel = IsGetter ? I->getGetterName() : I->getSetterName(); if (NextSel == Sel) @@ -1820,7 +1820,7 @@ void ObjCProtocolDecl::collectProperties PropertyDeclOrder &PO) const { if (const ObjCProtocolDecl *PDecl = getDefinition()) { - for (auto *Prop : PDecl->properties()) { + for (auto *Prop : PDecl->instance_properties()) { // Insert into PM if not there already. PM.insert(std::make_pair(Prop->getIdentifier(), Prop)); PO.push_back(Prop); @@ -1837,7 +1837,7 @@ void ObjCProtocolDecl::collectInheritedP ProtocolPropertyMap &PM) const { if (const ObjCProtocolDecl *PDecl = getDefinition()) { bool MatchFound = false; - for (auto *Prop : PDecl->properties()) { + for (auto *Prop : PDecl->instance_properties()) { if (Prop == Property) continue; if (Prop->getIdentifier() == Property->getIdentifier()) { Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jan 26 12:05:23 2016 @@ -1822,11 +1822,11 @@ llvm::DIType *CGDebugInfo::CreateTypeDef { llvm::SmallPtrSet<const IdentifierInfo*, 16> PropertySet; for (const ObjCCategoryDecl *ClassExt : ID->known_extensions()) - for (auto *PD : ClassExt->properties()) { + for (auto *PD : ClassExt->instance_properties()) { PropertySet.insert(PD->getIdentifier()); AddProperty(PD); } - for (const auto *PD : ID->properties()) { + for (const auto *PD : ID->instance_properties()) { // Don't emit duplicate metadata for properties that were already in a // class extension. if (!PropertySet.insert(PD->getIdentifier()).second) Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original) +++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Tue Jan 26 12:05:23 2016 @@ -1849,7 +1849,7 @@ void CGObjCGNU::GenerateProtocol(const O // Add all of the property methods need adding to the method list and to the // property metadata list. - for (auto *property : PD->properties()) { + for (auto *property : PD->instance_properties()) { std::vector<llvm::Constant*> Fields; Fields.push_back(MakePropertyEncodingString(property, nullptr)); Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original) +++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Jan 26 12:05:23 2016 @@ -2881,7 +2881,7 @@ PushProtocolProperties(llvm::SmallPtrSet const ObjCCommonTypesHelper &ObjCTypes) { for (const auto *P : Proto->protocols()) PushProtocolProperties(PropertySet, Properties, Container, P, ObjCTypes); - for (const auto *PD : Proto->properties()) { + for (const auto *PD : Proto->instance_properties()) { if (!PropertySet.insert(PD->getIdentifier()).second) continue; llvm::Constant *Prop[] = { @@ -2918,11 +2918,11 @@ llvm::Constant *CGObjCCommonMac::EmitPro }; if (const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(OCD)) for (const ObjCCategoryDecl *ClassExt : OID->known_extensions()) - for (auto *PD : ClassExt->properties()) { + for (auto *PD : ClassExt->instance_properties()) { PropertySet.insert(PD->getIdentifier()); AddProperty(PD); } - for (const auto *PD : OCD->properties()) { + for (const auto *PD : OCD->instance_properties()) { // Don't emit duplicate metadata for properties that were already in a // class extension. if (!PropertySet.insert(PD->getIdentifier()).second) Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp (original) +++ cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp Tue Jan 26 12:05:23 2016 @@ -1147,7 +1147,7 @@ void RewriteModernObjC::RewriteCategoryD ReplaceText(LocStart, 0, "// "); } - for (auto *I : CatDecl->properties()) + for (auto *I : CatDecl->instance_properties()) RewriteProperty(I); for (auto *I : CatDecl->instance_methods()) @@ -1171,7 +1171,7 @@ void RewriteModernObjC::RewriteProtocolD RewriteMethodDeclaration(I); for (auto *I : PDecl->class_methods()) RewriteMethodDeclaration(I); - for (auto *I : PDecl->properties()) + for (auto *I : PDecl->instance_properties()) RewriteProperty(I); // Lastly, comment out the @end. @@ -1417,7 +1417,7 @@ void RewriteModernObjC::RewriteInterface // Mark this typedef as having been written into its c++ equivalent. ObjCWrittenInterfaces.insert(ClassDecl->getCanonicalDecl()); - for (auto *I : ClassDecl->properties()) + for (auto *I : ClassDecl->instance_properties()) RewriteProperty(I); for (auto *I : ClassDecl->instance_methods()) RewriteMethodDeclaration(I); @@ -6995,7 +6995,8 @@ void RewriteModernObjC::RewriteObjCProto PDecl->getNameAsString(), false); // Protocol's property metadata. - SmallVector<ObjCPropertyDecl *, 8> ProtocolProperties(PDecl->properties()); + SmallVector<ObjCPropertyDecl *, 8> ProtocolProperties( + PDecl->instance_properties()); Write_prop_list_t_initializer(*this, Context, Result, ProtocolProperties, /* Container */nullptr, "_OBJC_PROTOCOL_PROPERTIES_", @@ -7208,7 +7209,8 @@ void RewriteModernObjC::RewriteObjCClass IDecl->getNameAsString()); // Protocol's property metadata. - SmallVector<ObjCPropertyDecl *, 8> ClassProperties(CDecl->properties()); + SmallVector<ObjCPropertyDecl *, 8> ClassProperties( + CDecl->instance_properties()); Write_prop_list_t_initializer(*this, Context, Result, ClassProperties, /* Container */IDecl, "_OBJC_$_PROP_LIST_", @@ -7453,7 +7455,8 @@ void RewriteModernObjC::RewriteObjCCateg FullCategoryName); // Protocol's property metadata. - SmallVector<ObjCPropertyDecl *, 8> ClassProperties(CDecl->properties()); + SmallVector<ObjCPropertyDecl *, 8> ClassProperties( + CDecl->instance_properties()); Write_prop_list_t_initializer(*this, Context, Result, ClassProperties, /* Container */IDecl, "_OBJC_$_PROP_LIST_", Modified: cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp (original) +++ cfe/trunk/lib/Frontend/Rewrite/RewriteObjC.cpp Tue Jan 26 12:05:23 2016 @@ -969,7 +969,7 @@ void RewriteObjC::RewriteCategoryDecl(Ob // FIXME: handle category headers that are declared across multiple lines. ReplaceText(LocStart, 0, "// "); - for (auto *I : CatDecl->properties()) + for (auto *I : CatDecl->instance_properties()) RewriteProperty(I); for (auto *I : CatDecl->instance_methods()) RewriteMethodDeclaration(I); @@ -992,7 +992,7 @@ void RewriteObjC::RewriteProtocolDecl(Ob RewriteMethodDeclaration(I); for (auto *I : PDecl->class_methods()) RewriteMethodDeclaration(I); - for (auto *I : PDecl->properties()) + for (auto *I : PDecl->instance_properties()) RewriteProperty(I); // Lastly, comment out the @end. @@ -1210,7 +1210,7 @@ void RewriteObjC::RewriteInterfaceDecl(O } RewriteObjCInternalStruct(ClassDecl, ResultStr); - for (auto *I : ClassDecl->properties()) + for (auto *I : ClassDecl->instance_properties()) RewriteProperty(I); for (auto *I : ClassDecl->instance_methods()) RewriteMethodDeclaration(I); Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original) +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Tue Jan 26 12:05:23 2016 @@ -3570,7 +3570,7 @@ static void AddObjCProperties(const Code Container = getContainerDef(Container); // Add properties in this container. - for (const auto *P : Container->properties()) + for (const auto *P : Container->instance_properties()) if (AddedProperties.insert(P->getIdentifier()).second) Results.MaybeAddResult(Result(P, Results.getBasePriority(P), nullptr), CurContext); @@ -7178,7 +7178,7 @@ void Sema::CodeCompleteObjCMethodDecl(Sc Containers.push_back(Cat); for (unsigned I = 0, N = Containers.size(); I != N; ++I) - for (auto *P : Containers[I]->properties()) + for (auto *P : Containers[I]->instance_properties()) AddObjCKeyValueCompletions(P, IsInstanceMethod, ReturnType, Context, KnownSelectors, Results); } Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Jan 26 12:05:23 2016 @@ -3637,7 +3637,7 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceR // ProcessPropertyDecl is responsible for diagnosing conflicts with any // user-defined setter/getter. It also synthesizes setter/getter methods // and adds them to the DeclContext and global method pools. - for (auto *I : CDecl->properties()) + for (auto *I : CDecl->instance_properties()) ProcessPropertyDecl(I); CDecl->setAtEndRange(AtEnd); } @@ -3650,7 +3650,7 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceR // property will be synthesized when property with same name is // seen in the @implementation. for (const auto *Ext : IDecl->visible_extensions()) { - for (const auto *Property : Ext->properties()) { + for (const auto *Property : Ext->instance_properties()) { // Skip over properties declared @dynamic if (const ObjCPropertyImplDecl *PIDecl = IC->FindPropertyImplDecl(Property->getIdentifier())) Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original) +++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Tue Jan 26 12:05:23 2016 @@ -1521,7 +1521,7 @@ static void CollectImmediateProperties(O bool IncludeProtocols = true) { if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl)) { - for (auto *Prop : IDecl->properties()) + for (auto *Prop : IDecl->instance_properties()) PropMap[Prop->getIdentifier()] = Prop; // Collect the properties from visible extensions. @@ -1535,7 +1535,7 @@ static void CollectImmediateProperties(O } } if (ObjCCategoryDecl *CATDecl = dyn_cast<ObjCCategoryDecl>(CDecl)) { - for (auto *Prop : CATDecl->properties()) + for (auto *Prop : CATDecl->instance_properties()) PropMap[Prop->getIdentifier()] = Prop; if (IncludeProtocols) { // Scan through class's protocols. @@ -1544,7 +1544,7 @@ static void CollectImmediateProperties(O } } else if (ObjCProtocolDecl *PDecl = dyn_cast<ObjCProtocolDecl>(CDecl)) { - for (auto *Prop : PDecl->properties()) { + for (auto *Prop : PDecl->instance_properties()) { ObjCPropertyDecl *PropertyFromSuper = SuperPropMap[Prop->getIdentifier()]; // Exclude property for protocols which conform to class's super-class, // as super-class has to implement the property. @@ -1590,7 +1590,7 @@ Sema::IvarBacksCurrentMethodAccessor(Obj // look up a property declaration whose one of its accessors is implemented // by this method. - for (const auto *Property : IFace->properties()) { + for (const auto *Property : IFace->instance_properties()) { if ((Property->getGetterName() == IMD->getSelector() || Property->getSetterName() == IMD->getSelector()) && (Property->getPropertyIvarDecl() == IV)) @@ -1599,7 +1599,7 @@ Sema::IvarBacksCurrentMethodAccessor(Obj // Also look up property declaration in class extension whose one of its // accessors is implemented by this method. for (const auto *Ext : IFace->known_extensions()) - for (const auto *Property : Ext->properties()) + for (const auto *Property : Ext->instance_properties()) if ((Property->getGetterName() == IMD->getSelector() || Property->getSetterName() == IMD->getSelector()) && (Property->getPropertyIvarDecl() == IV)) @@ -1806,7 +1806,7 @@ void Sema::DiagnoseUnimplementedProperti } // Add the properties of 'PDecl' to the list of properties that // need to be implemented. - for (auto *PropDecl : PDecl->properties()) { + for (auto *PropDecl : PDecl->instance_properties()) { if ((*LazyMap)[PropDecl->getIdentifier()]) continue; PropMap[PropDecl->getIdentifier()] = PropDecl; @@ -1893,10 +1893,10 @@ Sema::AtomicPropertySetterGetterRules (O if (getLangOpts().getGC() != LangOptions::NonGC) return; ObjCContainerDecl::PropertyMap PM; - for (auto *Prop : IDecl->properties()) + for (auto *Prop : IDecl->instance_properties()) PM[Prop->getIdentifier()] = Prop; for (const auto *Ext : IDecl->known_extensions()) - for (auto *Prop : Ext->properties()) + for (auto *Prop : Ext->instance_properties()) PM[Prop->getIdentifier()] = Prop; for (ObjCContainerDecl::PropertyMap::iterator I = PM.begin(), E = PM.end(); Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp?rev=258824&r1=258823&r2=258824&view=diff ============================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp Tue Jan 26 12:05:23 2016 @@ -123,7 +123,7 @@ void DirectIvarAssignment::checkASTDecl( IvarToPropertyMapTy IvarToPropMap; // Find all properties for this class. - for (const auto *PD : InterD->properties()) { + for (const auto *PD : InterD->instance_properties()) { // Find the corresponding IVar. const ObjCIvarDecl *ID = findPropertyBackingIvar(PD, InterD, Mgr.getASTContext()); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits