@@ -156,14 +156,18 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
156
156
fn_ptr : Bx :: Value ,
157
157
llargs : & [ Bx :: Value ] ,
158
158
destination : Option < ( ReturnDest < ' tcx , Bx :: Value > , mir:: BasicBlock ) > ,
159
- cleanup : Option < mir:: BasicBlock > ,
159
+ unwind : mir:: UnwindAction ,
160
160
copied_constant_arguments : & [ PlaceRef < ' tcx , <Bx as BackendTypes >:: Value > ] ,
161
161
mergeable_succ : bool ,
162
162
) -> MergingSucc {
163
163
// If there is a cleanup block and the function we're calling can unwind, then
164
164
// do an invoke, otherwise do a call.
165
165
let fn_ty = bx. fn_decl_backend_type ( & fn_abi) ;
166
166
167
+ let cleanup = match unwind {
168
+ mir:: UnwindAction :: Cleanup ( cleanup) => Some ( cleanup) ,
169
+ mir:: UnwindAction :: Continue => None ,
170
+ } ;
167
171
let unwind_block = if let Some ( cleanup) = cleanup. filter ( |_| fn_abi. can_unwind ) {
168
172
Some ( self . llbb_with_cleanup ( fx, cleanup) )
169
173
} else if fx. mir [ self . bb ] . is_cleanup
@@ -244,11 +248,11 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
244
248
options : InlineAsmOptions ,
245
249
line_spans : & [ Span ] ,
246
250
destination : Option < mir:: BasicBlock > ,
247
- cleanup : Option < mir:: BasicBlock > ,
251
+ unwind : mir:: UnwindAction ,
248
252
instance : Instance < ' _ > ,
249
253
mergeable_succ : bool ,
250
254
) -> MergingSucc {
251
- if let Some ( cleanup) = cleanup {
255
+ if let mir :: UnwindAction :: Cleanup ( cleanup) = unwind {
252
256
let ret_llbb = if let Some ( target) = destination {
253
257
fx. llbb ( target)
254
258
} else {
@@ -431,7 +435,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
431
435
bx : & mut Bx ,
432
436
location : mir:: Place < ' tcx > ,
433
437
target : mir:: BasicBlock ,
434
- unwind : Option < mir:: BasicBlock > ,
438
+ unwind : mir:: UnwindAction ,
435
439
mergeable_succ : bool ,
436
440
) -> MergingSucc {
437
441
let ty = location. ty ( self . mir , bx. tcx ( ) ) . ty ;
@@ -552,7 +556,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
552
556
expected : bool ,
553
557
msg : & mir:: AssertMessage < ' tcx > ,
554
558
target : mir:: BasicBlock ,
555
- cleanup : Option < mir:: BasicBlock > ,
559
+ unwind : mir:: UnwindAction ,
556
560
mergeable_succ : bool ,
557
561
) -> MergingSucc {
558
562
let span = terminator. source_info . span ;
@@ -618,7 +622,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
618
622
let ( fn_abi, llfn) = common:: build_langcall ( bx, Some ( span) , lang_item) ;
619
623
620
624
// 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 ) ;
622
626
assert_eq ! ( merging_succ, MergingSucc :: False ) ;
623
627
MergingSucc :: False
624
628
}
@@ -636,7 +640,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
636
640
let ( fn_abi, llfn) = common:: build_langcall ( bx, Some ( span) , LangItem :: PanicCannotUnwind ) ;
637
641
638
642
// 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 ) ;
640
644
assert_eq ! ( merging_succ, MergingSucc :: False ) ;
641
645
}
642
646
@@ -649,7 +653,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
649
653
instance : Option < Instance < ' tcx > > ,
650
654
source_info : mir:: SourceInfo ,
651
655
target : Option < mir:: BasicBlock > ,
652
- cleanup : Option < mir:: BasicBlock > ,
656
+ unwind : mir:: UnwindAction ,
653
657
mergeable_succ : bool ,
654
658
) -> Option < MergingSucc > {
655
659
// 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> {
696
700
llfn,
697
701
& [ msg. 0 , msg. 1 ] ,
698
702
target. as_ref ( ) . map ( |bb| ( ReturnDest :: Nothing , * bb) ) ,
699
- cleanup ,
703
+ unwind ,
700
704
& [ ] ,
701
705
mergeable_succ,
702
706
)
@@ -719,7 +723,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
719
723
args : & [ mir:: Operand < ' tcx > ] ,
720
724
destination : mir:: Place < ' tcx > ,
721
725
target : Option < mir:: BasicBlock > ,
722
- cleanup : Option < mir:: BasicBlock > ,
726
+ unwind : mir:: UnwindAction ,
723
727
fn_span : Span ,
724
728
mergeable_succ : bool ,
725
729
) -> MergingSucc {
@@ -783,7 +787,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
783
787
instance,
784
788
source_info,
785
789
target,
786
- cleanup ,
790
+ unwind ,
787
791
mergeable_succ,
788
792
) {
789
793
return merging_succ;
@@ -1064,7 +1068,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1064
1068
fn_ptr,
1065
1069
& llargs,
1066
1070
target. as_ref ( ) . map ( |& target| ( ret_dest, target) ) ,
1067
- cleanup ,
1071
+ unwind ,
1068
1072
& copied_constant_arguments,
1069
1073
false ,
1070
1074
) ;
@@ -1084,7 +1088,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1084
1088
fn_ptr,
1085
1089
& llargs,
1086
1090
target. as_ref ( ) . map ( |& target| ( ret_dest, target) ) ,
1087
- cleanup ,
1091
+ unwind ,
1088
1092
& copied_constant_arguments,
1089
1093
mergeable_succ,
1090
1094
)
@@ -1100,7 +1104,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1100
1104
options : ast:: InlineAsmOptions ,
1101
1105
line_spans : & [ Span ] ,
1102
1106
destination : Option < mir:: BasicBlock > ,
1103
- cleanup : Option < mir:: BasicBlock > ,
1107
+ unwind : mir:: UnwindAction ,
1104
1108
instance : Instance < ' _ > ,
1105
1109
mergeable_succ : bool ,
1106
1110
) -> MergingSucc {
@@ -1164,7 +1168,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1164
1168
options,
1165
1169
line_spans,
1166
1170
destination,
1167
- cleanup ,
1171
+ unwind ,
1168
1172
instance,
1169
1173
mergeable_succ,
1170
1174
)
@@ -1274,7 +1278,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1274
1278
self . codegen_drop_terminator ( helper, bx, place, target, unwind, mergeable_succ ( ) )
1275
1279
}
1276
1280
1277
- mir:: TerminatorKind :: Assert { ref cond, expected, ref msg, target, cleanup } => self
1281
+ mir:: TerminatorKind :: Assert { ref cond, expected, ref msg, target, unwind } => self
1278
1282
. codegen_assert_terminator (
1279
1283
helper,
1280
1284
bx,
@@ -1283,7 +1287,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1283
1287
expected,
1284
1288
msg,
1285
1289
target,
1286
- cleanup ,
1290
+ unwind ,
1287
1291
mergeable_succ ( ) ,
1288
1292
) ,
1289
1293
@@ -1292,7 +1296,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1292
1296
ref args,
1293
1297
destination,
1294
1298
target,
1295
- cleanup ,
1299
+ unwind ,
1296
1300
from_hir_call : _,
1297
1301
fn_span,
1298
1302
} => self . codegen_call_terminator (
@@ -1303,7 +1307,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1303
1307
args,
1304
1308
destination,
1305
1309
target,
1306
- cleanup ,
1310
+ unwind ,
1307
1311
fn_span,
1308
1312
mergeable_succ ( ) ,
1309
1313
) ,
@@ -1320,7 +1324,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1320
1324
options,
1321
1325
line_spans,
1322
1326
destination,
1323
- cleanup ,
1327
+ unwind ,
1324
1328
} => self . codegen_asm_terminator (
1325
1329
helper,
1326
1330
bx,
@@ -1330,7 +1334,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1330
1334
options,
1331
1335
line_spans,
1332
1336
destination,
1333
- cleanup ,
1337
+ unwind ,
1334
1338
self . instance ,
1335
1339
mergeable_succ ( ) ,
1336
1340
) ,
0 commit comments