================
@@ -150,29 +152,38 @@ bool
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(
EmulateInstruction::InstructionCondition last_condition =
EmulateInstruction::UnconditionalCondition;
- for (const InstructionSP &inst : inst_list.Instructions()) {
- if (!inst)
- continue;
- DumpInstToLog(log, *inst, inst_list);
+ std::deque<std::size_t> to_visit = {0};
+ llvm::SmallSet<std::size_t, 0> enqueued = {0};
+
+ // Instructions reachable through jumps are inserted on the front.
+ // The next instruction in inserted on the back.
+ // Pop from the back to ensure non-branching instructions are visited
+ // sequentially.
+ while (!to_visit.empty()) {
+ std::size_t current_index = to_visit.back();
----------------
DavidSpickett wrote:
No I just forgot that C++ be weird sometimes.
I'd put the pop_back() immediately after the back() to make it clear there
isn't a state in this code where you rely on having a copy of the index but
that index still being the back of the queue.
But it's only one line away so do whatever you prefer.
Surprising to me there isn't a pop_back that returns a value but if there were,
you'd be "paying" for the copy and hoping the compiler was smart enough to
discard it. And you know how C++ is with paying for things you don't use.
https://github.com/llvm/llvm-project/pull/169630
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits