diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-13 20:55:22 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-13 20:55:22 +0000 |
commit | a2a1fef4c970a1f5b24b5c6e0375646865751b53 (patch) | |
tree | d64b9273375bf69db0198b4a73e70fd871e83089 /lib/Sema/SemaObjCProperty.cpp | |
parent | 2a9429379f0d5ba033b88610e2b369767177abad (diff) |
[C++11] Replacing ObjCInterfaceDecl iterators all_referenced_protocol_begin() and all_referenced_protocol_end() with iterator_range all_referenced_protocols(). Updating all of the usages of the iterators with range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203848 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index d918aeca15..a10e3d8370 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -227,11 +227,8 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, } } else { // Slower path: look in all protocols we referenced. - for (ObjCInterfaceDecl::all_protocol_iterator - P = IFace->all_referenced_protocol_begin(), - PEnd = IFace->all_referenced_protocol_end(); - P != PEnd; ++P) { - CheckPropertyAgainstProtocol(*this, Res, *P, KnownProtos); + for (auto *P : IFace->all_referenced_protocols()) { + CheckPropertyAgainstProtocol(*this, Res, P, KnownProtos); } } } else if (ObjCCategoryDecl *Cat = dyn_cast<ObjCCategoryDecl>(ClassDecl)) { @@ -763,18 +760,14 @@ DiagnosePropertyMismatchDeclInProtocols(Sema &S, SourceLocation AtLoc, ObjCInterfaceDecl *ClassDecl, ObjCPropertyDecl *Property) { ObjCInterfaceDecl::ProtocolPropertyMap PropMap; - for (ObjCInterfaceDecl::all_protocol_iterator - PI = ClassDecl->all_referenced_protocol_begin(), - E = ClassDecl->all_referenced_protocol_end(); PI != E; ++PI) { - if (const ObjCProtocolDecl *PDecl = (*PI)->getDefinition()) + for (const auto *PI : ClassDecl->all_referenced_protocols()) { + if (const ObjCProtocolDecl *PDecl = PI->getDefinition()) PDecl->collectInheritedProtocolProperties(Property, PropMap); } if (ObjCInterfaceDecl *SDecl = ClassDecl->getSuperClass()) while (SDecl) { - for (ObjCInterfaceDecl::all_protocol_iterator - PI = SDecl->all_referenced_protocol_begin(), - E = SDecl->all_referenced_protocol_end(); PI != E; ++PI) { - if (const ObjCProtocolDecl *PDecl = (*PI)->getDefinition()) + for (const auto *PI : SDecl->all_referenced_protocols()) { + if (const ObjCProtocolDecl *PDecl = PI->getDefinition()) PDecl->collectInheritedProtocolProperties(Property, PropMap); } SDecl = SDecl->getSuperClass(); @@ -1447,10 +1440,8 @@ static void CollectImmediateProperties(ObjCContainerDecl *CDecl, PropMap[Prop->getIdentifier()] = Prop; if (IncludeProtocols) { // Scan through class's protocols. - for (ObjCInterfaceDecl::all_protocol_iterator - PI = IDecl->all_referenced_protocol_begin(), - E = IDecl->all_referenced_protocol_end(); PI != E; ++PI) - CollectImmediateProperties((*PI), PropMap, SuperPropMap); + for (auto *PI : IDecl->all_referenced_protocols()) + CollectImmediateProperties(PI, PropMap, SuperPropMap); } } if (ObjCCategoryDecl *CATDecl = dyn_cast<ObjCCategoryDecl>(CDecl)) { @@ -1698,11 +1689,7 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl, if (IDecl) { std::unique_ptr<ObjCContainerDecl::PropertyMap> LazyMap; - for (ObjCInterfaceDecl::all_protocol_iterator - PI = IDecl->all_referenced_protocol_begin(), - PE = IDecl->all_referenced_protocol_end(); - PI != PE; ++PI) { - ObjCProtocolDecl *PDecl = *PI; + for (auto *PDecl : IDecl->all_referenced_protocols()) { if (!PDecl->hasAttr<ObjCExplicitProtocolImplAttr>()) continue; // Lazily construct a set of all the properties in the @interface |