pub fn optimize_with_observer<F>(ast: &mut AST, observe: F)where F: FnMut(CfgDumpStage, &Cfg),
Like optimize, and exposes the CFG before and after dead-function elimination. The observer owns any optional diagnostics or I/O, keeping the passes themselves pure.
optimize