diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-13 20:11:06 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-13 20:11:06 +0000 |
commit | e8a7dc98896ef494a76b04574afe4e7d9354d6be (patch) | |
tree | 555ab81770005c5a66fca2c8cd73f40fe120f4e6 /clang/lib/CodeGen | |
parent | f26acce6f74658f8ab7ec3b0325363c228ffc5ae (diff) | |
download | bcm5719-llvm-e8a7dc98896ef494a76b04574afe4e7d9354d6be.tar.gz bcm5719-llvm-e8a7dc98896ef494a76b04574afe4e7d9354d6be.zip |
[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
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 28 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 32 |
2 files changed, 21 insertions, 39 deletions
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<llvm::Constant*, 16> ClassMethodTypes; SmallVector<llvm::Constant*, 16> OptionalClassMethodNames; SmallVector<llvm::Constant*, 16> 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<Selector, 16> ClassMethodSels; SmallVector<llvm::Constant*, 16> 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<Selector, 16> ClassMethodSels; SmallVector<llvm::Constant*, 16> 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 diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index d763c4af01e..98bdb16889d 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -2603,9 +2603,7 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { } } - for (ObjCProtocolDecl::classmeth_iterator - i = PD->classmeth_begin(), e = PD->classmeth_end(); i != e; ++i) { - ObjCMethodDecl *MD = *i; + for (const auto *MD : PD->class_methods()) { llvm::Constant *C = GetMethodDescriptionConstant(MD); if (!C) return GetOrEmitProtocolRef(PD); @@ -2941,11 +2939,9 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { // Instance methods should always be defined. InstanceMethods.push_back(GetMethodConstant(I)); - for (ObjCCategoryImplDecl::classmeth_iterator - i = OCD->classmeth_begin(), e = OCD->classmeth_end(); i != e; ++i) { + for (const auto *I : OCD->class_methods()) // Class methods should always be defined. - ClassMethods.push_back(GetMethodConstant(*i)); - } + ClassMethods.push_back(GetMethodConstant(I)); llvm::Constant *Values[7]; Values[0] = GetClassName(OCD->getIdentifier()); @@ -3068,11 +3064,9 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) { // Instance methods should always be defined. InstanceMethods.push_back(GetMethodConstant(I)); - for (ObjCImplementationDecl::classmeth_iterator - i = ID->classmeth_begin(), e = ID->classmeth_end(); i != e; ++i) { + for (const auto *I : ID->class_methods()) // Class methods should always be defined. - ClassMethods.push_back(GetMethodConstant(*i)); - } + ClassMethods.push_back(GetMethodConstant(I)); for (ObjCImplementationDecl::propimpl_iterator i = ID->propimpl_begin(), e = ID->propimpl_end(); i != e; ++i) { @@ -5653,11 +5647,9 @@ llvm::GlobalVariable * CGObjCNonFragileABIMac::BuildClassRoTInitializer( std::string MethodListName("\01l_OBJC_$_"); if (flags & NonFragileABI_Class_Meta) { MethodListName += "CLASS_METHODS_" + ID->getNameAsString(); - for (ObjCImplementationDecl::classmeth_iterator - i = ID->classmeth_begin(), e = ID->classmeth_end(); i != e; ++i) { + for (const auto *I : ID->class_methods()) // Class methods should always be defined. - Methods.push_back(GetMethodConstant(*i)); - } + Methods.push_back(GetMethodConstant(I)); } else { MethodListName += "INSTANCE_METHODS_" + ID->getNameAsString(); for (const auto *I : ID->instance_methods()) @@ -5998,11 +5990,9 @@ void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { MethodListName += "CLASS_METHODS_" + Interface->getNameAsString() + "_$_" + OCD->getNameAsString(); Methods.clear(); - for (ObjCCategoryImplDecl::classmeth_iterator - i = OCD->classmeth_begin(), e = OCD->classmeth_end(); i != e; ++i) { + for (const auto *I : OCD->class_methods()) // Class methods should always be defined. - Methods.push_back(GetMethodConstant(*i)); - } + Methods.push_back(GetMethodConstant(I)); Values[3] = EmitMethodList(MethodListName, "__DATA, __objc_const", @@ -6289,9 +6279,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( } } - for (ObjCProtocolDecl::classmeth_iterator - i = PD->classmeth_begin(), e = PD->classmeth_end(); i != e; ++i) { - ObjCMethodDecl *MD = *i; + for (const auto *MD : PD->class_methods()) { llvm::Constant *C = GetMethodDescriptionConstant(MD); if (!C) return GetOrEmitProtocolRef(PD); |