Merge need_invoke and needs_invoke

This commit is contained in:
Mark-Simulacrum 2016-12-12 22:43:53 -07:00 committed by Mark Simulacrum
parent 6412f3128d
commit 91707dc991
2 changed files with 8 additions and 11 deletions

View File

@ -686,16 +686,8 @@ fn trans_call_inner<'a, 'blk, 'tcx>(bcx: BlockAndBuilder<'blk, 'tcx>,
_ => bug!("expected fn pointer callee, found {:?}", callee)
};
fn need_invoke(bcx: &BlockAndBuilder, had_lpad: bool) -> bool {
if bcx.sess().no_landing_pads() || had_lpad {
false
} else {
bcx.fcx().needs_invoke()
}
}
let _icx = push_ctxt("invoke_");
let (llret, bcx) = if need_invoke(&bcx, lpad.is_some()) {
let (llret, bcx) = if bcx.fcx().needs_invoke(lpad.is_some()) {
debug!("invoking {:?} at {:?}", Value(llfn), bcx.llbb());
for &llarg in &llargs {
debug!("arg: {:?}", Value(llarg));

View File

@ -211,8 +211,12 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
}
/// Returns true if there are pending cleanups that should execute on panic.
pub fn needs_invoke(&self) -> bool {
self.scopes_len() > 0
pub fn needs_invoke(&self, lpad_present: bool) -> bool {
if self.ccx.sess().no_landing_pads() || lpad_present {
false
} else {
self.scopes_len() > 0
}
}
/// Creates a landing pad for the top scope, if one does not exist. The
@ -297,6 +301,7 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
}
fn push_scope(&self, scope: CleanupScope<'tcx>) -> CustomScopeIndex {
assert!(self.scopes_len() == 0);
let index = self.scopes_len();
debug!("pushing custom cleanup scope: {}", index);
self.scopes.borrow_mut().push(scope);