mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Merge need_invoke and needs_invoke
This commit is contained in:
parent
6412f3128d
commit
91707dc991
@ -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));
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user