1
Fork 0

Refactor Callee::call to take bcx by-reference.

Also change to not return anything; nothing used the return ValueRef.

Inlines with_cond.
This commit is contained in:
Mark-Simulacrum 2016-12-17 12:27:48 -07:00 committed by Mark Simulacrum
parent 9a198534e2
commit 937001a1f8
4 changed files with 46 additions and 75 deletions

View file

@ -480,24 +480,6 @@ pub fn to_immediate(bcx: &BlockAndBuilder, val: ValueRef, ty: Ty) -> ValueRef {
}
}
pub fn with_cond<'blk, 'tcx, F>(
bcx: BlockAndBuilder<'blk, 'tcx>, val: ValueRef, f: F
) -> BlockAndBuilder<'blk, 'tcx>
where F: FnOnce(BlockAndBuilder<'blk, 'tcx>) -> BlockAndBuilder<'blk, 'tcx>
{
if common::const_to_opt_uint(val) == Some(0) {
return bcx;
}
let fcx = bcx.fcx();
let next_cx = fcx.build_new_block("next");
let cond_cx = fcx.build_new_block("cond");
bcx.cond_br(val, cond_cx.llbb(), next_cx.llbb());
let after_cx = f(cond_cx);
after_cx.br(next_cx.llbb());
next_cx
}
pub enum Lifetime { Start, End }
impl Lifetime {