diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-13 22:58:06 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-13 22:58:06 +0000 |
commit | 0f6e64d50511aeab55ed6929d8bc1953b776bb92 (patch) | |
tree | 809e302691a93f939b33e1eff7ccd8925c8a84d7 /clang/lib/AST/DeclObjC.cpp | |
parent | 9b8f9c3d95c40bbe4e575929d97ad8b3cce7244e (diff) | |
download | bcm5719-llvm-0f6e64d50511aeab55ed6929d8bc1953b776bb92.tar.gz bcm5719-llvm-0f6e64d50511aeab55ed6929d8bc1953b776bb92.zip |
[C++11] Replacing ObjCProtocolDecl iterators protocol_begin() and protocol_end() with iterator_range protocols(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203863
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index 0844a222f8c..dd96d39917c 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -143,11 +143,9 @@ ObjCContainerDecl::HasUserDeclaredSetterMethod(const ObjCPropertyDecl *Property) } } if (const ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(this)) - for (ObjCProtocolDecl::protocol_iterator PI = PD->protocol_begin(), - E = PD->protocol_end(); PI != E; ++PI) { - if ((*PI)->HasUserDeclaredSetterMethod(Property)) + for (const auto *PI : PD->protocols()) + if (PI->HasUserDeclaredSetterMethod(Property)) return true; - } return false; } @@ -201,9 +199,8 @@ ObjCContainerDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const { break; case Decl::ObjCProtocol: { const ObjCProtocolDecl *PID = cast<ObjCProtocolDecl>(this); - for (ObjCProtocolDecl::protocol_iterator I = PID->protocol_begin(), - E = PID->protocol_end(); I != E; ++I) - if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId)) + for (const auto *I : PID->protocols()) + if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId)) return P; break; } @@ -966,10 +963,8 @@ static void CollectOverriddenMethodsRecurse(const ObjCContainerDecl *Container, } if (const ObjCProtocolDecl *Protocol = dyn_cast<ObjCProtocolDecl>(Container)){ - for (ObjCProtocolDecl::protocol_iterator P = Protocol->protocol_begin(), - PEnd = Protocol->protocol_end(); - P != PEnd; ++P) - CollectOverriddenMethodsRecurse(*P, Method, Methods, MovedToSuper); + for (const auto *P : Protocol->protocols()) + CollectOverriddenMethodsRecurse(P, Method, Methods, MovedToSuper); } if (const ObjCInterfaceDecl * @@ -1496,8 +1491,8 @@ ObjCProtocolDecl *ObjCProtocolDecl::lookupProtocolNamed(IdentifierInfo *Name) { if (Name == getIdentifier()) return PDecl; - for (protocol_iterator I = protocol_begin(), E = protocol_end(); I != E; ++I) - if ((PDecl = (*I)->lookupProtocolNamed(Name))) + for (auto *I : protocols()) + if ((PDecl = I->lookupProtocolNamed(Name))) return PDecl; return NULL; @@ -1518,8 +1513,8 @@ ObjCMethodDecl *ObjCProtocolDecl::lookupMethod(Selector Sel, if ((MethodDecl = getMethod(Sel, isInstance))) return MethodDecl; - for (protocol_iterator I = protocol_begin(), E = protocol_end(); I != E; ++I) - if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance))) + for (const auto *I : protocols()) + if ((MethodDecl = I->lookupMethod(Sel, isInstance))) return MethodDecl; return NULL; } @@ -1548,9 +1543,8 @@ void ObjCProtocolDecl::collectPropertiesToImplement(PropertyMap &PM, PO.push_back(Prop); } // Scan through protocol's protocols. - for (ObjCProtocolDecl::protocol_iterator PI = PDecl->protocol_begin(), - E = PDecl->protocol_end(); PI != E; ++PI) - (*PI)->collectPropertiesToImplement(PM, PO); + for (const auto *PI : PDecl->protocols()) + PI->collectPropertiesToImplement(PM, PO); } } @@ -1571,9 +1565,8 @@ void ObjCProtocolDecl::collectInheritedProtocolProperties( } // Scan through protocol's protocols which did not have a matching property. if (!MatchFound) - for (ObjCProtocolDecl::protocol_iterator PI = PDecl->protocol_begin(), - E = PDecl->protocol_end(); PI != E; ++PI) - (*PI)->collectInheritedProtocolProperties(Property, PM); + for (const auto *PI : PDecl->protocols()) + PI->collectInheritedProtocolProperties(Property, PM); } } |