Implement Local and TryCatch lowering in MirBuilder
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
@ -228,11 +228,30 @@ impl MirVerifier {
|
||||
while let Some(current) = worklist.pop() {
|
||||
if reachable.insert(current) {
|
||||
if let Some(block) = function.blocks.get(¤t) {
|
||||
// Add normal successors
|
||||
for successor in &block.successors {
|
||||
if !reachable.contains(successor) {
|
||||
worklist.push(*successor);
|
||||
}
|
||||
}
|
||||
|
||||
// Add exception handler blocks as reachable
|
||||
for instruction in &block.instructions {
|
||||
if let super::MirInstruction::Catch { handler_bb, .. } = instruction {
|
||||
if !reachable.contains(handler_bb) {
|
||||
worklist.push(*handler_bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Also check terminator for exception handlers
|
||||
if let Some(ref terminator) = block.terminator {
|
||||
if let super::MirInstruction::Catch { handler_bb, .. } = terminator {
|
||||
if !reachable.contains(handler_bb) {
|
||||
worklist.push(*handler_bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user