From b1581f7aadc4761de560cf96f62d29759804f9fa Mon Sep 17 00:00:00 2001 From: Nicole LeGare Date: Tue, 30 Sep 2025 12:35:24 -0700 Subject: [PATCH 01/15] Notes and cleanup and whatnot --- c2rust-transpile/src/cfg/loops.rs | 4 +-- c2rust-transpile/src/cfg/relooper.rs | 54 ++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/c2rust-transpile/src/cfg/loops.rs b/c2rust-transpile/src/cfg/loops.rs index 05fb151f48..02e88f958a 100644 --- a/c2rust-transpile/src/cfg/loops.rs +++ b/c2rust-transpile/src/cfg/loops.rs @@ -47,7 +47,7 @@ pub fn match_loop_body( let bb = if let Some(bb) = follow_blocks.swap_remove(&following) { bb } else { - continue; + continue; // Why would we have a follow entry with no corresponding block? }; something_happened = true; @@ -191,7 +191,7 @@ impl LoopInfo { }; } - None => return None, + None => return None, // When would this happen? If we have a loop ID, why wouldn't it correspond to a loop? } } } diff --git a/c2rust-transpile/src/cfg/relooper.rs b/c2rust-transpile/src/cfg/relooper.rs index fcbe00a23e..71461ac62e 100644 --- a/c2rust-transpile/src/cfg/relooper.rs +++ b/c2rust-transpile/src/cfg/relooper.rs @@ -126,19 +126,22 @@ impl RelooperState { } } +/// A set of basic blocks, keyed by their label. +type StructuredBlocks = IndexMap, StmtOrDecl>>; + impl RelooperState { /// Recursive helper for `reloop`. /// /// TODO: perhaps manually perform TCO? fn relooper( &mut self, - entries: IndexSet