improve loop detection

This commit is contained in:
xensik 2022-03-19 10:13:58 +01:00
parent 689d17cd6f
commit e1a244ff0e

View File

@ -1638,9 +1638,16 @@ void decompiler::decompile_loop(const ast::stmt_list::ptr& stmt, std::uint32_t s
return; return;
} }
auto ref1 = stmt->list.at(end).loc().label();
auto ref2 = stmt->list.at(start).loc().label(); auto ref2 = stmt->list.at(start).loc().label();
if (find_location_reference(stmt, start, end, ref2)) if (find_location_reference(stmt, start, end, ref1))
{
// jump is referenced, not post-expr
decompile_while(stmt, start, end);
return;
}
else if (find_location_reference(stmt, start, end, ref2))
{ {
// continue is at begin, not post-expr // continue is at begin, not post-expr
decompile_while(stmt, start, end); decompile_while(stmt, start, end);