summaryrefslogtreecommitdiffstats
path: root/lib/Rewrite
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-03-17 15:23:01 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-03-17 15:23:01 +0000
commitc4430a74cb88c0f0281ad6738feab20e9a7e481e (patch)
treed6a298ded863bceba15a712b723cc4895a173a7b /lib/Rewrite
parente544d56f34a589cd618c699cd9edc9569c85a99d (diff)
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite')
-rw-r--r--lib/Rewrite/Frontend/RewriteModernObjC.cpp34
-rw-r--r--lib/Rewrite/Frontend/RewriteObjC.cpp34
2 files changed, 24 insertions, 44 deletions
diff --git a/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/lib/Rewrite/Frontend/RewriteModernObjC.cpp
index 8801a3c8c7..febfb9bce7 100644
--- a/lib/Rewrite/Frontend/RewriteModernObjC.cpp
+++ b/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/lib/Rewrite/Frontend/RewriteObjC.cpp b/lib/Rewrite/Frontend/RewriteObjC.cpp
index 18e3dbc839..80d6cc6c33 100644
--- a/lib/Rewrite/Frontend/RewriteObjC.cpp
+++ b/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;
}