@@ -3293,17 +3293,16 @@ bool LLParser::parseFunctionType(Type *&Result) {
3293
3293
return true ;
3294
3294
3295
3295
// Reject names on the arguments lists.
3296
- for (unsigned i = 0 , e = ArgList.size (); i != e; ++i) {
3297
- if (!ArgList[i].Name .empty ())
3298
- return error (ArgList[i].Loc , " argument name invalid in function type" );
3299
- if (ArgList[i].Attrs .hasAttributes ())
3300
- return error (ArgList[i].Loc ,
3301
- " argument attributes invalid in function type" );
3296
+ for (const ArgInfo &Arg : ArgList) {
3297
+ if (!Arg.Name .empty ())
3298
+ return error (Arg.Loc , " argument name invalid in function type" );
3299
+ if (Arg.Attrs .hasAttributes ())
3300
+ return error (Arg.Loc , " argument attributes invalid in function type" );
3302
3301
}
3303
3302
3304
3303
SmallVector<Type*, 16 > ArgListTy;
3305
- for (unsigned i = 0 , e = ArgList. size (); i != e; ++i )
3306
- ArgListTy.push_back (ArgList[i] .Ty );
3304
+ for (const ArgInfo &Arg : ArgList)
3305
+ ArgListTy.push_back (Arg .Ty );
3307
3306
3308
3307
Result = FunctionType::get (Result, ArgListTy, IsVarArg);
3309
3308
return false ;
@@ -6404,9 +6403,9 @@ bool LLParser::parseFunctionHeader(Function *&Fn, bool IsDefine,
6404
6403
std::vector<Type*> ParamTypeList;
6405
6404
SmallVector<AttributeSet, 8 > Attrs;
6406
6405
6407
- for (unsigned i = 0 , e = ArgList. size (); i != e; ++i ) {
6408
- ParamTypeList.push_back (ArgList[i] .Ty );
6409
- Attrs.push_back (ArgList[i] .Attrs );
6406
+ for (const ArgInfo &Arg : ArgList) {
6407
+ ParamTypeList.push_back (Arg .Ty );
6408
+ Attrs.push_back (Arg .Attrs );
6410
6409
}
6411
6410
6412
6411
AttributeList PAL =
@@ -7230,8 +7229,8 @@ bool LLParser::parseIndirectBr(Instruction *&Inst, PerFunctionState &PFS) {
7230
7229
return true ;
7231
7230
7232
7231
IndirectBrInst *IBI = IndirectBrInst::Create (Address, DestList.size ());
7233
- for (unsigned i = 0 , e = DestList. size (); i != e; ++i )
7234
- IBI->addDestination (DestList[i] );
7232
+ for (BasicBlock *Dest : DestList)
7233
+ IBI->addDestination (Dest );
7235
7234
Inst = IBI;
7236
7235
return false ;
7237
7236
}
@@ -7246,8 +7245,8 @@ bool LLParser::resolveFunctionType(Type *RetType,
7246
7245
if (!FuncTy) {
7247
7246
// Pull out the types of all of the arguments...
7248
7247
std::vector<Type*> ParamTypes;
7249
- for (unsigned i = 0 , e = ArgList. size (); i != e; ++i )
7250
- ParamTypes.push_back (ArgList[i] .V ->getType ());
7248
+ for (const ParamInfo &Arg : ArgList)
7249
+ ParamTypes.push_back (Arg .V ->getType ());
7251
7250
7252
7251
if (!FunctionType::isValidReturnType (RetType))
7253
7252
return true ;
@@ -7310,19 +7309,19 @@ bool LLParser::parseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
7310
7309
// correctly. Also, gather any parameter attributes.
7311
7310
FunctionType::param_iterator I = Ty->param_begin ();
7312
7311
FunctionType::param_iterator E = Ty->param_end ();
7313
- for (unsigned i = 0 , e = ArgList. size (); i != e; ++i ) {
7312
+ for (const ParamInfo &Arg : ArgList) {
7314
7313
Type *ExpectedTy = nullptr ;
7315
7314
if (I != E) {
7316
7315
ExpectedTy = *I++;
7317
7316
} else if (!Ty->isVarArg ()) {
7318
- return error (ArgList[i] .Loc , " too many arguments specified" );
7317
+ return error (Arg .Loc , " too many arguments specified" );
7319
7318
}
7320
7319
7321
- if (ExpectedTy && ExpectedTy != ArgList[i] .V ->getType ())
7322
- return error (ArgList[i] .Loc , " argument is not of expected type '" +
7323
- getTypeString (ExpectedTy) + " '" );
7324
- Args.push_back (ArgList[i] .V );
7325
- ArgAttrs.push_back (ArgList[i] .Attrs );
7320
+ if (ExpectedTy && ExpectedTy != Arg .V ->getType ())
7321
+ return error (Arg .Loc , " argument is not of expected type '" +
7322
+ getTypeString (ExpectedTy) + " '" );
7323
+ Args.push_back (Arg .V );
7324
+ ArgAttrs.push_back (Arg .Attrs );
7326
7325
}
7327
7326
7328
7327
if (I != E)
@@ -7623,19 +7622,19 @@ bool LLParser::parseCallBr(Instruction *&Inst, PerFunctionState &PFS) {
7623
7622
// correctly. Also, gather any parameter attributes.
7624
7623
FunctionType::param_iterator I = Ty->param_begin ();
7625
7624
FunctionType::param_iterator E = Ty->param_end ();
7626
- for (unsigned i = 0 , e = ArgList. size (); i != e; ++i ) {
7625
+ for (const ParamInfo &Arg : ArgList) {
7627
7626
Type *ExpectedTy = nullptr ;
7628
7627
if (I != E) {
7629
7628
ExpectedTy = *I++;
7630
7629
} else if (!Ty->isVarArg ()) {
7631
- return error (ArgList[i] .Loc , " too many arguments specified" );
7630
+ return error (Arg .Loc , " too many arguments specified" );
7632
7631
}
7633
7632
7634
- if (ExpectedTy && ExpectedTy != ArgList[i] .V ->getType ())
7635
- return error (ArgList[i] .Loc , " argument is not of expected type '" +
7636
- getTypeString (ExpectedTy) + " '" );
7637
- Args.push_back (ArgList[i] .V );
7638
- ArgAttrs.push_back (ArgList[i] .Attrs );
7633
+ if (ExpectedTy && ExpectedTy != Arg .V ->getType ())
7634
+ return error (Arg .Loc , " argument is not of expected type '" +
7635
+ getTypeString (ExpectedTy) + " '" );
7636
+ Args.push_back (Arg .V );
7637
+ ArgAttrs.push_back (Arg .Attrs );
7639
7638
}
7640
7639
7641
7640
if (I != E)
@@ -8018,19 +8017,19 @@ bool LLParser::parseCall(Instruction *&Inst, PerFunctionState &PFS,
8018
8017
// correctly. Also, gather any parameter attributes.
8019
8018
FunctionType::param_iterator I = Ty->param_begin ();
8020
8019
FunctionType::param_iterator E = Ty->param_end ();
8021
- for (unsigned i = 0 , e = ArgList. size (); i != e; ++i ) {
8020
+ for (const ParamInfo &Arg : ArgList) {
8022
8021
Type *ExpectedTy = nullptr ;
8023
8022
if (I != E) {
8024
8023
ExpectedTy = *I++;
8025
8024
} else if (!Ty->isVarArg ()) {
8026
- return error (ArgList[i] .Loc , " too many arguments specified" );
8025
+ return error (Arg .Loc , " too many arguments specified" );
8027
8026
}
8028
8027
8029
- if (ExpectedTy && ExpectedTy != ArgList[i] .V ->getType ())
8030
- return error (ArgList[i] .Loc , " argument is not of expected type '" +
8031
- getTypeString (ExpectedTy) + " '" );
8032
- Args.push_back (ArgList[i] .V );
8033
- Attrs.push_back (ArgList[i] .Attrs );
8028
+ if (ExpectedTy && ExpectedTy != Arg .V ->getType ())
8029
+ return error (Arg .Loc , " argument is not of expected type '" +
8030
+ getTypeString (ExpectedTy) + " '" );
8031
+ Args.push_back (Arg .V );
8032
+ Attrs.push_back (Arg .Attrs );
8034
8033
}
8035
8034
8036
8035
if (I != E)
0 commit comments