@@ -120,15 +120,14 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
120120 cfa_reg_value.SetUInt (m_initial_cfa, m_state.cfa_reg_info .byte_size );
121121 SetRegisterValue (m_state.cfa_reg_info , cfa_reg_value);
122122
123- const InstructionList &inst_list = disasm_sp->GetInstructionList ();
124- const size_t num_instructions = inst_list.GetSize ();
123+ InstructionList inst_list = disasm_sp->GetInstructionList ();
125124
126- if (num_instructions == 0 ) {
125+ if (inst_list. GetSize () == 0 ) {
127126 DumpUnwindRowsToLog (log, range, unwind_plan);
128127 return unwind_plan.GetRowCount () > 0 ;
129128 }
130129
131- Instruction &first_inst = *inst_list.GetInstructionAtIndex (0 ). get () ;
130+ Instruction &first_inst = *inst_list.GetInstructionAtIndex (0 );
132131 const lldb::addr_t base_addr = first_inst.GetAddress ().GetFileAddress ();
133132
134133 // Map for storing the unwind state at a given offset. When we see a forward
@@ -151,15 +150,14 @@ bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
151150 EmulateInstruction::InstructionCondition last_condition =
152151 EmulateInstruction::UnconditionalCondition;
153152
154- for (size_t idx = 0 ; idx < num_instructions; ++idx) {
155- m_curr_row_modified = false ;
156- m_forward_branch_offset = 0 ;
157-
158- Instruction *inst = inst_list.GetInstructionAtIndex (idx).get ();
153+ for (const InstructionSP &inst : inst_list.Instructions ()) {
159154 if (!inst)
160155 continue ;
161156 DumpInstToLog (log, *inst, inst_list);
162157
158+ m_curr_row_modified = false ;
159+ m_forward_branch_offset = 0 ;
160+
163161 lldb::addr_t current_offset =
164162 inst->GetAddress ().GetFileAddress () - base_addr;
165163 auto it = saved_unwind_states.upper_bound (current_offset);
0 commit comments