summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-03-13 21:23:55 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-03-13 21:23:55 +0000
commit3fe486a332bc206f9415f9b54e4694115a69b0ab (patch)
tree1b321402c5a8c60b8aabf381723572a0b4775d75 /clang/lib/AST/DeclObjC.cpp
parent8a5c5a016cf07fa71dde21eb128256be7924f216 (diff)
downloadbcm5719-llvm-3fe486a332bc206f9415f9b54e4694115a69b0ab.tar.gz
bcm5719-llvm-3fe486a332bc206f9415f9b54e4694115a69b0ab.zip
[C++11] Replacing ObjCInterfaceDecl iterators visible_categories_begin() and visible_categories_end() with iterator_range visible_categories(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203851
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp43
1 files changed, 10 insertions, 33 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 4b60a9eff10..fb337ba1d71 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -112,11 +112,7 @@ ObjCContainerDecl::HasUserDeclaredSetterMethod(const ObjCPropertyDecl *Property)
if (const ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(this)) {
// Also look into categories, including class extensions, looking
// for a user declared instance method.
- for (ObjCInterfaceDecl::visible_categories_iterator
- Cat = ID->visible_categories_begin(),
- CatEnd = ID->visible_categories_end();
- Cat != CatEnd;
- ++Cat) {
+ for (const auto *Cat : ID->visible_categories()) {
if (ObjCMethodDecl *MD = Cat->getInstanceMethod(Sel))
if (!MD->isImplicit())
return true;
@@ -214,10 +210,7 @@ ObjCContainerDecl::FindPropertyDeclaration(IdentifierInfo *PropertyId) const {
case Decl::ObjCInterface: {
const ObjCInterfaceDecl *OID = cast<ObjCInterfaceDecl>(this);
// Look through categories (but not extensions).
- for (ObjCInterfaceDecl::visible_categories_iterator
- Cat = OID->visible_categories_begin(),
- CatEnd = OID->visible_categories_end();
- Cat != CatEnd; ++Cat) {
+ for (const auto *Cat : OID->visible_categories()) {
if (!Cat->IsClassExtension())
if (ObjCPropertyDecl *P = Cat->FindPropertyDeclaration(PropertyId))
return P;
@@ -545,12 +538,9 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel,
return MethodDecl;
// Didn't find one yet - now look through categories.
- for (ObjCInterfaceDecl::visible_categories_iterator
- Cat = ClassDecl->visible_categories_begin(),
- CatEnd = ClassDecl->visible_categories_end();
- Cat != CatEnd; ++Cat) {
+ for (const auto *Cat : ClassDecl->visible_categories()) {
if ((MethodDecl = Cat->getMethod(Sel, isInstance)))
- if (C != (*Cat) || !MethodDecl->isImplicit())
+ if (C != Cat || !MethodDecl->isImplicit())
return MethodDecl;
if (!shallowCategoryLookup) {
@@ -560,7 +550,7 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel,
for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
E = Protocols.end(); I != E; ++I)
if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance)))
- if (C != (*Cat) || !MethodDecl->isImplicit())
+ if (C != Cat || !MethodDecl->isImplicit())
return MethodDecl;
}
}
@@ -1313,23 +1303,16 @@ ObjCInterfaceDecl::FindCategoryDeclaration(IdentifierInfo *CategoryId) const {
if (data().ExternallyCompleted)
LoadExternalDefinition();
- for (visible_categories_iterator Cat = visible_categories_begin(),
- CatEnd = visible_categories_end();
- Cat != CatEnd;
- ++Cat) {
+ for (auto *Cat : visible_categories())
if (Cat->getIdentifier() == CategoryId)
- return *Cat;
- }
+ return Cat;
return 0;
}
ObjCMethodDecl *
ObjCInterfaceDecl::getCategoryInstanceMethod(Selector Sel) const {
- for (visible_categories_iterator Cat = visible_categories_begin(),
- CatEnd = visible_categories_end();
- Cat != CatEnd;
- ++Cat) {
+ for (const auto *Cat : visible_categories()) {
if (ObjCCategoryImplDecl *Impl = Cat->getImplementation())
if (ObjCMethodDecl *MD = Impl->getInstanceMethod(Sel))
return MD;
@@ -1339,10 +1322,7 @@ ObjCInterfaceDecl::getCategoryInstanceMethod(Selector Sel) const {
}
ObjCMethodDecl *ObjCInterfaceDecl::getCategoryClassMethod(Selector Sel) const {
- for (visible_categories_iterator Cat = visible_categories_begin(),
- CatEnd = visible_categories_end();
- Cat != CatEnd;
- ++Cat) {
+ for (const auto *Cat : visible_categories()) {
if (ObjCCategoryImplDecl *Impl = Cat->getImplementation())
if (ObjCMethodDecl *MD = Impl->getClassMethod(Sel))
return MD;
@@ -1378,10 +1358,7 @@ bool ObjCInterfaceDecl::ClassImplementsProtocol(ObjCProtocolDecl *lProto,
// 2nd, look up the category.
if (lookupCategory)
- for (visible_categories_iterator Cat = visible_categories_begin(),
- CatEnd = visible_categories_end();
- Cat != CatEnd;
- ++Cat) {
+ for (const auto *Cat : visible_categories()) {
for (ObjCCategoryDecl::protocol_iterator PI = Cat->protocol_begin(),
E = Cat->protocol_end();
PI != E; ++PI)
OpenPOWER on IntegriCloud