[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
diff --git a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
index 8801a3c..febfb9b 100644
--- a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
+++ b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
@@ -623,10 +623,8 @@
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 @@
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 @@
// 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 @@
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 @@
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;
}