@@ -156,14 +156,18 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
156156 fn_ptr : Bx :: Value ,
157157 llargs : & [ Bx :: Value ] ,
158158 destination : Option < ( ReturnDest < ' tcx , Bx :: Value > , mir:: BasicBlock ) > ,
159- cleanup : Option < mir:: BasicBlock > ,
159+ unwind : mir:: UnwindAction ,
160160 copied_constant_arguments : & [ PlaceRef < ' tcx , <Bx as BackendTypes >:: Value > ] ,
161161 mergeable_succ : bool ,
162162 ) -> MergingSucc {
163163 // If there is a cleanup block and the function we're calling can unwind, then
164164 // do an invoke, otherwise do a call.
165165 let fn_ty = bx. fn_decl_backend_type ( & fn_abi) ;
166166
167+ let cleanup = match unwind {
168+ mir:: UnwindAction :: Cleanup ( cleanup) => Some ( cleanup) ,
169+ mir:: UnwindAction :: Continue => None ,
170+ } ;
167171 let unwind_block = if let Some ( cleanup) = cleanup. filter ( |_| fn_abi. can_unwind ) {
168172 Some ( self . llbb_with_cleanup ( fx, cleanup) )
169173 } else if fx. mir [ self . bb ] . is_cleanup
@@ -244,11 +248,11 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
244248 options : InlineAsmOptions ,
245249 line_spans : & [ Span ] ,
246250 destination : Option < mir:: BasicBlock > ,
247- cleanup : Option < mir:: BasicBlock > ,
251+ unwind : mir:: UnwindAction ,
248252 instance : Instance < ' _ > ,
249253 mergeable_succ : bool ,
250254 ) -> MergingSucc {
251- if let Some ( cleanup) = cleanup {
255+ if let mir :: UnwindAction :: Cleanup ( cleanup) = unwind {
252256 let ret_llbb = if let Some ( target) = destination {
253257 fx. llbb ( target)
254258 } else {
@@ -431,7 +435,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
431435 bx : & mut Bx ,
432436 location : mir:: Place < ' tcx > ,
433437 target : mir:: BasicBlock ,
434- unwind : Option < mir:: BasicBlock > ,
438+ unwind : mir:: UnwindAction ,
435439 mergeable_succ : bool ,
436440 ) -> MergingSucc {
437441 let ty = location. ty ( self . mir , bx. tcx ( ) ) . ty ;
@@ -552,7 +556,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
552556 expected : bool ,
553557 msg : & mir:: AssertMessage < ' tcx > ,
554558 target : mir:: BasicBlock ,
555- cleanup : Option < mir:: BasicBlock > ,
559+ unwind : mir:: UnwindAction ,
556560 mergeable_succ : bool ,
557561 ) -> MergingSucc {
558562 let span = terminator. source_info . span ;
@@ -618,7 +622,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
618622 let ( fn_abi, llfn) = common:: build_langcall ( bx, Some ( span) , lang_item) ;
619623
620624 // Codegen the actual panic invoke/call.
621- let merging_succ = helper. do_call ( self , bx, fn_abi, llfn, & args, None , cleanup , & [ ] , false ) ;
625+ let merging_succ = helper. do_call ( self , bx, fn_abi, llfn, & args, None , unwind , & [ ] , false ) ;
622626 assert_eq ! ( merging_succ, MergingSucc :: False ) ;
623627 MergingSucc :: False
624628 }
@@ -636,7 +640,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
636640 let ( fn_abi, llfn) = common:: build_langcall ( bx, Some ( span) , LangItem :: PanicCannotUnwind ) ;
637641
638642 // Codegen the actual panic invoke/call.
639- let merging_succ = helper. do_call ( self , bx, fn_abi, llfn, & [ ] , None , None , & [ ] , false ) ;
643+ let merging_succ = helper. do_call ( self , bx, fn_abi, llfn, & [ ] , None , mir :: UnwindAction :: Continue , & [ ] , false ) ;
640644 assert_eq ! ( merging_succ, MergingSucc :: False ) ;
641645 }
642646
@@ -649,7 +653,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
649653 instance : Option < Instance < ' tcx > > ,
650654 source_info : mir:: SourceInfo ,
651655 target : Option < mir:: BasicBlock > ,
652- cleanup : Option < mir:: BasicBlock > ,
656+ unwind : mir:: UnwindAction ,
653657 mergeable_succ : bool ,
654658 ) -> Option < MergingSucc > {
655659 // Emit a panic or a no-op for `assert_*` intrinsics.
@@ -696,7 +700,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
696700 llfn,
697701 & [ msg. 0 , msg. 1 ] ,
698702 target. as_ref ( ) . map ( |bb| ( ReturnDest :: Nothing , * bb) ) ,
699- cleanup ,
703+ unwind ,
700704 & [ ] ,
701705 mergeable_succ,
702706 )
@@ -719,7 +723,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
719723 args : & [ mir:: Operand < ' tcx > ] ,
720724 destination : mir:: Place < ' tcx > ,
721725 target : Option < mir:: BasicBlock > ,
722- cleanup : Option < mir:: BasicBlock > ,
726+ unwind : mir:: UnwindAction ,
723727 fn_span : Span ,
724728 mergeable_succ : bool ,
725729 ) -> MergingSucc {
@@ -783,7 +787,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
783787 instance,
784788 source_info,
785789 target,
786- cleanup ,
790+ unwind ,
787791 mergeable_succ,
788792 ) {
789793 return merging_succ;
@@ -1064,7 +1068,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10641068 fn_ptr,
10651069 & llargs,
10661070 target. as_ref ( ) . map ( |& target| ( ret_dest, target) ) ,
1067- cleanup ,
1071+ unwind ,
10681072 & copied_constant_arguments,
10691073 false ,
10701074 ) ;
@@ -1084,7 +1088,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10841088 fn_ptr,
10851089 & llargs,
10861090 target. as_ref ( ) . map ( |& target| ( ret_dest, target) ) ,
1087- cleanup ,
1091+ unwind ,
10881092 & copied_constant_arguments,
10891093 mergeable_succ,
10901094 )
@@ -1100,7 +1104,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11001104 options : ast:: InlineAsmOptions ,
11011105 line_spans : & [ Span ] ,
11021106 destination : Option < mir:: BasicBlock > ,
1103- cleanup : Option < mir:: BasicBlock > ,
1107+ unwind : mir:: UnwindAction ,
11041108 instance : Instance < ' _ > ,
11051109 mergeable_succ : bool ,
11061110 ) -> MergingSucc {
@@ -1164,7 +1168,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11641168 options,
11651169 line_spans,
11661170 destination,
1167- cleanup ,
1171+ unwind ,
11681172 instance,
11691173 mergeable_succ,
11701174 )
@@ -1274,7 +1278,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
12741278 self . codegen_drop_terminator ( helper, bx, place, target, unwind, mergeable_succ ( ) )
12751279 }
12761280
1277- mir:: TerminatorKind :: Assert { ref cond, expected, ref msg, target, cleanup } => self
1281+ mir:: TerminatorKind :: Assert { ref cond, expected, ref msg, target, unwind } => self
12781282 . codegen_assert_terminator (
12791283 helper,
12801284 bx,
@@ -1283,7 +1287,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
12831287 expected,
12841288 msg,
12851289 target,
1286- cleanup ,
1290+ unwind ,
12871291 mergeable_succ ( ) ,
12881292 ) ,
12891293
@@ -1292,7 +1296,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
12921296 ref args,
12931297 destination,
12941298 target,
1295- cleanup ,
1299+ unwind ,
12961300 from_hir_call : _,
12971301 fn_span,
12981302 } => self . codegen_call_terminator (
@@ -1303,7 +1307,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
13031307 args,
13041308 destination,
13051309 target,
1306- cleanup ,
1310+ unwind ,
13071311 fn_span,
13081312 mergeable_succ ( ) ,
13091313 ) ,
@@ -1320,7 +1324,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
13201324 options,
13211325 line_spans,
13221326 destination,
1323- cleanup ,
1327+ unwind ,
13241328 } => self . codegen_asm_terminator (
13251329 helper,
13261330 bx,
@@ -1330,7 +1334,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
13301334 options,
13311335 line_spans,
13321336 destination,
1333- cleanup ,
1337+ unwind ,
13341338 self . instance ,
13351339 mergeable_succ ( ) ,
13361340 ) ,
0 commit comments