diff options
author | Manman Ren <manman.ren@gmail.com> | 2016-01-26 18:05:23 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2016-01-26 18:05:23 +0000 |
commit | a7a8b1f2c07aa87cbc37a5ded062b44250ef46dd (patch) | |
tree | 8b8f56ffb9df2fba563a556c945c0c7bbe8df3e1 /clang/lib | |
parent | 1eac5948dbf95abab5af7162dea7cf1d34585373 (diff) | |
download | bcm5719-llvm-a7a8b1f2c07aa87cbc37a5ded062b44250ef46dd.tar.gz bcm5719-llvm-a7a8b1f2c07aa87cbc37a5ded062b44250ef46dd.zip |
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
llvm-svn: 258824
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/ARCMigrate/ObjCMT.cpp | 4 | ||||
-rw-r--r-- | clang/lib/ARCMigrate/TransProperties.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 12 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp | 15 | ||||
-rw-r--r-- | clang/lib/Frontend/Rewrite/RewriteObjC.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 16 | ||||
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp | 2 |
12 files changed, 40 insertions, 37 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index 50b113660d3..10996e83208 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/lib/ARCMigrate/ObjCMT.cpp @@ -588,7 +588,7 @@ void ObjCMigrateASTConsumer::migrateObjCContainerDecl(ASTContext &Ctx, 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(ASTContext &Ctx, // 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; diff --git a/clang/lib/ARCMigrate/TransProperties.cpp b/clang/lib/ARCMigrate/TransProperties.cpp index 8667bc2a37d..389b03666bf 100644 --- a/clang/lib/ARCMigrate/TransProperties.cpp +++ b/clang/lib/ARCMigrate/TransProperties.cpp @@ -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(); diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 050a0f53f1e..aa012edf65c 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -122,7 +122,7 @@ bool ObjCContainerDecl::HasUserDeclaredSetterMethod( // 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::FindPropertyVisibleInPrimaryClass( 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 CheckOverrides) const { 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::collectPropertiesToImplement(PropertyMap &PM, 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::collectInheritedProtocolProperties( 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()) { diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 675b5eb07c5..6d19e50e9f7 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1822,11 +1822,11 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, { 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) diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index f0af3e924c0..d3722d64fc8 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -1849,7 +1849,7 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { // 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)); diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 079ec1531f8..035f90adfcf 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -2881,7 +2881,7 @@ PushProtocolProperties(llvm::SmallPtrSet<const IdentifierInfo*,16> &PropertySet, 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::EmitPropertyList(Twine Name, }; 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) diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp index be68d42affa..9fae7f02995 100644 --- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -1147,7 +1147,7 @@ void RewriteModernObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { 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::RewriteProtocolDecl(ObjCProtocolDecl *PDecl) { 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::RewriteInterfaceDecl(ObjCInterfaceDecl *ClassDecl) { // 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::RewriteObjCProtocolMetaData(ObjCProtocolDecl *PDecl, 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::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, 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::RewriteObjCCategoryImplDecl(ObjCCategoryImplDecl *IDecl, 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_", diff --git a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp index e0ddadb1230..67b2bdef5de 100644 --- a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -969,7 +969,7 @@ void RewriteObjC::RewriteCategoryDecl(ObjCCategoryDecl *CatDecl) { // 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(ObjCProtocolDecl *PDecl) { 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(ObjCInterfaceDecl *ClassDecl) { } RewriteObjCInternalStruct(ClassDecl, ResultStr); - for (auto *I : ClassDecl->properties()) + for (auto *I : ClassDecl->instance_properties()) RewriteProperty(I); for (auto *I : ClassDecl->instance_methods()) RewriteMethodDeclaration(I); diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 21cf6258514..59ab0ba618d 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -3570,7 +3570,7 @@ static void AddObjCProperties(const CodeCompletionContext &CCContext, 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(Scope *S, 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); } diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index a2f41a7cc30..e4e3aef2e6c 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -3637,7 +3637,7 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods, // 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, SourceRange AtEnd, ArrayRef<Decl *> allMethods, // 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())) diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 1cb84e44806..db37a754791 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -1521,7 +1521,7 @@ static void CollectImmediateProperties(ObjCContainerDecl *CDecl, 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(ObjCContainerDecl *CDecl, } } 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(ObjCContainerDecl *CDecl, } } 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(ObjCInterfaceDecl *IFace, // 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(ObjCInterfaceDecl *IFace, // 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::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl, } // 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 (ObjCImplDecl* IMPDecl, 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(); diff --git a/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp b/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp index ad478cbf782..5efb9096f2f 100644 --- a/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp @@ -123,7 +123,7 @@ void DirectIvarAssignment::checkASTDecl(const ObjCImplementationDecl *D, 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()); |