From e8a7dc98896ef494a76b04574afe4e7d9354d6be Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 13 Mar 2014 20:11:06 +0000 Subject: [C++11] Replacing ObjCContainerDecl iterators classmeth_begin() and classmeth_end() with iterator_range class_methods(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203840 --- clang/lib/CodeGen/CGObjCGNU.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'clang/lib/CodeGen/CGObjCGNU.cpp') diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index e55f6056417..d64d00a153c 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -1780,18 +1780,16 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) { SmallVector ClassMethodTypes; SmallVector OptionalClassMethodNames; SmallVector OptionalClassMethodTypes; - for (ObjCProtocolDecl::classmeth_iterator - iter = PD->classmeth_begin(), endIter = PD->classmeth_end(); - iter != endIter ; iter++) { + for (const auto *I : PD->class_methods()) { std::string TypeStr; - Context.getObjCEncodingForMethodDecl((*iter),TypeStr); - if ((*iter)->getImplementationControl() == ObjCMethodDecl::Optional) { + Context.getObjCEncodingForMethodDecl(I,TypeStr); + if (I->getImplementationControl() == ObjCMethodDecl::Optional) { OptionalClassMethodNames.push_back( - MakeConstantString((*iter)->getSelector().getAsString())); + MakeConstantString(I->getSelector().getAsString())); OptionalClassMethodTypes.push_back(MakeConstantString(TypeStr)); } else { ClassMethodNames.push_back( - MakeConstantString((*iter)->getSelector().getAsString())); + MakeConstantString(I->getSelector().getAsString())); ClassMethodTypes.push_back(MakeConstantString(TypeStr)); } } @@ -2013,12 +2011,10 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) { // Collect information about class methods SmallVector ClassMethodSels; SmallVector ClassMethodTypes; - for (ObjCCategoryImplDecl::classmeth_iterator - iter = OCD->classmeth_begin(), endIter = OCD->classmeth_end(); - iter != endIter ; iter++) { - ClassMethodSels.push_back((*iter)->getSelector()); + for (const auto *I : OCD->class_methods()) { + ClassMethodSels.push_back(I->getSelector()); std::string TypeStr; - CGM.getContext().getObjCEncodingForMethodDecl(*iter,TypeStr); + CGM.getContext().getObjCEncodingForMethodDecl(I,TypeStr); ClassMethodTypes.push_back(MakeConstantString(TypeStr)); } @@ -2248,12 +2244,10 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) { // Collect information about class methods SmallVector ClassMethodSels; SmallVector ClassMethodTypes; - for (ObjCImplementationDecl::classmeth_iterator - iter = OID->classmeth_begin(), endIter = OID->classmeth_end(); - iter != endIter ; iter++) { - ClassMethodSels.push_back((*iter)->getSelector()); + for (const auto *I : OID->class_methods()) { + ClassMethodSels.push_back(I->getSelector()); std::string TypeStr; - Context.getObjCEncodingForMethodDecl((*iter),TypeStr); + Context.getObjCEncodingForMethodDecl(I,TypeStr); ClassMethodTypes.push_back(MakeConstantString(TypeStr)); } // Collect the names of referenced protocols -- cgit v1.2.3