@@ -490,10 +490,8 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
490
490
lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
491
491
492
492
bool saw_function_with_body = false ;
493
-
494
- for (Module::iterator fi = module.begin (), fe = module.end (); fi != fe;
495
- ++fi) {
496
- if (fi->begin () != fi->end ()) {
493
+ for (Function &f : module) {
494
+ if (f.begin () != f.end ()) {
497
495
if (saw_function_with_body) {
498
496
LLDB_LOGF (log , " More than one function in the module has a body" );
499
497
error.SetErrorToGenericError ();
@@ -504,13 +502,11 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
504
502
}
505
503
}
506
504
507
- for (Function::iterator bbi = function.begin (), bbe = function.end ();
508
- bbi != bbe; ++bbi) {
509
- for (BasicBlock::iterator ii = bbi->begin (), ie = bbi->end (); ii != ie;
510
- ++ii) {
511
- switch (ii->getOpcode ()) {
505
+ for (BasicBlock &bb : function) {
506
+ for (Instruction &ii : bb) {
507
+ switch (ii.getOpcode ()) {
512
508
default : {
513
- LLDB_LOGF (log , " Unsupported instruction: %s" , PrintValue (&* ii).c_str ());
509
+ LLDB_LOGF (log , " Unsupported instruction: %s" , PrintValue (&ii).c_str ());
514
510
error.SetErrorToGenericError ();
515
511
error.SetErrorString (unsupported_opcode_error);
516
512
return false ;
@@ -522,7 +518,7 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
522
518
case Instruction::PHI:
523
519
break ;
524
520
case Instruction::Call: {
525
- CallInst *call_inst = dyn_cast<CallInst>(ii);
521
+ CallInst *call_inst = dyn_cast<CallInst>(& ii);
526
522
527
523
if (!call_inst) {
528
524
error.SetErrorToGenericError ();
@@ -532,7 +528,7 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
532
528
533
529
if (!CanIgnoreCall (call_inst) && !support_function_calls) {
534
530
LLDB_LOGF (log , " Unsupported instruction: %s" ,
535
- PrintValue (&* ii).c_str ());
531
+ PrintValue (&ii).c_str ());
536
532
error.SetErrorToGenericError ();
537
533
error.SetErrorString (unsupported_opcode_error);
538
534
return false ;
@@ -541,7 +537,7 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
541
537
case Instruction::GetElementPtr:
542
538
break ;
543
539
case Instruction::ICmp: {
544
- ICmpInst *icmp_inst = dyn_cast<ICmpInst>(ii);
540
+ ICmpInst *icmp_inst = dyn_cast<ICmpInst>(& ii);
545
541
546
542
if (!icmp_inst) {
547
543
error.SetErrorToGenericError ();
@@ -552,7 +548,7 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
552
548
switch (icmp_inst->getPredicate ()) {
553
549
default : {
554
550
LLDB_LOGF (log , " Unsupported ICmp predicate: %s" ,
555
- PrintValue (&* ii).c_str ());
551
+ PrintValue (&ii).c_str ());
556
552
557
553
error.SetErrorToGenericError ();
558
554
error.SetErrorString (unsupported_opcode_error);
@@ -594,8 +590,8 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
594
590
break ;
595
591
}
596
592
597
- for (int oi = 0 , oe = ii-> getNumOperands (); oi != oe; ++oi) {
598
- Value *operand = ii-> getOperand (oi);
593
+ for (unsigned oi = 0 , oe = ii. getNumOperands (); oi != oe; ++oi) {
594
+ Value *operand = ii. getOperand (oi);
599
595
Type *operand_type = operand->getType ();
600
596
601
597
switch (operand_type->getTypeID ()) {
0 commit comments