Skip to content

Commit 64e7cb2

Browse files
[Rewrite] Use auto (NFC)
I'm planning to change the type of BlockByCopyDecls and BlockByRefDecls to SetVector. Declaring these iterators with auto makes it easier to migrate to the new type.
1 parent 23558af commit 64e7cb2

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

clang/lib/Frontend/Rewrite/RewriteObjC.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,8 +3292,8 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
32923292

32933293
// Create local declarations to avoid rewriting all closure decl ref exprs.
32943294
// First, emit a declaration for all "by ref" decls.
3295-
for (SmallVectorImpl<ValueDecl *>::iterator I = BlockByRefDecls.begin(),
3296-
E = BlockByRefDecls.end(); I != E; ++I) {
3295+
for (auto I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E;
3296+
++I) {
32973297
S += " ";
32983298
std::string Name = (*I)->getNameAsString();
32993299
std::string TypeString;
@@ -3303,8 +3303,8 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
33033303
S += Name + " = __cself->" + (*I)->getNameAsString() + "; // bound by ref\n";
33043304
}
33053305
// Next, emit a declaration for all "by copy" declarations.
3306-
for (SmallVectorImpl<ValueDecl *>::iterator I = BlockByCopyDecls.begin(),
3307-
E = BlockByCopyDecls.end(); I != E; ++I) {
3306+
for (auto I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E;
3307+
++I) {
33083308
S += " ";
33093309
// Handle nested closure invocation. For example:
33103310
//
@@ -3400,8 +3400,8 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
34003400

34013401
if (BlockDeclRefs.size()) {
34023402
// Output all "by copy" declarations.
3403-
for (SmallVectorImpl<ValueDecl *>::iterator I = BlockByCopyDecls.begin(),
3404-
E = BlockByCopyDecls.end(); I != E; ++I) {
3403+
for (auto I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E;
3404+
++I) {
34053405
S += " ";
34063406
std::string FieldName = (*I)->getNameAsString();
34073407
std::string ArgName = "_" + FieldName;
@@ -3429,8 +3429,8 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
34293429
S += FieldName + ";\n";
34303430
}
34313431
// Output all "by ref" declarations.
3432-
for (SmallVectorImpl<ValueDecl *>::iterator I = BlockByRefDecls.begin(),
3433-
E = BlockByRefDecls.end(); I != E; ++I) {
3432+
for (auto I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E;
3433+
++I) {
34343434
S += " ";
34353435
std::string FieldName = (*I)->getNameAsString();
34363436
std::string ArgName = "_" + FieldName;
@@ -3448,8 +3448,8 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
34483448
Constructor += ", int flags=0)";
34493449
// Initialize all "by copy" arguments.
34503450
bool firsTime = true;
3451-
for (SmallVectorImpl<ValueDecl *>::iterator I = BlockByCopyDecls.begin(),
3452-
E = BlockByCopyDecls.end(); I != E; ++I) {
3451+
for (auto I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E;
3452+
++I) {
34533453
std::string Name = (*I)->getNameAsString();
34543454
if (firsTime) {
34553455
Constructor += " : ";
@@ -3463,8 +3463,8 @@ std::string RewriteObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
34633463
Constructor += Name + "(_" + Name + ")";
34643464
}
34653465
// Initialize all "by ref" arguments.
3466-
for (SmallVectorImpl<ValueDecl *>::iterator I = BlockByRefDecls.begin(),
3467-
E = BlockByRefDecls.end(); I != E; ++I) {
3466+
for (auto I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E;
3467+
++I) {
34683468
std::string Name = (*I)->getNameAsString();
34693469
if (firsTime) {
34703470
Constructor += " : ";
@@ -4439,8 +4439,8 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
44394439
if (BlockDeclRefs.size()) {
44404440
Expr *Exp;
44414441
// Output all "by copy" declarations.
4442-
for (SmallVectorImpl<ValueDecl *>::iterator I = BlockByCopyDecls.begin(),
4443-
E = BlockByCopyDecls.end(); I != E; ++I) {
4442+
for (auto I = BlockByCopyDecls.begin(), E = BlockByCopyDecls.end(); I != E;
4443+
++I) {
44444444
if (isObjCType((*I)->getType())) {
44454445
// FIXME: Conform to ABI ([[obj retain] autorelease]).
44464446
FD = SynthBlockInitFunctionDecl((*I)->getName());
@@ -4476,8 +4476,8 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
44764476
InitExprs.push_back(Exp);
44774477
}
44784478
// Output all "by ref" declarations.
4479-
for (SmallVectorImpl<ValueDecl *>::iterator I = BlockByRefDecls.begin(),
4480-
E = BlockByRefDecls.end(); I != E; ++I) {
4479+
for (auto I = BlockByRefDecls.begin(), E = BlockByRefDecls.end(); I != E;
4480+
++I) {
44814481
ValueDecl *ND = (*I);
44824482
std::string Name(ND->getNameAsString());
44834483
std::string RecName;

0 commit comments

Comments
 (0)