summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-03-13 20:55:22 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-03-13 20:55:22 +0000
commita9f49e394c8e25c1f6e0693e52a770125f01d7e1 (patch)
treeb0f7235edce127c97920a3c67e678a67cae36834 /clang/lib/AST/DeclObjC.cpp
parente937888e1c4eeafba7eab0359e00f5d28da93ecd (diff)
downloadbcm5719-llvm-a9f49e394c8e25c1f6e0693e52a770125f01d7e1.tar.gz
bcm5719-llvm-a9f49e394c8e25c1f6e0693e52a770125f01d7e1.zip
[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.
llvm-svn: 203848
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 4fd152e0902..4b60a9eff10 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -134,13 +134,10 @@ ObjCContainerDecl::HasUserDeclaredSetterMethod(const ObjCPropertyDecl *Property)
}
// Also look into protocols, for a user declared instance method.
- for (ObjCInterfaceDecl::all_protocol_iterator P =
- ID->all_referenced_protocol_begin(),
- PE = ID->all_referenced_protocol_end(); P != PE; ++P) {
- ObjCProtocolDecl *Proto = (*P);
+ for (const auto *Proto : ID->all_referenced_protocols())
if (Proto->HasUserDeclaredSetterMethod(Property))
return true;
- }
+
// And in its super class.
ObjCInterfaceDecl *OSC = ID->getSuperClass();
while (OSC) {
@@ -227,10 +224,8 @@ ObjCContainerDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const {
}
// Look through protocols.
- for (ObjCInterfaceDecl::all_protocol_iterator
- I = OID->all_referenced_protocol_begin(),
- E = OID->all_referenced_protocol_end(); I != E; ++I)
- if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId))
+ for (const auto *I : OID->all_referenced_protocols())
+ if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId))
return P;
// Finally, check the super class.
@@ -274,10 +269,8 @@ ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass(
return PD;
// Look through protocols.
- for (ObjCInterfaceDecl::all_protocol_iterator
- I = all_referenced_protocol_begin(),
- E = all_referenced_protocol_end(); I != E; ++I)
- if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId))
+ for (const auto *I : all_referenced_protocols())
+ if (ObjCPropertyDecl *P = I->FindPropertyDeclaration(PropertyId))
return P;
return 0;
@@ -289,10 +282,8 @@ void ObjCInterfaceDecl::collectPropertiesToImplement(PropertyMap &PM,
PM[Prop->getIdentifier()] = Prop;
PO.push_back(Prop);
}
- for (ObjCInterfaceDecl::all_protocol_iterator
- PI = all_referenced_protocol_begin(),
- E = all_referenced_protocol_end(); PI != E; ++PI)
- (*PI)->collectPropertiesToImplement(PM, PO);
+ for (const auto *PI : all_referenced_protocols())
+ PI->collectPropertiesToImplement(PM, PO);
// Note, the properties declared only in class extensions are still copied
// into the main @interface's property list, and therefore we don't
// explicitly, have to search class extension properties.
@@ -338,10 +329,7 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList(
for (unsigned i = 0; i < ExtNum; i++) {
bool protocolExists = false;
ObjCProtocolDecl *ProtoInExtension = ExtList[i];
- for (all_protocol_iterator
- p = all_referenced_protocol_begin(),
- e = all_referenced_protocol_end(); p != e; ++p) {
- ObjCProtocolDecl *Proto = (*p);
+ for (auto *Proto : all_referenced_protocols()) {
if (C.ProtocolCompatibleWithProtocol(ProtoInExtension, Proto)) {
protocolExists = true;
break;
@@ -357,9 +345,8 @@ void ObjCInterfaceDecl::mergeClassExtensionProtocolList(
return;
// Merge ProtocolRefs into class's protocol list;
- for (all_protocol_iterator p = all_referenced_protocol_begin(),
- e = all_referenced_protocol_end(); p != e; ++p) {
- ProtocolRefs.push_back(*p);
+ for (auto *P : all_referenced_protocols()) {
+ ProtocolRefs.push_back(P);
}
data().AllReferencedProtocols.set(ProtocolRefs.data(), ProtocolRefs.size(),C);
@@ -521,11 +508,9 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass(
ObjCProtocolDecl *
ObjCInterfaceDecl::lookupNestedProtocol(IdentifierInfo *Name) {
- for (ObjCInterfaceDecl::all_protocol_iterator P =
- all_referenced_protocol_begin(), PE = all_referenced_protocol_end();
- P != PE; ++P)
- if ((*P)->lookupProtocolNamed(Name))
- return (*P);
+ for (auto *P : all_referenced_protocols())
+ if (P->lookupProtocolNamed(Name))
+ return P;
ObjCInterfaceDecl *SuperClass = getSuperClass();
return SuperClass ? SuperClass->lookupNestedProtocol(Name) : NULL;
}
OpenPOWER on IntegriCloud