diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-17 15:23:01 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-17 15:23:01 +0000 |
commit | 40bd0aaf686432aea96cff32d5393ec064a9dd0e (patch) | |
tree | c4af76848aebd110d674efb1a1afc3477105e01e /clang/lib/Rewrite | |
parent | e7846206e82d8798cb98e1f533bc9da0214adb0a (diff) | |
download | llvm-40bd0aaf686432aea96cff32d5393ec064a9dd0e.tar.gz |
[C++11] Replacing FunctionProtoType iterators param_type_begin() and param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 204045
Diffstat (limited to 'clang/lib/Rewrite')
-rw-r--r-- | clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp | 34 | ||||
-rw-r--r-- | clang/lib/Rewrite/Frontend/RewriteObjC.cpp | 34 |
2 files changed, 24 insertions, 44 deletions
diff --git a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp index 8801a3c8c73a..febfb9bce767 100644 --- a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp +++ b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp @@ -623,10 +623,8 @@ void RewriteModernObjC::RewriteBlocksInFunctionProtoType(QualType funcType, NamedDecl *D) { if (const FunctionProtoType *fproto = dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) { - for (FunctionProtoType::param_type_iterator I = fproto->param_type_begin(), - E = fproto->param_type_end(); - I && (I != E); ++I) - if (isTopLevelBlockPointerType(*I)) { + for (const auto &I : fproto->param_types()) + if (isTopLevelBlockPointerType(I)) { // All the args are checked/rewritten. Don't call twice! RewriteBlockPointerDecl(D); break; @@ -4660,10 +4658,8 @@ QualType RewriteModernObjC::convertFunctionTypeOfBlocks(const FunctionType *FT) bool modified = convertObjCTypeToCStyleType(Res); if (FTP) { - for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), - E = FTP->param_type_end(); - I && (I != E); ++I) { - QualType t = *I; + for (auto &I : FTP->param_types()) { + QualType t = I; // Make sure we convert "t (^)(...)" to "t (*)(...)". if (convertObjCTypeToCStyleType(t)) modified = true; @@ -4729,10 +4725,8 @@ Stmt *RewriteModernObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp // Push the block argument type. ArgTypes.push_back(PtrBlock); if (FTP) { - for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), - E = FTP->param_type_end(); - I && (I != E); ++I) { - QualType t = *I; + for (auto &I : FTP->param_types()) { + QualType t = I; // Make sure we convert "t (^)(...)" to "t (*)(...)". if (!convertBlockPointerToFunctionPointer(t)) convertToUnqualifiedObjCType(t); @@ -4950,10 +4944,8 @@ bool RewriteModernObjC::PointerTypeTakesAnyBlockArguments(QualType QT) { FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { - for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), - E = FTP->param_type_end(); - I != E; ++I) - if (isTopLevelBlockPointerType(*I)) + for (const auto &I : FTP->param_types()) + if (isTopLevelBlockPointerType(I)) return true; } return false; @@ -4970,13 +4962,11 @@ bool RewriteModernObjC::PointerTypeTakesAnyObjCQualifiedType(QualType QT) { FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { - for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), - E = FTP->param_type_end(); - I != E; ++I) { - if ((*I)->isObjCQualifiedIdType()) + for (const auto &I : FTP->param_types()) { + if (I->isObjCQualifiedIdType()) return true; - if ((*I)->isObjCObjectPointerType() && - (*I)->getPointeeType()->isObjCQualifiedInterfaceType()) + if (I->isObjCObjectPointerType() && + I->getPointeeType()->isObjCQualifiedInterfaceType()) return true; } diff --git a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp index 18e3dbc83999..80d6cc6c33cf 100644 --- a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp +++ b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp @@ -554,10 +554,8 @@ void RewriteObjC::RewriteBlocksInFunctionProtoType(QualType funcType, NamedDecl *D) { if (const FunctionProtoType *fproto = dyn_cast<FunctionProtoType>(funcType.IgnoreParens())) { - for (FunctionProtoType::param_type_iterator I = fproto->param_type_begin(), - E = fproto->param_type_end(); - I && (I != E); ++I) - if (isTopLevelBlockPointerType(*I)) { + for (const auto &I : fproto->param_types()) + if (isTopLevelBlockPointerType(I)) { // All the args are checked/rewritten. Don't call twice! RewriteBlockPointerDecl(D); break; @@ -3741,10 +3739,8 @@ QualType RewriteObjC::convertFunctionTypeOfBlocks(const FunctionType *FT) { bool HasBlockType = convertBlockPointerToFunctionPointer(Res); if (FTP) { - for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), - E = FTP->param_type_end(); - I && (I != E); ++I) { - QualType t = *I; + for (auto &I : FTP->param_types()) { + QualType t = I; // Make sure we convert "t (^)(...)" to "t (*)(...)". if (convertBlockPointerToFunctionPointer(t)) HasBlockType = true; @@ -3812,10 +3808,8 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) { // Push the block argument type. ArgTypes.push_back(PtrBlock); if (FTP) { - for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), - E = FTP->param_type_end(); - I && (I != E); ++I) { - QualType t = *I; + for (auto &I : FTP->param_types()) { + QualType t = I; // Make sure we convert "t (^)(...)" to "t (*)(...)". if (!convertBlockPointerToFunctionPointer(t)) convertToUnqualifiedObjCType(t); @@ -4016,10 +4010,8 @@ bool RewriteObjC::PointerTypeTakesAnyBlockArguments(QualType QT) { FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { - for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), - E = FTP->param_type_end(); - I != E; ++I) - if (isTopLevelBlockPointerType(*I)) + for (const auto &I : FTP->param_types()) + if (isTopLevelBlockPointerType(I)) return true; } return false; @@ -4036,13 +4028,11 @@ bool RewriteObjC::PointerTypeTakesAnyObjCQualifiedType(QualType QT) { FTP = BPT->getPointeeType()->getAs<FunctionProtoType>(); } if (FTP) { - for (FunctionProtoType::param_type_iterator I = FTP->param_type_begin(), - E = FTP->param_type_end(); - I != E; ++I) { - if ((*I)->isObjCQualifiedIdType()) + for (const auto &I : FTP->param_types()) { + if (I->isObjCQualifiedIdType()) return true; - if ((*I)->isObjCObjectPointerType() && - (*I)->getPointeeType()->isObjCQualifiedInterfaceType()) + if (I->isObjCObjectPointerType() && + I->getPointeeType()->isObjCQualifiedInterfaceType()) return true; } |