@@ -119,13 +119,16 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
119
119
if let Some ( unwind) = unwind {
120
120
let uwbcx = self . bcx ( unwind) ;
121
121
let unwind = self . make_landing_pad ( uwbcx) ;
122
+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
122
123
bcx. invoke ( drop_fn,
123
124
& [ llvalue] ,
124
125
self . llblock ( target) ,
125
126
unwind. llbb ( ) ,
127
+ bundle,
126
128
None ) ;
127
129
} else {
128
- bcx. call ( drop_fn, & [ llvalue] , None ) ;
130
+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
131
+ bcx. call ( drop_fn, & [ llvalue] , bundle, None ) ;
129
132
bcx. br ( self . llblock ( target) ) ;
130
133
}
131
134
}
@@ -187,24 +190,28 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
187
190
let cleanup = self . bcx ( cleanup) ;
188
191
let landingpad = self . make_landing_pad ( cleanup) ;
189
192
let unreachable_blk = self . unreachable_block ( ) ;
193
+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
190
194
bcx. invoke ( callee. immediate ( ) ,
191
195
& llargs[ ..] ,
192
196
unreachable_blk. llbb ,
193
197
landingpad. llbb ( ) ,
198
+ bundle,
194
199
Some ( attrs) ) ;
195
200
} ,
196
201
( false , false , & Some ( cleanup) , & Some ( ( _, success) ) ) => {
197
202
let cleanup = self . bcx ( cleanup) ;
198
203
let landingpad = self . make_landing_pad ( cleanup) ;
199
204
let ( target, postinvoke) = if must_copy_dest {
200
- ( bcx. fcx ( ) . new_block ( "" , None ) , Some ( self . bcx ( success) ) )
205
+ ( bcx. fcx ( ) . new_block ( "" , None , None ) . build ( ) , Some ( self . bcx ( success) ) )
201
206
} else {
202
207
( self . bcx ( success) , None )
203
208
} ;
209
+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
204
210
let invokeret = bcx. invoke ( callee. immediate ( ) ,
205
211
& llargs[ ..] ,
206
212
target. llbb ( ) ,
207
213
landingpad. llbb ( ) ,
214
+ bundle,
208
215
Some ( attrs) ) ;
209
216
if let Some ( postinvoketarget) = postinvoke {
210
217
// We translate the copy into a temporary block. The temporary block is
@@ -240,7 +247,8 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
240
247
}
241
248
} ,
242
249
( false , _, _, & None ) => {
243
- bcx. call ( callee. immediate ( ) , & llargs[ ..] , Some ( attrs) ) ;
250
+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
251
+ bcx. call ( callee. immediate ( ) , & llargs[ ..] , bundle, Some ( attrs) ) ;
244
252
bcx. unreachable ( ) ;
245
253
}
246
254
( false , _, _, & Some ( ( _, target) ) ) => {
@@ -301,26 +309,25 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
301
309
cleanup : BlockAndBuilder < ' bcx , ' tcx > )
302
310
-> BlockAndBuilder < ' bcx , ' tcx >
303
311
{
312
+ let cleanup_llbb = cleanup. llbb ( ) ;
304
313
let bcx = cleanup. map_block ( |cleanup| {
305
- cleanup. fcx . new_block ( "cleanup" , None )
314
+ // FIXME(#30941) this doesn't handle msvc-style exceptions
315
+ cleanup. fcx . new_block ( "cleanup" , None , Some ( LandingPad :: gnu ( ) ) )
306
316
} ) ;
307
- // FIXME(#30941) this doesn't handle msvc-style exceptions
308
- * bcx. lpad . borrow_mut ( ) = Some ( LandingPad :: gnu ( ) ) ;
309
- let bcx = bcx. build ( ) ;
310
317
let ccx = bcx. ccx ( ) ;
311
318
let llpersonality = bcx. fcx ( ) . eh_personality ( ) ;
312
319
let llretty = Type :: struct_ ( ccx, & [ Type :: i8p ( ccx) , Type :: i32 ( ccx) ] , false ) ;
313
320
let llretval = bcx. landing_pad ( llretty, llpersonality, 1 , bcx. fcx ( ) . llfn ) ;
314
321
bcx. set_cleanup ( llretval) ;
315
322
let slot = self . get_personality_slot ( & bcx) ;
316
323
bcx. store ( llretval, slot) ;
317
- bcx. br ( cleanup . llbb ( ) ) ;
324
+ bcx. br ( cleanup_llbb ) ;
318
325
bcx
319
326
}
320
327
321
328
fn unreachable_block ( & mut self ) -> Block < ' bcx , ' tcx > {
322
329
self . unreachable_block . unwrap_or_else ( || {
323
- let bl = self . fcx . new_block ( "unreachable" , None ) ;
330
+ let bl = self . fcx . new_block ( "unreachable" , None , None ) ;
324
331
bl. build ( ) . unreachable ( ) ;
325
332
self . unreachable_block = Some ( bl) ;
326
333
bl
0 commit comments